Skip to content

Instantly share code, notes, and snippets.

@loranbriggs
Last active March 28, 2016 20:34
Show Gist options
  • Save loranbriggs/b1972574a6ffa2666d2b to your computer and use it in GitHub Desktop.
Save loranbriggs/b1972574a6ffa2666d2b to your computer and use it in GitHub Desktop.
creates a background slideshow xml file
#!/bin/bash
# creates a background slideshow xml file
# usage:
#
# background_slideshow.sh >> myfilename.xml
function header() {
echo -e "\t<starttime>"
echo -e "\t\t<year>2009</year>"
echo -e "\t\t<month>08</month>"
echo -e "\t\t<day>04</day>"
echo -e "\t\t<hour>00</hour>"
echo -e "\t\t<minute>00</minute>"
echo -e "\t\t<second>00</second>"
echo -e "\t</starttime>"
}
function static() {
echo -e "\t<static>"
echo -e "\t\t<duration>1795.0</duration>"
echo -e "\t\t<file>$(pwd)/$1</file>"
echo -e "\t</static>"
}
function transition() {
echo -e "\t<transition>"
echo -e "\t\t<duration>5.0</duration>"
echo -e "\t\t<from>$(pwd)/$1</from>"
echo -e "\t\t<to>$(pwd)/$2</to>"
echo -e "\t</transition>"
}
echo -e "<background>"
header
arr=(*)
for ((i=0; i<${#arr[@]}-1; i++));
do
static ${arr[$i]}
transition ${arr[$i]} ${arr[$i+1]}
done
LAST=${arr[${#arr[@]}-1]}
static $LAST
transition $LAST ${arr[0]}
echo "</background>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment