Pale Moon Bookmarking Script using YAD / Sortable / xdotool

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

Pale Moon Bookmarking Script using YAD / Sortable / xdotool

#1 Post by kjdixo »

Edit 2016.09.22 I got the idea for sortable columns from the following web site: http://www.kryogenix.org/code/browser/sorttable/
I modified the original sorttable (comments are in my code) to integrate better with my other bookmarking scripts and I renamed it to SORTable.

This is the readme.txt
Pale Moon Browser Bookmarking script.
Tag bookmarks into predefined categories and save them as 'pdf' and 'web page complete'.
Requires accompanying script SORTable.js (modified by me) which sorts by time and domain.
Requires xclip, xdotool, yad, youtube-dl, imagemagick and a correctly configured file and folder structure.
I am using it with Puppy Linux Quirky Tahr 6.05.
Install Pale Moon browser Version 25.3.1 (x86).
During normal use ensure only one browser instance is running.
There is a reason I am using the Pale Moon in-built 'pdf' and 'web page complete' save dialogs.
These dialogs are reliable and work, "so why re-invent the wheel?".
I spent weeks messing with other methods which eventually I abandoned due to several issues one of which was UTF8 encoding issues.
My method automates the running of the Pale Moon save dialogs by using xdotool.
Un-install CUPS so that the browser print dialog only has "Print to File" and there are no printers.
Setup browser Print dialog > Page Setup > Paper Orientation to Landscape (displays pdfs better without the right side text cropped).
'/' and '?' and '#' are replaced by '_' in '$title' . . . as forward slashes etc. in the pdf filenames cause errors when saving the pdfs.
Install Evince and set default display to full screen - when in full screen type ctrl + T to set as default.
Install MPlayer for viewing the videos.
In the file /root/.mplayer/config add a line . . . osdlevel=3 . . . so that the seek times are displayed.
Go into Pale Moon > Edit > Preferences > Applications and set PDF file action = Use evince. Set video/mp4 action = Use mplayer.
Install xclip if not already installed.
Install xdotool.
Install youtube-dl.
Install YAD (version 27) in Puppy Linux install Geoffrey's .pet linked from the forums.
Setup a quick way to access the bookmarks and their configuration scripts as described below.
1. Copy the the 5 bookmark folders to your root folder (in puppy linux /root/) . . . /root/.bookmarks/ , /root/.bookmarks-02/ , /root/.bookmarks-03/ , /root/.bookmarks-04/ , /root/.bookmarks-05/
2. Add a bookmark to the Pale Moon toolbar . . . file:///root/.bookmarks/bm0/index.html
3. Add 2 shortcuts to your Openbox menu (or another launcher method) . . . use sh -c ' ' if necessary.
I used this:

Code: Select all

<item label="BM" icon="/usr/share/pixmaps/filezilla.png"><action name="Execute"><command>/root/.bookmarks/bm/launcher.sh</command></action></item>
<item label="BV" icon="/usr/share/pixmaps/filezilla.png"><action name="Execute"><command>sh -c '/root/.bookmarks/bv/launcher.sh'</command></action></item>
Whilst getting to know . . . don't be in too much of a hurry and wait up to ten seconds after each dialog has closed to wait to see if another dialog pops up.
If something goes wrong then dive in and try to hack a fix. For example when 'web page complete' is saved:
If a saved web page file extension is .htm or .xhtml then manually rename it to .html (after the script has made the .html link).
If a saved web page file extension is .txt (very rare) then manually rename it to .html (after the script has made the .html link).
I might one day automate the above two.
Also if the file extension was .txt then after renaming it to .html you could in the file add <html><body> tags and also add a <br> after every line.
IMPORTANT: the bookmark button names (tags) must not have any spaces e.g. one word only for each tag. Add these manually by editing tags.txt
ALSO: make sure the browser refresh button is accessible, as this may often need to be clicked, for 'script caused changes' to take effect.
BE VERY CAREFUL tinkering and experimenting with bash scripts especially with commands that delete or remove things.
This is a work in progress, the code has been developed over the last 3 months and I now use it with my browser every day.
I am no expert and find out what works by searching the internet for solutions. Stack Overflow is most useful in this respect.
Some of the code could be improved and made more efficient or extra features added, or the structure simplified.
I made use of the features inherent in CSS / Files and Folders / Other Tools where possible and used YAD as the interface to my scripts.
There were many other approaches possible (ie more use of arrays and loops, instead of hardwired, or utilizing the browser database) my approach might not be the best, but I like it and it works for me.
I will be posting this in the Puppy Linux Forum http://murga-linux.com/puppy/ programming section where snippets of code are show-cased and discussed.
Comments and suggestions welcome.
kjdixo
April 23 2016
Attachments
readme.txt.tar.gz
(2.26 KiB) Downloaded 152 times
.bookmarks-05.tar.gz
(82.49 KiB) Downloaded 162 times
.bookmarks-04.tar.gz
(82.49 KiB) Downloaded 176 times
.bookmarks-03.tar.gz
(82.48 KiB) Downloaded 160 times
.bookmarks-02.tar.gz
(82.47 KiB) Downloaded 145 times
.bookmarks.tar.gz
(82.52 KiB) Downloaded 167 times
shot3.jpg
(84.91 KiB) Downloaded 616 times
shot2.jpg
(51.6 KiB) Downloaded 603 times
shot1.jpg
(59.18 KiB) Downloaded 613 times
Last edited by kjdixo on Thu 22 Sep 2016, 08:13, edited 1 time in total.

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#2 Post by kjdixo »

Clicking the blue button alternately sorts the columns by domain, title and time.
Hidden Timestamp Column.
Holding the blue button for 2 seconds reveals the timestamps used to tag and retag.
Visible Columns
Clicking domain (column 1) goes to website.
Clicking title (column 2) opens pdf.
Magnifying glass (column 3) opens 'web page complete' local copy.

I will be writing a summary of how to use it soon.
Until then . . .
A picture says a thousand words.
See attached screenshots of some of the dialogs.
Attachments
shot12.png
(163.81 KiB) Downloaded 582 times
shot11.png
(130.09 KiB) Downloaded 565 times
shot10.png
(37.52 KiB) Downloaded 568 times
shot9.png
(64.54 KiB) Downloaded 572 times
shot8.png
(53 KiB) Downloaded 576 times
shot7.png
(54.84 KiB) Downloaded 580 times
shot6.png
(15.08 KiB) Downloaded 589 times
shot5.png
(14.75 KiB) Downloaded 585 times
shot4.png
(20.11 KiB) Downloaded 578 times

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#3 Post by kjdixo »

