To make this possible our slideshow script should be able to:
- find slideshows located under some base folder
- display the list where we can choose one from
- pass our choice to the viewer program (qiv)
As you may have noticed I commented the commands related to background music.
#!/bin/sh
ssPath="/home/user/MMC-SD/partition1/DCIM/"
cd $ssPath
ssList=$(ls -dx *)
ssFolder=$(zenity --list --title="Choose Slideshow" --column="Folder" $ssList)
if [ -n "$ssFolder" ] ; then
xset s off -dpms
# mpg321 --random --quiet /home/user/MMC-SD/partition1/MISC/audio/*.mp3 &
qiv -sfmir -d 8 $ssPath$ssFolder/*
# killall mpg321
xset s on +dpms
fi
To implement new features, mentioned above, I introduced three variables:
- ssPath - my base folder, each its sub-folder is a slideshow (you must change its value to your actual location)
- ssList - the list of all found slideshows
- ssFolder - what I chose from ssList
It shows a file manager, which displays my directory tree. The address bar shows my base folder - "/home/user/MMC-SD/partition1/DCIM/", this value is directly assigned to ssPath.
ssPath="/home/user/MMC-SD/partition1/DCIM/"The folder DCIM contains only sub-folders, every one of them is a separate slideshow. The command
ls -dx *lists them in a single row, and this is assigned to ssList:
ssList=$(ls -dx *)
Then I use the command zenity which displays a nice dialog, as shown on the first picture. The result (my choice) is assigned to ssFolder:
ssFolder=$(zenity --list --title="Choose Slideshow" --column="Folder" $ssList)Zenity was installed on my computer by default, so I think it should be same on yours.
The next step is to make sure ssFolder is not empty, so the rest of the script is executed if the below command returned TRUE:
if [ -n "$ssFolder" ] ; thenThe rest is pretty much similar to what I explained in the previous post. The only difference is this command:
qiv -sfmir -d 8 $ssPath$ssFolder/*qiv should play all files in my selected folder ($ssFolder), attached to the full path (the base folder ssPath). You should avoid having non-image files in that folder, or you may try -n option, which tells qiv to filter files by their magic numbers instead of extensions.
Enjoy!
No comments:
Post a Comment