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

#21 Post by kjdixo »

I overlooked the cancel button in my original bv.sh code of the youtube download dialog.

Code: Select all

dialog=$(yad --on-top --mouse --title "You Tube Download" --form --field="Paste address")
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi

Just add the 2nd and 3rd lines of code above, for the Cancel button to work.

I will eventually update everything with all the small changes.
For now though you can edit your own code.

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

#22 Post by kjdixo »

I edited the post http://murga-linux.com/puppy/viewtopic. ... 7&start=17 and uploaded a new bm.sh . . . to cater for stackoverflow popup error dialogs that were sometimes > 40.
Sorry . . . this post (Friday 13th May) has been replaced by the following post (Sunday 15th May).
Last edited by kjdixo on Sun 15 May 2016, 20:35, edited 4 times in total.

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

#23 Post by kjdixo »

I was not happy with the 10 second delay I introduced just to cater for the large number of error dialogs from 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.
New bm.sh attached.
I will edit and update the relevant post above http://murga-linux.com/puppy/viewtopic. ... 7&start=17
=========================================================
I hope to find time soon to add more features and maybe make it simpler.
1. Ability to add non YouTube videos with simple edit and convert features using YAD interface.
2. Automatically rename to .html the file types .htm, .xhtml, .txt (and format .txt to display well in the browser).
3. Automatically reload and re-bookmark bookmarks from a standard bookmarks.html file.

Suggestions and comments at this stage would be useful.
Attachments
bm.sh.tar.gz
(2.55 KiB) Downloaded 150 times

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

#24 Post by kjdixo »

Today I tried my video bookmark script and it had stopped working.
Then I tried youtube-dl on its own from a terminal and that too was not working.
So after a little internet searching and thanks to the 'Ask Ubuntu Forum' I found the solution.

http://askubuntu.com/questions/429746/y ... ed-working
Youtube updates his anti-download security system quite offen. You should keep your youtube-dl up-to-date. . . .

You can subscribe to the WebUpd8 PPA to get new releases when they're out (that is once or twice a week) :
https://launchpad.net/~nilarimogard/+ar ... es_filter=

I downloaded.
https://launchpad.net/~nilarimogard/+ar ... y1_all.deb
I then installed the .deb by opening it with petget.

Everything now works with youtube-dl and my video bookmarking script.

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#25 Post by slavvo67 »

This looks interesting.... - Thanks.

Slavvo67

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

#26 Post by kjdixo »

Thanks Slavvo67
Now I want to bookmark all my camera photos and other images.
The photo galleries must be integrated with the other bookmarked web pages.
Here is a simple script to make a web page image gallery from a folder of images..
It uses imagemagick to create thumbnails and then makes an index.html.
During thumbnailing each thumbnail is displayed and its title can be edited.
Default titles are the photo filenames (which are not very descriptive so it is best to edit them).
The gallery name can also be edited - the default gallery name is that of the folder - for example 101NIKON.

Code: Select all

#! /bin/sh
# put this script in the folder with the images.
title=$(pwd | awk -F / '{print $NF}') 
title=$(echo $title | yad --mouse --width=1000 --title="Edit Title or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $title = "" ]]; then title=$(echo "no title"); fi
echo "<!DOCTYPE html>" > index.html
echo "<head>" >> index.html
echo "<title>$title</title>" >> index.html
echo "<link rel=\"shortcut icon\" href=\"/root/.bookmarks/bm/img/favicon.ico\">" >> index.html
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"/root/.bookmarks/bm/css/gallery.css\">" >> index.html
echo "</head>" >> index.html
echo "<body>" >> index.html
echo "<div class=\"header\">$title</div>" >> index.html
fext=$(echo ".JPG" | yad --mouse --width=1000 --title="VERY IMPORTANT file extension of the images" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $fext = "" ]]; then fext=$(echo ".JPG"); fi
for i in *$fext; do 
convert.im6 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
echo "</body>" >> index.html
echo "</html>" >> index.html
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div class=\"des\">$title&nbsp;-&nbsp;$desc</div>" >> index.html
echo "<img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\">" >> index.html;
done;
echo "</body>" >> index.html
echo "</html>" >> index.html

Script must be in same folder as images.
Be sure to edit file extension when asked, to match that of the images, it won't work otherwise.


When all is done you can bookmark the new index.html photo gallery using the previously described bookmarking script.