More details

Pros
1. Pale Moon starts much faster when your hundreds of bookmarks are removed from the Pale Moon Toolbar / Database.
2. I found scrolling through 900 bookmarks on the Pale Moon Toolbar tedious and often unfruitful, this makes finding stuff quicker.
3. Although the Pale Moon bookmarks search (database) was fast and accurate it was not fun to use.
4. This is more fun and quite like a file manager, it can be ordered and structured so you can find stuff quickly.
5. I can search for things using my system (sortable columns is a big help) and using the browser 'find and highlight on page' (CTRL + F).
6. It is integrated with the browser in so much as it is accessible from a toolbar icon and appears in a normal browser tab.
7. You can make it your home page or load it at browser start up if you want.
8. Having an offline repository of all your web pages means you can comfortably read stuff whilst offline.
9. Using it is enjoyable, when you tire of reading web pages then click the video button and find a video in the sortable lists.
10. It is robust, functional and difficult to lose things . . . bookmarks, tags, retags, deletes are all logged in text files and offline pdfs and web pages are never deleted.
11. It is easy to find the time-stamped physical files and delete them manually if you want, and remove lines from the log files using a text editor if necessary.

Cons
1. Needs a fair degree of bravery and determination to set up.
2. Is rigid and repetitive in structure (although that helps you track things down and make changes easily).
3. Comfort and style is important to some people, so it could be better and have more style tweaks (fonts, borders, animations and icons etc.).
4. You cannot use the Pale Moon built-in bookmarks search (database) if you have nothing bookmarked in it . . . I rarely used it.
5. Hyperlinks within pdfs aren't implemented, some web pages don't save very well to pdf and some don't save very well to 'web page complete'.

Other Notes
1. To create the video thumbnails I use imagemagick and for my version . . . the command for convert is convert.im6
2. I have deliberately made the system large to absorb hundreds and thousands of bookmarks.
3. You are not limited to 5 categories, the category mechanism is worth studying and hacking (to create more or less categories) if you want.
4. For future development . . . search functions can be done in JavaScript on wording appearing on the web pages.
5. There are many potential methods for searching files using Bash scripts and other programs and even search within files (search within pdfs).
6. Worth mentioning, I stripped out all JavaScripts from the 'web page complete' folders (using rsync with an exclusion switch for js)

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#4 Post by kjdixo »

Bookmarking with this system can best be described as a process and to be successful the bookmarking process must be allowed to run and complete.
Ensure all scripts in the sh folder are executable by the user (root in my case) rwx/r/r and all other files are just read/write rw/r/r

Webpage bookmarking

1. Ensure the required web page is displayed in Pale Moon and only one browser instance is running (other tabs don't matter).
2. The script will find and focus the browser window and begin bookmarking, so click the launcher to trigger the script /root/.bookmarks/bm/sh/launcher.sh

Code: Select all

#! /bin/bash
yad --on-top --undecorated --mouse \
--button="category:2" \
--button="buttons:3" \
--button="bookmark:4" \
--button="delete:5" \
--button="retag:6"

ret=$?
if [[ $ret -eq 2 ]]; then
sh -c '/root/.bookmarks/bm/sh/bmcat.sh'
exit 0
fi
if [[ $ret -eq 3 ]]; then
sh -c '/root/.bookmarks/bm/sh/launcher2.sh'
exit 0
fi
if [[ $ret -eq 4 ]]; then
sh -c '/root/.bookmarks/bm/sh/bm.sh'
exit 0
fi
if [[ $ret -eq 5 ]]; then
sh -c '/root/.bookmarks/bm/sh/bmdel.sh'
exit 0
fi
if [[ $ret -eq 6 ]]; then
sh -c '/root/.bookmarks/bm/sh/bmretag.sh'
exit 0
fi
2. Click the bookmark button to trigger the script /root/.bookmarks/bm/sh/bm.sh

Code: Select all

#! /bin/bash
. /root/.bookmarks/bm/txt/tags.txt
dialog=$(yad --on-top --mouse --title="Tags" --width=600 --height=600 --list --checklist --column "Add" --column "Tag" FALSE $c2 FALSE $c3 FALSE $c4 FALSE $c5 FALSE $c6 FALSE $c7 FALSE $c8 FALSE $c9 FALSE $c10 FALSE $c11 FALSE $c12 FALSE $c13 FALSE $c14 FALSE $c15 FALSE $c16 FALSE $c17 FALSE $c18 FALSE $c19 FALSE $c20 FALSE $c21 FALSE $c22 FALSE $c23 FALSE $c24 FALSE $c25 FALSE $c26 FALSE $c27)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
dialog=$(echo $dialog | sed 's/|//g' | sed 's/ //g' | sed 's/-//g')
if [[ $dialog = *TRUE$c2* ]];then bm2=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm2/index.html'><img src='../bm2/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c3* ]];then bm3=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm3/index.html'><img src='../bm3/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c4* ]];then bm4=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm4/index.html'><img src='../bm4/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c5* ]];then bm5=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm5/index.html'><img src='../bm5/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c6* ]];then bm6=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm6/index.html'><img src='../bm6/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c7* ]];then bm7=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm7/index.html'><img src='../bm7/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c8* ]];then bm8=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm8/index.html'><img src='../bm8/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c9* ]];then bm9=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm9/index.html'><img src='../bm9/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c10* ]];then bm10=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm10/index.html'><img src='../bm10/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c11* ]];then bm11=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm11/index.html'><img src='../bm11/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c12* ]];then bm12=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm12/index.html'><img src='../bm12/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c13* ]];then bm13=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm13/index.html'><img src='../bm13/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c14* ]];then bm14=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm14/index.html'><img src='../bm14/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c15* ]];then bm15=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm15/index.html'><img src='../bm15/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c16* ]];then bm16=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm16/index.html'><img src='../bm16/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c17* ]];then bm17=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm17/index.html'><img src='../bm17/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c18* ]];then bm18=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm18/index.html'><img src='../bm18/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c19* ]];then bm19=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm19/index.html'><img src='../bm19/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c20* ]];then bm20=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm20/index.html'><img src='../bm20/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c21* ]];then bm21=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm21/index.html'><img src='../bm21/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c22* ]];then bm22=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm22/index.html'><img src='../bm22/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c23* ]];then bm23=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm23/index.html'><img src='../bm23/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c24* ]];then bm24=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm24/index.html'><img src='../bm24/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c25* ]];then bm25=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm25/index.html'><img src='../bm25/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c26* ]];then bm26=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm26/index.html'><img src='../bm26/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c27* ]];then bm27=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bm27/index.html'><img src='../bm27/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE* ]];then xdotool search --classname Navigator windowactivate
rm -rf /root/.bookmarks/bm/temp.pdf
sleep 1
xdotool key "ctrl+l"
xdotool key "ctrl+c"
xdotool key "ctrl+p"
xdotool key "Down"
xdotool key "alt+p"
xdotool key "alt+r"
timestamp() {
date +"%Y-%m-%d_%H:%M:%S"
}

