wallpaper slideshow script

Forum rules
Before you post please read how to get help
Post Reply
kouskous
Level 1
Level 1
Posts: 1
Joined: Sun Feb 09, 2020 7:40 am

wallpaper slideshow script

Post by kouskous »

hello.
i have find to net one script to make backround.hml with my photos.
this script have one problem when arrive to last photo the don't again the first.
it is possible anyone to help and fix it?
here is the script

Code: Select all

#!/bin/bash
 
if [ $# -lt 2 ]
then
    echo
    echo
    echo "You are missing some parameters."
    echo
    echo "example: $0 *.jpg"
    echo
    exit 1
fi
 
echo -n "Give a name to your new wallpaper slideshow: "; read showname
echo -n "How many seconds do you want each image to display before switching? "; read hold
echo -n "How many seconds would you like the transition to take? "; read fade
 
#params
outfile=backgrounds.xml
 
 
#DEBUG
echo
echo "Executing ..."
echo "Output to $outfile"
 
#remove hold parameter
#shift
#remove fade parameter
#shift
 
( #all of the contents in parentheses will be output to the outfile.
echo "<background>"
echo "  <starttime>"
echo "    <year>2011</year>"
echo "    <month>01</month>"
echo "    <day>01</day>"
echo "    <hour>00</hour>"
echo "    <minute>00</minute>"
echo "    <second>00</second>"
echo "  </starttime>"
 
while [ $# -gt 0 ]
do
    echo
    echo "  </transition>"
    echo "    <duration>$fade</duration>"
    echo "    <from>$1</from>"
    echo "    <to>$2</to>"
    if [ $# -gt 1 ]
    then
        echo "    <to>$1</to>"
    else
        echo "    <to>$1</to>"
    fi
    echo "  </transition>"
 
    shift
done
echo "</background>"
#Closing parenthesis marks the end of material to be output to the outfile.
)>$outfile

User avatar
lsemmens
Level 9
Level 9
Posts: 2995
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: wallpaper slideshow script

Post by lsemmens »

Surely all you would need do is test for the last file and then loop to the first.

pseudo code
If file = lastfile
Set file = first file
loop - i.e. re-start program.
Fully mint Household
Out of my mind - please leave a message

Post Reply

Return to “Themes, Icons, & Wallpaper”