In addition to the script you will need /root/.bookmarks/bm/css/gallery.css attached below.
Edited June 2 2016 to display here gallery.css.

Code: Select all

body{background-color:#ba8;background-image:url('/root/.bookmarks/bm/img/bg.jpg')}
img{border:solid 4px white;margin-left:20px;margin-bottom:30px}
.des{font:bold 24px "Arial";margin-left:20px;margin-bottom:10px;color:yellow}
.header{font:bold 26px "Arial";margin-left:20px;margin-bottom:10px;color:white}
Attachments
shot100.png
(219.78 KiB) Downloaded 417 times
gallery.css.tar.gz
(282 Bytes) Downloaded 148 times
gallery.sh.tar.gz
(700 Bytes) Downloaded 133 times
Last edited by kjdixo on Thu 02 Jun 2016, 18:22, edited 1 time in total.

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

#27 Post by kjdixo »

Refreshing the browser once or twice to see the results of the various bash scripts is tedious and can be avoided by automating that function using the same code (xdotool) that I used to automatically reload the new 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 0.1
xdotool key "ctrl+r";
sleep 0.1
xdotool key "ctrl+r";
Notice that I have reduced the sleeps from 1 second to 0.1 second . . . and it still works.

So I appended this to each of the following bash scripts in all the bm/sh and bv/sh folders, in all 5 categories.

Code: Select all

xdotool search --classname Navigator windowactivate
sleep 0.1
xdotool key "ctrl+r";
sleep 0.1
xdotool key "ctrl+r";

wallpaper.sh
tooltips.sh
buttons.sh
bmretag.sh
bvretag.sh
bmdel.sh
bvdel.sh
bmcolor.sh
bvcolor.sh

bmcat.sh is the category changing script in the bm/sh folder, in all 5 categories.
It is treated differently.
Instead of appending the xdotool code above, a reload() function is declared at the beginning and is used for each of the 5 category buttons (saves repeating the code 5 times).

Code: Select all

#! /bin/bash
# define reload function
reload(){
sleep 0.1
xdotool search --classname Navigator windowactivate
sleep 0.1
xdotool key "ctrl+r";
sleep 0.1
xdotool key "ctrl+r";	
}

yad --on-top --undecorated --mouse \
--button="1:2" \
--button="2:3" \
--button="3:4" \
--button="4:5" \
--button="5:6" \
--button="Exit:7"

ret=$?
if [[ $ret -eq 2 ]]; then
mv /root/.bookmarks /root/.bookmarks-02
mv /root/.bookmarks-01 /root/.bookmarks
reload
exit 0
fi

if [[ $ret -eq 3 ]]; then
mv /root/.bookmarks /root/.bookmarks-02
mv /root/.bookmarks-02 /root/.bookmarks
reload
exit 0
fi

if [[ $ret -eq 4 ]]; then
mv /root/.bookmarks /root/.bookmarks-02
mv /root/.bookmarks-03 /root/.bookmarks
reload
exit 0
fi

if [[ $ret -eq 5 ]]; then
mv /root/.bookmarks /root/.bookmarks-02
mv /root/.bookmarks-04 /root/.bookmarks
reload
exit 0
fi

if [[ $ret -eq 6 ]]; then
mv /root/.bookmarks /root/.bookmarks-02
mv /root/.bookmarks-05 /root/.bookmarks
reload
exit 0
fi

if [[ $ret -eq 7 ]]; then
# exit and close
exit 0
fi
These measures make the bookmarking script quicker and more enjoyable to use.
Please ensure you do a complete backup (copy and paste to somewhere safe) of the /root/.bookmarks folder containing everything before starting to experiment and tinker with the bash scripts.

Soon I hope to simplify the YAD dialogs and integrate them better with the bash scripts.
I want to make it all a lot easier to set up, by creating a .pet so it can be 'installed' with one click.

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

#28 Post by kjdixo »

To make things easier here is the current Pale Moon Bookmarking Script as a .pet.
It includes all the tweaks documented in my posts - minus the ones I have mentioned but not yet implemented.

http://pt.kdworld7.net/pets/bookmarks-5.0.pet.tar.gz
EDIT - downloading a raw .pet via http from my web site was problematic so I archived the .pet in a tar.gz and it now downloads properly.
Save it and extract the .pet using an archive program then open the .pet with petget.

The dependencies have not yet been integrated within the .pet because when it came time to uninstall I got unwanted "cannot uninstall due to dependencies" pink yaf-splash messages.
So to keep it simple, and for clean uninstalling I listed no dependencies even though there are several.

You will have to install the dependencies xclip, xdotool, yad, youtube-dl, imagemagick, evince.
Also read the previous posts for setting up information.

Another issue was that the .pet is 500k and the Puppy forum only allows 256K so I had to host it on my own web site.

I have not yet implemented the changing of extensions .htm, .xhtml and .txt to .html automatically.
So for the following link which is .htm, the local copy in the wp (web pages) folder will have to be manually altered so its extension is .html (as referenced by the tagging pages).

http://barryk.org/puppylinux/development/createpet.htm
Last edited by kjdixo on Mon 06 Jun 2016, 00:49, edited 1 time in total.

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

#29 Post by kjdixo »

Please see the edit in the post above regarding the download error which is now fixed.
Also . . long story short . . . you will need 3 additional links to get started.

1. a bookmark on your Palemoon bookmarks toolbar

Code: Select all

file:///root/.bookmarks/bm0/index.html
2. A bash script "Bookmark" launcher for example on your openbox right-click menu

Code: Select all

<item label="BM" icon="/usr/share/pixmaps/filezilla.png"><action name="Execute"><command>/root/.bookmarks/bm/sh/launcher.sh</command></action></item>
3. A bash script "Bookmark Video" launcher for example on your openbox right-click menu

Code: Select all

<item label="BV" icon="/usr/share/pixmaps/filezilla.png"><action name="Execute"><command>sh -c '/root/.bookmarks/bv/sh/launcher.sh'</command></action></item>

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

#30 Post by kjdixo »

I find it quicker to photograph multi page written documents than to scan them.
I outlined above a basic method (gallery.sh) for bookmarking of all my camera photos.
I also want to adapt this to display photographed written pages.
Physical paper articles (respecting copyright of course) will be archived as local html documents.

The web pages will contain photos of written pages, stitched together vertically and fitted to the full browser width.
The local html pages will use # anchors in the html urls to jump to specific pages.
The local html pages will be bookmarked using my Pale Moon Bookmarking Script.
The local html pages will be easy and quick to access due to the previously described bookmarking script.

The gallery script will allow basic adjustment of rotation of each image for correct orientation - portrait, landscape etc.
Last edited by kjdixo on Wed 08 Jun 2016, 14:35, edited 6 times in total.

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

#31 Post by kjdixo »

Photo gallery script gallery2.sh has simple image rotation 0 90 180 270.
I might use parts of this code when I make the multi-page document gallery.

Code: Select all

#! /bin/sh
# put this script in the folder with the images.
title=$(pwd | awk -F / '{print $NF}') 
title=$(echo $title | yad --mouse --width=1000 --title="Edit Title or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $title = "" ]]; then title=$(echo "no title"); fi
echo "<!DOCTYPE html>" > index.html
echo "<head>" >> index.html
echo "<title>$title</title>" >> index.html
echo "<link rel=\"shortcut icon\" href=\"/root/.bookmarks/bm/img/favicon.ico\">" >> index.html
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"/root/.bookmarks/bm/css/gallery.css\">" >> index.html
echo "</head>" >> index.html
echo "<body>" >> index.html
echo "<div class=\"header\">$title</div>" >> index.html
fext=$(echo ".JPG" | yad --mouse --width=1000 --title="VERY IMPORTANT file extension of the images" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $fext = "" ]]; then fext=$(echo ".JPG"); fi
for i in *$fext; do 
convert.im6 -resize 600'x'600 "$i" "tn_"$i

yad --image="tn_$i" --mouse --title="ROTATE?" \
--button="270:2" \
--button="180:3" \
--button="90:4" \
--button="0:5" \
--button="EXIT:6"

ret=$?
if [[ $ret -eq 2 ]]; then
convert.im6 -rotate 270 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
echo "</body>" >> index.html
echo "</html>" >> index.html
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div class=\"des\">$title - $desc</div>" >> index.html
echo "<img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\">" >> index.html;
fi
if [[ $ret -eq 3 ]]; then
convert.im6 -rotate 180 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
echo "</body>" >> index.html
echo "</html>" >> index.html
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div class=\"des\">$title - $desc</div>" >> index.html
echo "<img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\">" >> index.html;
fi
if [[ $ret -eq 4 ]]; then
convert.im6 -rotate 90 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
echo "</body>" >> index.html
echo "</html>" >> index.html
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div class=\"des\">$title - $desc</div>" >> index.html
echo "<img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\">" >> index.html;
fi
if [[ $ret -eq 5 ]]; then
convert.im6 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
echo "</body>" >> index.html
echo "</html>" >> index.html
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div class=\"des\">$title - $desc</div>" >> index.html
echo "<img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\">" >> index.html;
fi
if [[ $ret -eq 6 ]]; then
echo "</body>" >> index.html
echo "</html>" >> index.html
exit 0
fi
done;
echo "</body>" >> index.html
echo "</html>" >> index.html

Attachments
gallery2.sh.tar.gz
(806 Bytes) Downloaded 162 times
rotate.jpg
(35.36 KiB) Downloaded 703 times

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

#32 Post by kjdixo »

A simple improvement to the above, if most of the photos don't need rotating.
I found that swapping the buttons around so the default "0" is on the right-hand side makes the rotate dialog easier to use (in combination with the rename dialog which has an OK button on the right hand side).
You can quickly run through a folder of camera photos and create a thumbnailed index.html photo gallery web page.

Code: Select all

yad --image="tn_$i" --mouse --title="ROTATE?" \
--button="EXIT:6" \
--button="270:2" \
--button="180:3" \
--button="90:4" \
--button="0:5"
The EXIT button has been moved to the left-hand side, out of the way, where it is less likely to be "accidentally clicked" when doing a fast and rapid run through of many photos.

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

#33 Post by kjdixo »

I will include a final version of these galleries in my YAD bookmarking scripts.
Here we have a photo gallery gallery3.sh with a drop down list for navigation.
The drop down list is always at the top right hand side of the browser window.
Wherever you scroll in the gallery the navigation list will always be easy to find.

Code: Select all

#! /bin/sh
# put this script in the folder with the images.
# define EXIT and cancel
end_it_all(){
echo "<select id=\"nav\" onchange=\"location=this.value\">" >> index.html
cat temp.txt >> index.html
echo "</select>" >> index.html
echo "</body>" >> index.html
echo "</html>" >> index.html	
}
rm -rf temp.txt
title=$(pwd | awk -F / '{print $NF}') 
title=$(echo $title | yad --mouse --width=1000 --title="Edit Title or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $title = "" ]]; then title=$(echo "no title"); fi
echo "<!DOCTYPE html>" > index.html
echo "<head>" >> index.html
echo "<title>$title</title>" >> index.html
echo "<link rel=\"shortcut icon\" href=\"/root/.bookmarks/bm/img/favicon.ico\">" >> index.html
echo "<style>" >> index.html
echo "body{background-color:#ba8;background-image:url('/root/.bookmarks/bm/img/bg.jpg')}" >> index.html
echo "img{border:solid 4px white;margin:0px 0px;position:relative;top:4px}" >> index.html
echo "#nav{position:fixed;top:4px;right:4px;border:solid 2px yellow}" >> index.html
echo "</style>" >> index.html
echo "</head>" >> index.html
echo "<body>" >> index.html

fext=$(echo ".JPG" | yad --mouse --width=1000 --title="VERY IMPORTANT file extension of the images" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $fext = "" ]]; then fext=$(echo ".JPG"); fi
for i in *$fext; do 
convert.im6 -resize 600'x'600 "$i" "tn_"$i
# remove file extension
im=$(basename "$i")
id="${im%.*}"

yad --image="tn_$i" --mouse --title="ROTATE?" \
--button="EXIT:6" \
--button="270:2" \
--button="180:3" \
--button="90:4" \
--button="0:5"

ret=$?
if [[ $ret -eq 2 ]]; then
convert.im6 -rotate 270 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?

if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 3 ]]; then
convert.im6 -rotate 180 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 4 ]]; then
convert.im6 -rotate 90 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 5 ]]; then
convert.im6 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 6 ]]; then
end_it_all
exit 0
fi
done;
end_it_all