while [[ ! -f /root/.bookmarks/bm/temp.pdf ]]; do
sleep 0.1
done
address=$(xclip -selection clipboard -o)
winid=$(xdotool search --classname Navigator)
sleep 1
title=$(xdotool getwindowname $winid | sed -e 's/\( - Pale Moon\)*$//g') 
title=$(echo $title | yad --mouse --width=1000 --title="Edit Title or add one here" --text-info --editable --button="gtk-ok:0")
if [[ $title = "" ]]; then title=$(echo "no title"); fi

sleep 1
title1=$(echo $title | cut -c 1-64)
title2=$(echo $title1 | sed 's/\//_/g' | sed 's/?/_/g' | sed 's/"/_/g' | sed 's/#/_/g')

domain=$(echo $address | sed 's/www.//g' | awk 'BEGIN {FS="://" }{print $2}' | awk 'BEGIN {FS="/" }{print $1}')
time=$(echo $(timestamp))
sorttime=$(echo $((0-$(date +%s))))
bm=$(echo "<span class='tag'><a onfocus='this.blur()' target='_blank' href='file:///root/.bookmarks/bm/wp/$time/$time.html'><img src='../bm/img/favicon.ico'></a></span>")

if [[ -z $domain ]]; then domain=$(echo "filesystem"); fi

