God, this was hard work! But I think it runs, needs testing and all the
paths are hardcoded and need changing.
So I am assembling a directory of jpegs and will report back, but going out
(again) for a while.
#!/bin/bash
rm background-1.xml
echo "<background>" >> background-1.xml
echo " <starttime>" >> background-1.xml
echo " <year>2009</year>" >> background-1.xml
echo " <month>08</month>" >> background-1.xml
echo " <day>04</day>" >> background-1.xml
echo " <hour>00</hour>" >> background-1.xml
echo " <minute>00</minute>" >> background-1.xml
echo " <second>00</second>" >> background-1.xml
echo " </starttime>" >> background-1.xml
echo "<!-- This animation will start at midnight. -->" >> background-1.xml
#counter variable
x=1
for file in *
do
#echo $x
if [ $x -eq 1 ]
then
FE='<to>/usr/share/backgrounds/cosmos/'
FE="${FE}$file"
FE="${FE}</to>"
fi
if [ $x -gt 1 ]
then
FT='<to>/usr/share/backgrounds/cosmos/'
FT="${FT}$file"
FT="${FT}</to>"
echo $FT >> background-1.xml
fi
echo " <static>" >> background-1.xml
echo " <duration>1795.0</duration>" >> background-1.xml
FS=" <file>/usr/share/backgrounds/cosmos/"
FS="${FS}$file"
FS="${FS}</file>"
FR=" <from>/usr/share/backgrounds/cosmos/"
FR="${FR}$file"
FR="${FR}</from>"
FT=" <to>/usr/share/backgrounds/cosmos/"
FT="${FT}$file"
FT="${FT}</to>"
echo $FS >> background-1.xml
echo " <static>" >> background-1.xml
echo " <duration>5.0</duration>" >> background-1.xml
echo $FR >> background-1.xml
echo "</transition>" >> background-1.xml
#ls "$file" # Lists all files in $PWD (current directory).
x=$(( $x + 1 ))
#echo $x
done
echo $FE >> background-1.xml
echo "</transition>" >> background-1.xml
echo "</background>" >> background-1.xml
exit 0
--
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/