Images are closely stacked, I removed inline titles, the drop down list and image hovers are sufficient I think.
I wrote a temporary text file to hold the drop down list data which is then inserted before the final closing tags.
No external style sheet is needed this time.
EDIT
Edited once as I forgot to remove the stylesheet link from the script.
New attachment uploaded.
Attachments
gallery3.sh.tar.gz
(1.02 KiB) Downloaded 147 times

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

#34 Post by kjdixo »

Much more exciting . . . add the following code to the image style

Code: Select all

width:100%

To modify the script gallery3.sh change line 23 to

Code: Select all

echo "img{border:solid 4px white;margin:0px 0px;position:relative;top:4px;width:100%}" >> index.html

This makes all the images neatly fit the full width of the browser window and it looks much nicer than varying widths that need zooming.

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

#35 Post by kjdixo »

Photo gallery navigation is improved with gallery4.sh.
It adds updating of the navigation list by clicking on a photo.
It does this with a little extra JavaScript woven into the html page.
I could have done "onmouseover" . . . however, that is probably too automated and "onclick" gives a feeling of feedback and control whilst scrolling the gallery.
A photo when clicked will jump to the top of the browser window and its description will be updated on the drop-down navigation list.

Code: Select all

#! /bin/sh
# put this script in the folder with the images.
# define EXIT and cancel
end_it_all(){
echo "<select id=\"nav\" onchange=\"location=this.value\">" >> index.html
cat temp.txt >> index.html
echo "</select>" >> index.html
echo "</body>" >> index.html
echo "</html>" >> index.html	
}
rm -rf temp.txt
title=$(pwd | awk -F / '{print $NF}') 
title=$(echo $title | yad --mouse --width=1000 --title="Edit Title or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $title = "" ]]; then title=$(echo "no title"); fi
echo "<!DOCTYPE html>" > index.html
echo "<head>" >> index.html
echo "<title>$title</title>" >> index.html
echo "<link rel=\"shortcut icon\" href=\"/root/.bookmarks/bm/img/favicon.ico\">" >> index.html
echo "<style>" >> index.html
echo "body{background-color:#ba8;background-image:url('/root/.bookmarks/bm/img/bg.jpg')}" >> index.html
echo "img{border:solid 4px white;margin:0px 0px;position:relative;top:4px;width:100%}" >> index.html
echo "#nav{position:fixed;top:4px;right:4px;border:solid 2px yellow}" >> index.html
echo "</style>" >> index.html
echo "<script type=\"text/javascript\">function nav(){location=loc;document.getElementById('nav').value=loc}</script>" >> index.html
echo "</head>" >> index.html
echo "<body>" >> index.html

fext=$(echo ".JPG" | yad --mouse --width=1000 --title="VERY IMPORTANT file extension of the images" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $fext = "" ]]; then fext=$(echo ".JPG"); fi
for i in *$fext; do 
convert.im6 -resize 600'x'600 "$i" "tn_"$i
# remove file extension
im=$(basename "$i")
id="${im%.*}"