if [[ $dialog = *TRUE$c2* ]];then
dd if=/dev/null of=/root/.bookmarks/bm2/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm2/index.html ) - $( tail -n1 /root/.bookmarks/bm2/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm2/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm2/index.html;
fi

if [[ $dialog = *TRUE$c3* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm3/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm3/index.html ) - $( tail -n1 /root/.bookmarks/bm3/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm3/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm3/index.html;
fi

if [[ $dialog = *TRUE$c4* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm4/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm4/index.html ) - $( tail -n1 /root/.bookmarks/bm4/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm4/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm4/index.html;
fi

if [[ $dialog = *TRUE$c5* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm5/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm5/index.html ) - $( tail -n1 /root/.bookmarks/bm5/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm5/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm5/index.html;
fi

if [[ $dialog = *TRUE$c6* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm6/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm6/index.html ) - $( tail -n1 /root/.bookmarks/bm6/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm6/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm6/index.html;
fi

if [[ $dialog = *TRUE$c7* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm7/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm7/index.html ) - $( tail -n1 /root/.bookmarks/bm7/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm7/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm7/index.html;
fi

if [[ $dialog = *TRUE$c8* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm8/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm8/index.html ) - $( tail -n1 /root/.bookmarks/bm8/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm8/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm8/index.html;
fi

if [[ $dialog = *TRUE$c9* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm9/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm9/index.html ) - $( tail -n1 /root/.bookmarks/bm9/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm9/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm9/index.html;
fi

if [[ $dialog = *TRUE$c10* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm10/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm10/index.html ) - $( tail -n1 /root/.bookmarks/bm10/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm10/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm10/index.html;
fi

if [[ $dialog = *TRUE$c11* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm11/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm11/index.html ) - $( tail -n1 /root/.bookmarks/bm11/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm11/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm11/index.html;
fi

if [[ $dialog = *TRUE$c12* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm12/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm12/index.html ) - $( tail -n1 /root/.bookmarks/bm12/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm12/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm12/index.html;
fi

if [[ $dialog = *TRUE$c13* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm13/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm13/index.html ) - $( tail -n1 /root/.bookmarks/bm13/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm13/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm13/index.html;
fi

if [[ $dialog = *TRUE$c14* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm14/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm14/index.html ) - $( tail -n1 /root/.bookmarks/bm14/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm14/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm14/index.html;
fi

if [[ $dialog = *TRUE$c15* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm15/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm15/index.html ) - $( tail -n1 /root/.bookmarks/bm15/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm15/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm15/index.html;
fi

if [[ $dialog = *TRUE$c16* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm16/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm16/index.html ) - $( tail -n1 /root/.bookmarks/bm16/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm16/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm16/index.html;
fi

if [[ $dialog = *TRUE$c17* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm17/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm17/index.html ) - $( tail -n1 /root/.bookmarks/bm17/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm17/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm17/index.html;
fi

if [[ $dialog = *TRUE$c18* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm18/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm18/index.html ) - $( tail -n1 /root/.bookmarks/bm18/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm18/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm18/index.html;
fi

if [[ $dialog = *TRUE$c19* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm19/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm19/index.html ) - $( tail -n1 /root/.bookmarks/bm19/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm19/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm19/index.html;
fi

if [[ $dialog = *TRUE$c20* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm20/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm20/index.html ) - $( tail -n1 /root/.bookmarks/bm20/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm20/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm20/index.html;
fi

if [[ $dialog = *TRUE$c21* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm21/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm21/index.html ) - $( tail -n1 /root/.bookmarks/bm21/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm21/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm21/index.html;
fi

if [[ $dialog = *TRUE$c22* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm22/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm22/index.html ) - $( tail -n1 /root/.bookmarks/bm22/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm22/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm22/index.html;
fi

if [[ $dialog = *TRUE$c23* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm23/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm23/index.html ) - $( tail -n1 /root/.bookmarks/bm23/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm23/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm23/index.html;
fi

if [[ $dialog = *TRUE$c24* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm24/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm24/index.html ) - $( tail -n1 /root/.bookmarks/bm24/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm24/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm24/index.html;
fi

if [[ $dialog = *TRUE$c25* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm25/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm25/index.html ) - $( tail -n1 /root/.bookmarks/bm25/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm25/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm25/index.html;
fi

if [[ $dialog = *TRUE$c26* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm26/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm26/index.html ) - $( tail -n1 /root/.bookmarks/bm26/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm26/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm26/index.html;
fi

if [[ $dialog = *TRUE$c27* ]];then 
dd if=/dev/null of=/root/.bookmarks/bm27/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm27/index.html ) - $( tail -n1 /root/.bookmarks/bm27/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm27/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm27/index.html;
fi

dd if=/dev/null of=/root/.bookmarks/bm0/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm0/index.html ) - $( tail -n1 /root/.bookmarks/bm0/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><a onfocus="this.blur()" target="_blank" href="'"$address"'">'"$domain"'</a></td><td><a onfocus="this.blur()" target="_blank" href="'/root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf'">'"$title1"'</a></td><td>'"$bm"''"$bm1"''"$bm2"''"$bm3"''"$bm4"''"$bm5"''"$bm6"''"$bm7"''"$bm8"''"$bm9"''"$bm10"''"$bm11"''"$bm12"''"$bm13"''"$bm14"''"$bm15"''"$bm16"''"$bm17"''"$bm18"''"$bm19"''"$bm20"''"$bm21"''"$bm22"''"$bm23"''"$bm24"''"$bm25"''"$bm26"''"$bm27"'</td></tr>' >>  /root/.bookmarks/bm0/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bm0/index.html

cp /root/.bookmarks/bm/temp.pdf /root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf
evince -f /root/.bookmarks/bm/pdf/"$time"_"$title2"_"$domain".pdf
printf "%s\n" "$sorttime"_"$time"_"$title"_"$domain"_"$address" >> /root/.bookmarks/bm/txt/log.txt

sleep 1
echo $time | xclip -selection clipboard 
sleep 1
xdotool search --classname Navigator windowactivate
sleep 1
xdotool key "ctrl+s";
sleep 1
xdotool key "ctrl+v";
sleep 1
xdotool key "alt+Home";
sleep 1
xdotool key "alt+l";
sleep 1
xdotool key "ctrl+v";
sleep 1
xdotool key "BackSpace";
xdotool key "Return";
xdotool key "Return"; 
sleep 1
# clears any failed to fetch download error dialogs, usually less than 4.
xdotool search --classname Dialog windowactivate;
xdotool key "Return";
sleep 1
xdotool search --classname Dialog windowactivate;
xdotool key "Return";
sleep 1
xdotool search --classname Dialog windowactivate;
xdotool key "Return";
sleep 1
xdotool search --classname Dialog windowactivate;
xdotool key "Return";
sleep 1
rsync -av --exclude='*.js' /root/$time /root/.bookmarks/bm/wp
rm -rf /root/$time
echo $title | yad --no-buttons --on-top --geometry='900x100' --title $time --text-info
fi
3. The process has started, you are presented with a check box dialog where you can choose which predefined tags to use for the web page.
Attachments
shot13.jpg
(45.46 KiB) Downloaded 540 times

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#5 Post by kjdixo »

The native Pale Moon print dialog appears and will save the web page initially to temp.pdf but first you are given a chance to edit or add a title.
The pdf is later copied to to a timestamped .pdf in /root/.bookmarks/bm/pdf/
Sometimes the text box will be blank so copy and paste a title from the web page or write one in.
Now once the pdf is displayed in evince and after you close it . . . please now wait up to ten seconds for xdotool to autosave the web page.
The sequence is
a) Web page saved to timestamped folder in /root/ . . . I did this because xdotool reliably keys into Palemoon's save dialog the 'home' key of your keyboard.
b) Time is allowed for various components of the web page to download and provision is made for closing any Palemoon 'Download Errors'.
c) Wait for the time-stamped script YAD dialog to appear which indicates successful completion of the bookmarking process.
d) During step (c) the timestamped web page in the folder in /root/ is copied minus its javascripts to its final resting place in /root/.bookmarks/bm/wp/
e) Then the timestamped folder in the root directory is erased to prevent the root folder filling up with web pages.
That was part 1 (bookmarking and saving) . . . more instructions and explanations to follow.

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#6 Post by kjdixo »

The image below is the YAD dialog from 'step (c)' you must wait for.
It indicates successful completion of the script.
Attachments
shot14.jpg
(20.51 KiB) Downloaded 523 times

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#7 Post by kjdixo »

Notes
1. During development, in order to target specific windows and dialogs, in some cases I needed to ascertain the windownames / classnames.
I used a very useful terminal command line tool called 'xprop' for this.
Type xprop then enter into a terminal and your cursor will change to a cross hair which you can hover over any window and click it to see what is what.
2. In my bookmarking system all folders and index.html files are ready hard-wired at the start.
There are only 2 folders that get web content added, they are:
/root/.bookmarks/bm/wp/ for 'web page complete'
and
/root/.bookmarks/bm/pdf/ for 'pdfs'
3. There are a fixed number (26) of tag folders each containing only one index.html (and maybe an index.html.bak) and a favicon.ico.
I chose 26 buttons as they fit neatly across my 22 inch monitor screen and also could be used to alphabetically index things.
So for instance folder bm2 could contain a favicon 'A' and folder bm27 could contain a favicon 'Z'.
Why you would want 26 letters as tag buttons I don't know but the possibility is there if required.

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#8 Post by kjdixo »

Not many comments in my code so here is an explanation of one part of it from the long code snippet above.

Code: Select all

dd if=/dev/null of=/root/.bookmarks/bm0/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bm0/index.html ) - $( tail -n1 /root/.bookmarks/bm0/index.html | wc -c) | bc ) 
The line above removes the last line of the index.html file, so a new bookmark can be inserted.
Once the new bookmark is inserted, the last line can be re-added.
This is also why I have a lot of html closing tags on one line at the end.
The line below re-adds the closing tags after the newly inserted bookmark.

Code: Select all

echo '</table></div></div></body></html>' >> /root/.bookmarks/bm0/index.html 

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#9 Post by kjdixo »

Video bookmarking

1. Pale Moon does not need to be running for this, but it probably will be as you most likely will be on a YouTube web page.
Click the launcher to trigger the script /root/.bookmarks/bv/sh/launcher.sh

Code: Select all

#! /bin/bash
yad --on-top --undecorated --mouse \
--button="category:2" \
--button="buttons:3" \
--button="bookmark:4" \
--button="delete:5" \
--button="retag:6"

ret=$?
if [[ $ret -eq 2 ]]; then
sh -c '/root/.bookmarks/bm/sh/bmcat.sh'
exit 0
fi
if [[ $ret -eq 3 ]]; then
sh -c '/root/.bookmarks/bv/sh/launcher2.sh'
exit 0
fi
if [[ $ret -eq 4 ]]; then
sh -c '/root/.bookmarks/bv/sh/bv.sh'
exit 0
fi
if [[ $ret -eq 5 ]]; then
sh -c '/root/.bookmarks/bv/sh/bvdel.sh'
exit 0
fi
if [[ $ret -eq 6 ]]; then
sh -c '/root/.bookmarks/bv/sh/bvretag.sh'
exit 0
fi
2. Click the bookmark button to trigger the script /root/.bookmarks/bv/sh/bv.sh

Code: Select all

#!/bin/bash
timestamp() {
date +"%Y-%m-%d_%H:%M:%S"
}
dialog=$(yad --on-top --mouse --title "You Tube Download" --form --field="Paste address")
address=$(echo $dialog)
time=$(echo $(timestamp))
sorttime=$(echo $((0-$(date +%s))))
youtube-dl "$address" -o "/root/.bookmarks/bv/vid/"$time"_%(id)s.%(ext)s" | yad --width=900 --on-top --mouse --title "Downloading . . . then please wait for save menu" --progress --pulsate  --auto-close
video_title=$(youtube-dl --get-title $address)
video_id=$(youtube-dl --get-id $address)

convert.im6 https://i.ytimg.com/vi/"$video_id"/default.jpg -crop 120x66+0+12 -filter triangle -resize 60x35\! -quality 79% /root/.bookmarks/bv/vtn/"$time"_"$video_id".jpg

video_duration=$(youtube-dl --get-duration $address)
video_seconds=$(echo $video_duration | awk -F':' '{if(NF==2){print $1*60+$2}else if(NF==3){print $1*60*60+$2*60+$3}else{print $1}}')

. /root/.bookmarks/bv/txt/tags.txt
dialog=$(yad --on-top --mouse --title="Tag(s)" --width=600 --height=600 --list --checklist --column "Add" --column "Section" FALSE $c2 FALSE $c3 FALSE $c4 FALSE $c5 FALSE $c6 FALSE $c7 FALSE $c8 FALSE $c9 FALSE $c10 FALSE $c11 FALSE $c12 FALSE $c13 FALSE $c14 FALSE $c15 FALSE $c16 FALSE $c17 FALSE $c18 FALSE $c19 FALSE $c20 FALSE $c21 FALSE $c22 FALSE $c23 FALSE $c24 FALSE $c25 FALSE $c26 FALSE $c27)
dialog=$(echo $dialog | sed 's/|//g' | sed 's/ //g' | sed 's/-//g')
if [[ $dialog = *TRUE$c2* ]];then bv2=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv2/index.html'><img src='../bv2/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c3* ]];then bv3=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv3/index.html'><img src='../bv3/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c4* ]];then bv4=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv4/index.html'><img src='../bv4/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c5* ]];then bv5=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv5/index.html'><img src='../bv5/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c6* ]];then bv6=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv6/index.html'><img src='../bv6/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c7* ]];then bv7=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv7/index.html'><img src='../bv7/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c8* ]];then bv8=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv8/index.html'><img src='../bv8/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c9* ]];then bv9=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv9/index.html'><img src='../bv9/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c10* ]];then bv10=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv10/index.html'><img src='../bv10/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c11* ]];then bv11=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv11/index.html'><img src='../bv11/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c12* ]];then bv12=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv12/index.html'><img src='../bv12/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c13* ]];then bv13=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv13/index.html'><img src='../bv13/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c14* ]];then bv14=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv14/index.html'><img src='../bv14/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c15* ]];then bv15=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv15/index.html'><img src='../bv15/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c16* ]];then bv16=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv16/index.html'><img src='../bv16/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c17* ]];then bv17=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv17/index.html'><img src='../bv17/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c18* ]];then bv18=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv18/index.html'><img src='../bv18/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c19* ]];then bv19=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv19/index.html'><img src='../bv19/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c20* ]];then bv20=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv20/index.html'><img src='../bv20/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c21* ]];then bv21=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv21/index.html'><img src='../bv21/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c22* ]];then bv22=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv22/index.html'><img src='../bv22/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c23* ]];then bv23=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv23/index.html'><img src='../bv23/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c24* ]];then bv24=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv24/index.html'><img src='../bv24/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c25* ]];then bv25=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv25/index.html'><img src='../bv25/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c26* ]];then bv26=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv26/index.html'><img src='../bv26/favicon.ico'></a></span>");fi
if [[ $dialog = *TRUE$c27* ]];then bv27=$(echo "<span class='tag'><a onfocus='this.blur()' href='file:///root/.bookmarks/bv27/index.html'><img src='../bv27/favicon.ico'></a></span>");fi
sleep 1

