#!/bin/bash
# Name: chwp.sh
# Function: Generates xml file for wallpapers slideshow
#
https://forum.ubuntu.ru IMGS=`find . -iname '*.png' -o -iname '*.jpg' -o -iname '*.svg'`
N=`echo $IMGS | wc -w`
S=2
NAME1=`echo $IMGS | cut -d '/' -f $N | cut -d ' ' -f 1`
echo '<background>'
echo ' <starttime>'
echo ' <year>2009</year>'
echo ' <month>01</month>'
echo ' <day>01</day>'
echo ' <hour>00</hour>'
echo ' <minute>00</minute>'
echo ' <second>00</second>'
echo ' </starttime>'
echo '<!-- Начало слайдшоу-->'
echo ' <static>'
echo ' <duration>1795.0</duration>'
echo ' <file>'`pwd`'/'$NAME1'</file>'
echo ' </static>'
echo ' <transition>'
echo ' <duration>5.0</duration>'
echo ' <from>'`pwd`'/'$NAME1'</from>'
#-----------------------------------------------------------
while [ "$N" -ge "$S" ]
do
NAME=`echo $IMGS | cut -d '/' -f $S | cut -d ' ' -f 1`
echo ' <to>'`pwd`'/'$NAME'</to>'
echo ' </transition> '
echo ' <static> '
# Время которое будет отображатся картинка (в секундах)
# Time which the picture will be shown (in seconds)
echo ' <duration>1795.0</duration> '
echo ' <file>'`pwd`'/'$NAME'</file> '
echo ' </static> '
echo ' <transition> '
# Время перехода с одной картинки на другую (в секундах)
# Time of transition from one picture to another (in seconds)
echo ' <duration>5.0</duration> '
echo ' <from>'`pwd`'/'$NAME'</from> '
S=$(($S+1))
done
#----------------------------------------------------------
echo ' <to>'`pwd`'/'$NAME1'</to>'
echo ' </transition>'
echo '</background>'