yad --image="tn_$i" --mouse --title="ROTATE?" \
--button="EXIT:6" \
--button="270:2" \
--button="180:3" \
--button="90:4" \
--button="0:5"

ret=$?
if [[ $ret -eq 2 ]]; then
convert.im6 -rotate 270 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?

if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 3 ]]; then
convert.im6 -rotate 180 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 4 ]]; then
convert.im6 -rotate 90 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 5 ]]; then
convert.im6 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 6 ]]; then
end_it_all
exit 0
fi
done;
end_it_all

Viewing a photographed postcard collection or a sequence of photographed printed pages is very easy with this system.
The photo galleries can be allocated a button or a category in the Pale Moon Bookmarking Script.
Attachments
gallery4.sh.tar.gz
(1.11 KiB) Downloaded 155 times

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

#36 Post by kjdixo »

To do with anchors, url hashes and the photo galleries and jumping to positions in any bookmarked web page (not just photo galleries . . . any web page).
I have made 2 improvements here.
1. Photo galleries created with this script gallery4a.sh will pass the url # anchor from the address bar to the drop-down list and update it correctly.
The created web page has a body onload to make the nav list value equal window.location.hash from the url address bar.

Code: Select all

#! /bin/sh
# put this script in the folder with the images.
# define EXIT and cancel
end_it_all(){
echo "<select id=\"nav\" onchange=\"location=this.value\">" >> index.html
cat temp.txt >> index.html
echo "</select>" >> index.html
echo "</body>" >> index.html
echo "</html>" >> index.html	
}
rm -rf temp.txt
title=$(pwd | awk -F / '{print $NF}') 
title=$(echo $title | yad --mouse --width=1000 --title="Edit Title or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $title = "" ]]; then title=$(echo "no title"); fi
echo "<!DOCTYPE html>" > index.html
echo "<head>" >> index.html
echo "<title>$title</title>" >> index.html
echo "<link rel=\"shortcut icon\" href=\"/root/.bookmarks/bm/img/favicon.ico\">" >> index.html
echo "<style>" >> index.html
echo "body{background-color:#ba8;background-image:url('/root/.bookmarks/bm/img/bg.jpg')}" >> index.html
echo "img{border:solid 4px white;margin:0px 0px;position:relative;top:4px;width:100%}" >> index.html
echo "#nav{position:fixed;top:4px;right:4px;border:solid 2px yellow}" >> index.html
echo "</style>" >> index.html
echo "<script type=\"text/javascript\">function nav(){location=loc;document.getElementById('nav').value=loc}</script>" >> index.html
echo "</head>" >> index.html
echo "<body onload=\"document.getElementById('nav').value=window.location.hash\">" >> index.html

fext=$(echo ".JPG" | yad --mouse --width=1000 --title="VERY IMPORTANT file extension of the images" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $fext = "" ]]; then fext=$(echo ".JPG"); fi
for i in *$fext; do 
convert.im6 -resize 600'x'600 "$i" "tn_"$i
# remove file extension
im=$(basename "$i")
id="${im%.*}"