if [[ $dialog = *TRUE$c2* ]];then
dd if=/dev/null of=/root/.bookmarks/bv2/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv2/index.html ) - $( tail -n1 /root/.bookmarks/bv2/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv2/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv2/index.html;
fi

if [[ $dialog = *TRUE$c3* ]];then
dd if=/dev/null of=/root/.bookmarks/bv3/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv3/index.html ) - $( tail -n1 /root/.bookmarks/bv3/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv3/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv3/index.html;
fi

if [[ $dialog = *TRUE$c4* ]];then
dd if=/dev/null of=/root/.bookmarks/bv4/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv4/index.html ) - $( tail -n1 /root/.bookmarks/bv4/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv4/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv4/index.html;
fi

if [[ $dialog = *TRUE$c5* ]];then
dd if=/dev/null of=/root/.bookmarks/bv5/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv5/index.html ) - $( tail -n1 /root/.bookmarks/bv5/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv5/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv5/index.html;
fi

if [[ $dialog = *TRUE$c6* ]];then
dd if=/dev/null of=/root/.bookmarks/bv6/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv6/index.html ) - $( tail -n1 /root/.bookmarks/bv6/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv6/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv6/index.html;
fi

if [[ $dialog = *TRUE$c7* ]];then
dd if=/dev/null of=/root/.bookmarks/bv7/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv7/index.html ) - $( tail -n1 /root/.bookmarks/bv7/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv7/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv7/index.html;
fi

if [[ $dialog = *TRUE$c8* ]];then
dd if=/dev/null of=/root/.bookmarks/bv8/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv8/index.html ) - $( tail -n1 /root/.bookmarks/bv8/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv8/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv8/index.html;
fi

if [[ $dialog = *TRUE$c9* ]];then
dd if=/dev/null of=/root/.bookmarks/bv9/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv9/index.html ) - $( tail -n1 /root/.bookmarks/bv9/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv9/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv9/index.html;
fi

if [[ $dialog = *TRUE$c10* ]];then
dd if=/dev/null of=/root/.bookmarks/bv10/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv10/index.html ) - $( tail -n1 /root/.bookmarks/bv10/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv10/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv10/index.html;
fi

if [[ $dialog = *TRUE$c11* ]];then
dd if=/dev/null of=/root/.bookmarks/bv11/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv11/index.html ) - $( tail -n1 /root/.bookmarks/bv11/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv11/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv11/index.html;
fi

if [[ $dialog = *TRUE$c12* ]];then
dd if=/dev/null of=/root/.bookmarks/bv12/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv12/index.html ) - $( tail -n1 /root/.bookmarks/bv12/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv12/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv12/index.html;
fi

if [[ $dialog = *TRUE$c13* ]];then
dd if=/dev/null of=/root/.bookmarks/bv13/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv13/index.html ) - $( tail -n1 /root/.bookmarks/bv13/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv13/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv13/index.html;
fi

if [[ $dialog = *TRUE$c14* ]];then
dd if=/dev/null of=/root/.bookmarks/bv14/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv14/index.html ) - $( tail -n1 /root/.bookmarks/bv14/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv14/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv14/index.html;
fi

if [[ $dialog = *TRUE$c15* ]];then
dd if=/dev/null of=/root/.bookmarks/bv15/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv15/index.html ) - $( tail -n1 /root/.bookmarks/bv15/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv15/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv15/index.html;
fi

if [[ $dialog = *TRUE$c16* ]];then
dd if=/dev/null of=/root/.bookmarks/bv16/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv16/index.html ) - $( tail -n1 /root/.bookmarks/bv16/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv16/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv16/index.html;
fi

if [[ $dialog = *TRUE$c17* ]];then
dd if=/dev/null of=/root/.bookmarks/bv17/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv17/index.html ) - $( tail -n1 /root/.bookmarks/bv17/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv17/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv17/index.html;
fi

if [[ $dialog = *TRUE$c18* ]];then
dd if=/dev/null of=/root/.bookmarks/bv18/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv18/index.html ) - $( tail -n1 /root/.bookmarks/bv18/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv18/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv18/index.html;
fi

if [[ $dialog = *TRUE$c19* ]];then
dd if=/dev/null of=/root/.bookmarks/bv19/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv19/index.html ) - $( tail -n1 /root/.bookmarks/bv19/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv19/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv19/index.html;
fi

if [[ $dialog = *TRUE$c20* ]];then
dd if=/dev/null of=/root/.bookmarks/bv20/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv20/index.html ) - $( tail -n1 /root/.bookmarks/bv20/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv20/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv20/index.html;
fi

if [[ $dialog = *TRUE$c21* ]];then
dd if=/dev/null of=/root/.bookmarks/bv21/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv21/index.html ) - $( tail -n1 /root/.bookmarks/bv21/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv21/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv21/index.html;
fi

if [[ $dialog = *TRUE$c22* ]];then
dd if=/dev/null of=/root/.bookmarks/bv22/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv22/index.html ) - $( tail -n1 /root/.bookmarks/bv22/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv22/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv22/index.html;
fi

if [[ $dialog = *TRUE$c23* ]];then
dd if=/dev/null of=/root/.bookmarks/bv23/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv23/index.html ) - $( tail -n1 /root/.bookmarks/bv23/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv23/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv23/index.html;
fi

if [[ $dialog = *TRUE$c24* ]];then
dd if=/dev/null of=/root/.bookmarks/bv24/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv24/index.html ) - $( tail -n1 /root/.bookmarks/bv24/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv24/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv24/index.html;
fi

if [[ $dialog = *TRUE$c25* ]];then
dd if=/dev/null of=/root/.bookmarks/bv25/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv25/index.html ) - $( tail -n1 /root/.bookmarks/bv25/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv25/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv25/index.html;
fi

if [[ $dialog = *TRUE$c26* ]];then
dd if=/dev/null of=/root/.bookmarks/bv26/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv26/index.html ) - $( tail -n1 /root/.bookmarks/bv26/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv26/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv26/index.html;
fi

if [[ $dialog = *TRUE$c27* ]];then
dd if=/dev/null of=/root/.bookmarks/bv27/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv27/index.html ) - $( tail -n1 /root/.bookmarks/bv27/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="'/root/.bookmarks/bv/vid/"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv27/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv27/index.html;
fi

dd if=/dev/null of=/root/.bookmarks/bv0/index.html bs=1 seek=$(echo $(stat --format=%s /root/.bookmarks/bv0/index.html ) - $( tail -n1 /root/.bookmarks/bv0/index.html | wc -c) | bc )
echo '<tr><td><p>'"$sorttime"'</p></td><td><p>'"$video_seconds"'</p></td><td><a onfocus="this.blur()" href="/root/.bookmarks/bv/vid/'"$time"'_'"$video_id".mp4'"><img class="tn" src="/root/.bookmarks/bv/vtn/'"$time"'_'"$video_id"'.jpg">'"$video_title"'_'"$video_duration"'</a></td><td>'"$bv"''"$bv1"''"$bv2"''"$bv3"''"$bv4"''"$bv5"''"$bv6"''"$bv7"''"$bv8"''"$bv9"''"$bv10"''"$bv11"''"$bv12"''"$bv13"''"$bv14"''"$bv15"''"$bv16"''"$bv17"''"$bv18"''"$bv19"''"$bv20"''"$bv21"''"$bv22"''"$bv23"''"$bv24"''"$bv25"''"$bv26"''"$bv27"'</td></tr>' >>  /root/.bookmarks/bv0/index.html
echo '</table></div></div></body></html>' >> /root/.bookmarks/bv0/index.html

printf "%s\n" "$sorttime"_"$video_seconds"_"$video_duration"_"$time"_"$video_id"_"$video_title" >> /root/.bookmarks/bv/txt/log.txt

3. You are then presented with a YAD text box entry dialog "You Tube Download".
4. Copy and paste a YouTube web page address into the text box, ideally a short 2 minute video just to test the correct functioning.
Attachments
shot15.png
(25.73 KiB) Downloaded 493 times

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#10 Post by kjdixo »

5. A progress dialog appears [Downloading . . . then please wait for save dialog].
6. When the download is complete a tagging dialog appears which displays your previously defined video categories with check boxes. Tag the video.
7. It is a good idea to keep an eye on your task bar net activity indicator to see the youtube-dl program fetching extra data like thumbnail, title and duration etc.

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#11 Post by kjdixo »

This crops and resizes the YouTube video thumbnail using imagemagick.
The thumbnail I want is tiny, so I cannot tolerate the black borders top and bottom on the YouTube thumbnail . . . so I remove them.

Code: Select all

convert.im6 https://i.ytimg.com/vi/"$video_id"/default.jpg -crop 120x66+0+12 -filter triangle -resize 60x35\! -quality 79% /root/.bookmarks/bv/vtn/"$time"_"$video_id".jpg

This extracts hours, minutes and seconds from the YouTube duration time formatted with colons hh:mm:ss and gets the duration in seconds.
I need the duration in seconds so I can use sortable to sort the videos by duration, which is useful if I don't have time to watch a long video, or if I do want to watch a long video.

Code: Select all

video_seconds=$(echo $video_duration | awk -F':' '{if(NF==2){print $1*60+$2}else if(NF==3){print $1*60*60+$2*60+$3}else{print $1}}') 


kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#12 Post by kjdixo »

Changing the favicon (32x32) in the folder holding the index.html page for a particular tag button, will instantly and globally change all corresponding tag icons in all the bookmarks on all the index.html pages (in folders bm2 thru bm27) because they all refer to that one single favicon you are changing.
I have not yet designed a YAD dialog to do this but it is a task so simple and infrequent that it is probably best to do it manually in your favorite image manipulation program, ie mtpaint or mirage or whatever.
For the time being icon hunting and converting to 32x32 favicons can be done manually.
It might be possible to implement an imagemagick solution for this.
Attachments
bm5.png
(21.04 KiB) Downloaded 476 times
bm4.png
(21.63 KiB) Downloaded 485 times

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#13 Post by kjdixo »

My script uses the built-in Pale Moon 'print to pdf' dialog.
I use xdotool to automate the saving to pdf.

Code: Select all

rm -rf /root/.bookmarks/bm/temp.pdf
sleep 1
xdotool key "ctrl+l"
xdotool key "ctrl+c"
xdotool key "ctrl+p"
xdotool key "Down"
xdotool key "alt+p"
xdotool key "alt+r"
timestamp() {
date +"%Y-%m-%d_%H:%M:%S"
}

while [[ ! -f /root/.bookmarks/bm/temp.pdf ]]; do
sleep 0.1
done 

For this to work properly it needs to be set up once.
I un-installed CUPS so there are no printers and the xdotool auto script will not get confused with the options (it has only one choice - print to file).
Please see the screenshot below which is from the Pale Moon [File > Print] dialog you will need to set yours to the same:
1. 'Print to File'.
2. Name temp.pdf
3. Save in folder bm
4. Output format PDF
5. Copies 1
Attachments
shot16.jpg
(34.14 KiB) Downloaded 462 times

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#14 Post by kjdixo »

The screenshot below illustrates the general file and folder layout and shows some of the important files.
It helps when looking at code to know exactly where everything is.
I have tried to keep files with similar file extensions grouped together in folders.

wp = web pages (web page complete).
txt = text files (log files)
sh = bash scripts
pdf = pdf files
img = images (wallpaper .jpg files and other images)
css = cascading style sheets

All this helps to keep it ordered, neat and uncluttered.
At one time all the files were mixed together in one folder, I prefer it like this.
Attachments
shot17.jpg
(33.68 KiB) Downloaded 439 times

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#15 Post by kjdixo »

The Big Picture
See image below = bookmark and video bookmark folders.
bm0 and bv0 are special, they contain the main index pages where every bookmark or video bookmark is listed.
bm1 and bv1 folders do not exist.
[bm2 to bm27] are the 26 bookmark button folders, they each contain a favicon and an index.html
[bv2 to bv27] are the 26 video bookmark button folders, they each contain a favicon and an index.html
All 52 buttons can be made either hidden or visible.
The 52 folders only function as tagging, button and link listing repositories.

The folders bm and bv are where the script and main storage resides.
All web pages are stored in /root/.bookmarks/bm/wp/ as timestamped 'web page completes'.
All pdfs are stored in /root/.bookmarks/bm/pdf/ as timestamped .pdf files.

All videos are stored in /root/.bookmarks/bv/vid/ as timestamped .mp4 files.
All video thumbnails are stored in /root/.bookmarks/bv/vtn/ as timestamped .jpg files.
Attachments
shot18.jpg
(53.19 KiB) Downloaded 417 times

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#16 Post by kjdixo »

The image below shows the Pale Moon Edit > Find (ctrl + F) trying to find articles about JavaScript.
Luckily it is in the JavaScript tags section, which I created earlier.
I made a 'JS' button using mtpaint.
1. In mtpaint > New 32 x 32
2. Edit > Paste Text (shift + T)
3. Set the font to size 18 and edit the preview text to read 'JS'.
4. Ensure the colors are set properly (I used white on a black background).
5. Click 'Paste Text'
6. Save as a .png
7. Open in mirage and save as favicon.ico in the correct folder (bm13).

The good thing about calling the button image favicon.ico is that the browser reads the index.html and puts that icon (shortcut icon) in the url address bar and on the Pale Moon tab, next to the title 'JavaScript'.
It was easy (a bit fiddly, but easy) to retag articles into the new 'JavaScript' section using my bash script, shown in an earlier post.
I am probably going to add some more browser code (JS and CSS and HTML) to show or hide searched for strings.
So far I have code that counts the number of rows in an HTML table similar to:

Code: Select all

<table onclick="var leng=this.rows.length;alert(leng)">
I can then use javascript and css to write a style sheet that would only show lines (table rows) containing the searched for string.
I am also experimenting with js code that turns my blue button different colors in sequence depending on how long the button is pressed, so different modes can be entered.
Attachments
shot19.jpg
(104.46 KiB) Downloaded 797 times

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#17 Post by kjdixo »

I added a search function to every list button.
It is now possible to search the link title text for key words or phrases.
Simply press the blue button as you would for retagging to reveal the timestamps.
Click any timestamp and then cancel the retag / delete bash dialog.
Then a search box appears.
Search the bookmarks (or video bookmarks).
The code for this modification is in SORTable.js.
Please find the new SORTable.js attached.
Its path should be /root/.bookmarks/bm/SORTable.js.
Below is a screenshot of a typical search (for yad).
The Pale Moon Edit > Find (ctrl + F) is being used in parallel to highlight the found items.
Enjoy!
Attachments
shot20.jpg
(103.19 KiB) Downloaded 727 times
SORTable.js.tar.gz
(5.8 KiB) Downloaded 179 times

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#18 Post by kjdixo »

Fixing Stack Overflow error dialogs that suddenly increased in number.
There is a small section of code in bm.sh which closes any Pale Moon download error dialogs.
Most websites have less than 4 (usually none) of these popup error dialogs, when saving as web page complete.
Stack Overflow errors are often greater than 20 sometimes > 40.
I did a quick fix where I simply close up to 100 error dialogs.
It works with all the pages I tried to save.
Luckily when this is in action . . . the dialogs popup and close very quickly, which is highly visible and indicates what is happening.
It won't always be 100, sometimes it will be 10 or none . . . depends on the website.
Please see the new bm.sh below.
I edited this comment on 2016.05.13 at 08:00 UTC+1 and increased the loop from 40 to 100.
================================================================
I edited this comment on 2016.05.15 at 21:15 UTC+1.
I was not happy with the 10 second delay I introduced just to cater for up to 100 error dialogs of stackoverflow.com.
So now I do a test for stackoverflow.com.

Code: Select all

# if stackoverflow.com then up to 100 error dialogs can be closed (times 0.1 seconds = 10 second wait)
# otherwise up to 10 error dialogs can be closed (times 0.1 seconds = 1 second wait)

if [[ $domain = "stackoverflow.com" ]]; then
for i in {1..100}
do
xdotool search --classname Dialog windowactivate;
xdotool key "Return";
sleep 0.1
done;else
for i in {1..10}
do
xdotool search --classname Dialog windowactivate;
xdotool key "Return";
sleep 0.1
done
fi 

That way I can reliably get stack overflow 'web page completes' after a 10 second wait.
All other 'web page completes' get saved in 1 second . . . much better.
Sorry for that glitch.
Here is the new bm.sh 2016.05.15 at 21:15 UTC+1.
Attachments
bm.sh.tar.gz
(2.55 KiB) Downloaded 153 times
Last edited by kjdixo on Sun 15 May 2016, 20:41, edited 7 times in total.

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#19 Post by kjdixo »

Refinements and improvements that work will be added here . . . after I have tested them and decided they are necessary.
One such improvement is highlighting the timestamps (in white) as they are added to avoid confusion whilst retagging or deleting several bookmarks.
The code change is in /root/.bookmarks/bm/SORTable.js.
Please find the new SORTable.js below.
I have included a few screenshots to show what I mean.

The first screenshot shows the result of a search for 'yad' onto which is being actioned a retag for every bookmark.
I am retagging all the yad bookmarks to a new tag button called Yad.
See the green flask icon on the top right button, bm15 position.

The second screenshot shows the bookmarks sitting in their new home under the new Yad tag button.

As stated earlier this is an improvement that makes retagging easier by highlighting the already tagged timestamps white, so you can see what you have done and what is still left to do.

EDIT June 6 2016:
A modification implemented in a later post for automatic refreshing and reloading of the browser using xdotool - code appended to bmretag, bvretag, bmdel, bvdel scripts means that the above improvement is not needed anymore as the list updates instantly so you see the retagging and deleting changes instantly and you cannot lose track like before.
The reload modification also masks the timestamp white highlighting.
However I will leave the white highlighting code in SORTable.js as it might be useful at some point in the future.
Attachments
SORTable.js.tar.gz
(5.81 KiB) Downloaded 174 times
shot21.jpg
(69.08 KiB) Downloaded 704 times
shot22.jpg
(92.05 KiB) Downloaded 660 times
Last edited by kjdixo on Mon 06 Jun 2016, 00:47, edited 1 time in total.

kjdixo
Posts: 153
Joined: Sun 13 Sep 2009, 21:13

#20 Post by kjdixo »

Changing wallpaper (page 1, screenshot7) used to entail reloading the browser twice.

That is now not necessary with the following code additions.
xdotool handles the two browser reloads automatically loading the new wallpaper.

/root/.bookmarks/bm/sh/wallpaper.sh
/root/.bookmarks/bv/sh/wallpaper.sh

For the bookmarks wallpaper . . .

Code: Select all

#!/bin/sh

yad --form --title="Choose a Wallpaper"  --mouse --columns="4" --text="These are in /root/.bookmarks/bm/img/bg/" \
--field="!../root/.bookmarks/bm/img/bg/1.jpg! 1 :fbtn" "cp /root/.bookmarks/bm/img/bg/1.jpg /root/.bookmarks/bm/img/bg.jpg" \
--field="!../root/.bookmarks/bm/img/bg/2.jpg! 2 :fbtn" "cp /root/.bookmarks/bm/img/bg/2.jpg /root/.bookmarks/bm/img/bg.jpg" \
--field="!../root/.bookmarks/bm/img/bg/3.jpg! 3 :fbtn" "cp /root/.bookmarks/bm/img/bg/3.jpg /root/.bookmarks/bm/img/bg.jpg" \
--field="!../root/.bookmarks/bm/img/bg/4.jpg! 4 :fbtn" "cp /root/.bookmarks/bm/img/bg/4.jpg /root/.bookmarks/bm/img/bg.jpg"      
xdotool search --classname Navigator windowactivate
sleep 1
xdotool key "ctrl+r";
sleep 1
xdotool key "ctrl+r";

and for the video bookmarks wallpaper . . .

Code: Select all

#!/bin/sh

yad --form --title="Choose a Wallpaper"  --mouse --columns="4" --text="These are in /root/.bookmarks/bv/img/bg/" \
--field="!../root/.bookmarks/bv/img/bg/1.jpg! 1 :fbtn" "cp /root/.bookmarks/bv/img/bg/1.jpg /root/.bookmarks/bv/img/bg.jpg" \
--field="!../root/.bookmarks/bv/img/bg/2.jpg! 2 :fbtn" "cp /root/.bookmarks/bv/img/bg/2.jpg /root/.bookmarks/bv/img/bg.jpg" \
--field="!../root/.bookmarks/bv/img/bg/3.jpg! 3 :fbtn" "cp /root/.bookmarks/bv/img/bg/3.jpg /root/.bookmarks/bv/img/bg.jpg" \
--field="!../root/.bookmarks/bv/img/bg/4.jpg! 4 :fbtn" "cp /root/.bookmarks/bv/img/bg/4.jpg /root/.bookmarks/bv/img/bg.jpg"       
xdotool search --classname Navigator windowactivate
sleep 1
xdotool key "ctrl+r";
sleep 1
xdotool key "ctrl+r";

It matters not whether the browser is open for this, but if it is you will see the wallpaper change automatically.
As can be seen from the code there are two sleeps of 1 second each.
So please wait 2 seconds for the wallpaper to change.
A screenshot of the YAD dialogs.
Attachments
shot23.jpg
(60.42 KiB) Downloaded 646 times
bookmarks-wallpaper.sh.tar.gz
(350 Bytes) Downloaded 160 times
video-bookmarks-wallpaper.sh.tar.gz
(351 Bytes) Downloaded 175 times

Post Reply