yad --image="tn_$i" --mouse --title="ROTATE?" \
--button="EXIT:6" \
--button="270:2" \
--button="180:3" \
--button="90:4" \
--button="0:5"

ret=$?
if [[ $ret -eq 2 ]]; then
convert.im6 -rotate 270 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?

if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 3 ]]; then
convert.im6 -rotate 180 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 4 ]]; then
convert.im6 -rotate 90 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 5 ]]; then
convert.im6 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 6 ]]; then
end_it_all
exit 0
fi
done;
end_it_all

2. Complimentary to 1. above
The Pale Moon Bookmarking script bm.sh now includes an anchor # feature.
To use this feature when bookmarking any page right click and view the source of the web page to be bookmarked or inspect elements.
Then find the element id of where you want the bookmark to jump to and copy it and append it into the url address bar of Pale Moon, making sure to insert a '#' between the url and the append.
Hit enter and watch the url with the appended # cause the page to auto jump to the position of the element id.
I thought it would be nice for the Pale Moon bookmarking script to retain and respect these anchor points within long web pages and have bookmarks that contained the html anchors.
The modification to bm.sh is contained in the following lines of code.

Code: Select all

anchor=$(echo $address | awk 'BEGIN {FS="#" }{print $2}')
anchor2=$(echo "#"$anchor)
if [[ -z $anchor ]]; then anchor2=$(echo ""); fi
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$anchor2'><img src='../bm/img/favicon.ico'></a></span>")

EDIT added a line of code if [[ -z $anchor ]]; then anchor2=$(echo ""); fi above to remove the # from a locally stored bookmark that did not have a hash anchor to start with.

Remember to modify bm.sh in all category folders (.bookmarks, bookmarks-02 to .bookmarks-05 etc etc)
Attachments
bm.sh.tar.gz
(2.59 KiB) Downloaded 136 times
gallery4a.sh.tar.gz
(1.13 KiB) Downloaded 146 times

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

#37 Post by kjdixo »

Gallery Optimized for Viewing Books and Documents (to then bookmark).

It is easier to carry around a micro sd card than 10kg of books.
So you might at some stage have photographed with your camera some documents or book pages.
When you eventually look at the photographed pages on your computer screen you are less than impressed.
The photos are darker than you thought they were.
They are going to need contrast and brightness increasing, before they are good enough to stitch together into a gallery.
This script gallery5.sh is basically the same as the previous gallery scripts, but with a few extra features added.

1. An option at the start of batch thumbnailing to brighten up all the photos.
2. The photo thumbnail widths are 1200 pixels, double the resolution of before.

Dazzle or Normal is a one off choice to be made at the beginning of thumbnailing.
Dazzle implements imagemagick's "brightness, contrast, hue" feature.
I set it to -modulate 160,160,100 which is in my opinion, with my photos, fairly good.

Written text needs to be sharp and focussed . . . not compressed too much and blurry, so that is why the resolution has been increased.
It also means bigger image files and therefore slower loading.

Code: Select all

#! /bin/sh
# put this script in the folder with the images.
# define EXIT and cancel
end_it_all(){
echo "<select id=\"nav\" onchange=\"location=this.value\">" >> index.html
cat temp.txt >> index.html
echo "</select>" >> index.html
echo "</body>" >> index.html
echo "</html>" >> index.html	
}
rm -rf temp.txt
title=$(pwd | awk -F / '{print $NF}') 
title=$(echo $title | yad --mouse --width=1000 --title="Edit Title or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $title = "" ]]; then title=$(echo "no title"); fi
echo "<!DOCTYPE html>" > index.html
echo "<head>" >> index.html
echo "<title>$title</title>" >> index.html
echo "<link rel=\"shortcut icon\" href=\"/root/.bookmarks/bm/img/favicon.ico\">" >> index.html
echo "<style>" >> index.html
echo "body{background-color:#ba8;background-image:url('/root/.bookmarks/bm/img/bg.jpg')}" >> index.html
echo "img{border:solid 4px white;margin:0px 0px;position:relative;top:4px;width:100%}" >> index.html
echo "#nav{position:fixed;top:4px;right:4px;border:solid 2px yellow}" >> index.html
echo "</style>" >> index.html
echo "<script type=\"text/javascript\">function nav(){location=loc;document.getElementById('nav').value=loc}</script>" >> index.html
echo "</head>" >> index.html
echo "<body onload=\"document.getElementById('nav').value=window.location.hash\">" >> index.html

fext=$(echo ".JPG" | yad --mouse --width=800 --title="VERY IMPORTANT file extension of the images" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $fext = "" ]]; then fext=$(echo ".JPG"); fi

yad --mouse --title="Dazzle?" --button="Dazzle:0" --button="Normal:2"
ret=$?
if [[ $ret -eq 0 ]];then 
daz=$(echo "-modulate 160,160,100");echo $daz;fi
if [[ $ret -eq 2 ]];then 
daz=$(echo "");echo $daz;fi

for i in *$fext; do 
convert.im6 -resize 1200x $daz "$i" "tn_"$i
# remove file extension
im=$(basename "$i")
id="${im%.*}"

yad --image="tn_$i" --mouse --title="ROTATE?" \
--button="EXIT:6" \
--button="270:2" \
--button="180:3" \
--button="90:4" \
--button="0:5"

ret=$?
if [[ $ret -eq 2 ]]; then
convert.im6 -rotate 270 -resize 1200x $daz "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1600 --title="Edit Description or add one here" --text-info --editable)
ret=$?

if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 3 ]]; then
convert.im6 -rotate 180 -resize 1200x $daz "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1600 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 4 ]]; then
convert.im6 -rotate 90 -resize 1200x $daz "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1600 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 5 ]]; then
convert.im6 -resize 1200x $daz "$i" "tn_"$i
desc=$(echo "tn_"$i | yad  --image="tn_$i" --mouse --width=1600 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then 
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 6 ]]; then
end_it_all
exit 0
fi
done;
end_it_all

You might need to tweak the imagemagick parameters and resolutions to suit your particular screen size or maybe the brightness is not exactly what you want.
Modify to suit.
Attachments
gallery5.sh.tar.gz
(1.19 KiB) Downloaded 130 times

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

#38 Post by kjdixo »

You could include the -resize parameter in the Dazzle option $daz above.
So that you get 1200px width for enhanced printed pages and 600px width for ordinary photographs (Normal option).
Also, if you photograph a set of pages, they probably all have a consistent strip of floor or desk area top and bottom, or at the sides, that could do with cropping.
Removal of the thumbnail edges (cropping) could be included in the script.
Other imagemagick functions http://www.imagemagick.org/Usage/ could also be included in the script.
Maybe add extra YAD code to input the imagemagick options to $daz.
Use buttons, combo boxes, a check list or a "--text-info --editable" dialog.

The gallery5.sh ROTATE? dialog has an option to EXIT and restart the process.
So when you are doing the first thumbnail rotation you can also check the contrast and brightness before proceeding.
If it is not correct then EXIT, tweak the parameters until perfect and then proceed with all the rest of the thumbnails.

The version of imagemagick I am using requires that convert is written as convert.im6

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

#39 Post by kjdixo »

The bookmarking retagging script bmretag.sh now includes renaming of bookmark titles.
I only show here the section of code that has been modified, not all the code of bmretag.sh.
The attachment contains the complete code.

Code: Select all

#!/bin/sh

dialog=$(yad --on-top --mouse --width=900 --title "To Retag or Rename a bookmark press a blue button for 2 seconds" --form --field="Then click 10 digit timestamp and drag it into this box")
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
timestamp=$(echo $dialog | awk 'BEGIN {FS="|" } { print $1 }')
if [[ $timestamp = "" ]]; then exit 0; fi
timestamp2=$(echo $timestamp | awk 'BEGIN {FS="-" } { print $2 }')
size=${#timestamp2}
if [ $size = 10 ];
then
case $timestamp2 in
''|*[!0-9]*) ;;
*) 
# here copy line containing $timestamp2 from bm0/index.html to $bm_tmp, if timestamp not found then exit.
# also - if you are trying to use a video bookmark timestamp instead of a bookmark timestamp - it will exit.
bm_tmp=$(awk '/'$timestamp2'/' /root/.bookmarks/bm0/index.html | sed 's/span><span.*/span>/' | sed 's/<\/td><\/tr>//')
bm_title=$(echo $bm_tmp | awk 'BEGIN {FS=".pdf\">" }{print $2}' | awk 'BEGIN {FS="</a>" }{print $1}')
echo $bm_title
# rename the bookmark (give it a new title)
title=$(echo $bm_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
echo $title
title1=$(echo $title | cut -c 1-64)
title2=$(echo $title1 | sed 's/\//_/g' | sed 's/?/_/g' | sed 's/"/_/g' | sed 's/#/_/g')
echo $title2
bm_tmp=$(echo $bm_tmp | sed "s/$bm_title/$title2/g")
# rename .pdf in the folder /root/.bookmarks/bm/pdf/
bm_time=$(echo $bm_tmp | awk 'BEGIN {FS="/bm/wp/" }{print $2}' | awk 'BEGIN {FS="/" }{print $1}')
echo $bm_time
cd /root/.bookmarks/bm/pdf
file_old=$(ls $bm_time*.pdf)
echo $file_old
file_new=$(ls $bm_time*.pdf | sed "s/$bm_title/$title2/g")
echo $file_new
mv "$file_old" "$file_new"
sleep 1
if [[ -z $bm_tmp ]]; then exit 0; fi
# once that is done delete existing tags and proceed as normal with code below to retag. 
                                                                           #
                                                  #
                              #
             #
#
             #
                                #
# please see the complete code in the attachment or graft the code above onto the beginning of your bmretag.sh
# it is probably best to check the attachment for the complete code.
As well as renaming the bookmark title it also changes the filename of the local timestamped .pdf.
Make sure you modify bmretag.sh in all 5 of the .bookmarks folders.
.bookmarks, .bookmarks-02, .bookmarks-03, .bookmarks-04, .bookmarks-05.
Enjoy . . . renaming your bookmarks.
Attachments
bmretag.sh.tar.gz
(2.54 KiB) Downloaded 133 times

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

#40 Post by kjdixo »

The video bookmarking script bv.sh sometimes downloads a webm file instead of an mp4 file (using youtube-dl).
That messes up the video bookmarks html pages as they reference mp4 files and not webm files.
It would be possible to detect file extensions and write the html bookmarks accordingly.
It would also be possible to convert from webm to mp4 (which takes a while to do and requires ffmpeg) it works but that solution was overkill.
A better method is to force the downloading of an mp4 file . . . in the first place.
I did this by adding the code: -f mp4 to the youtube-dl script in bv.sh.
In bv.sh replace this line

Code: Select all

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
with this line

Code: Select all

youtube-dl "$address" -o "/root/.bookmarks/bv/vid/"$time"_%(id)s.%(ext)s" -f mp4 | yad --width=900 --on-top --mouse --title "Downloading . . . then please wait for save menu" --progress --pulsate  --auto-close
That (-f mp4) fixes the problem.
Make sure to modify bv.sh in all 5 of the .bookmarks folders.
.bookmarks, .bookmarks-02, .bookmarks-03, .bookmarks-04, .bookmarks-05.

Post Reply