ubuntuusers.de

makeSlideshow

Autor:
grunsch
Datum:
27. Oktober 2009 23:18
Code:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash

dir=$1
dir=${dir%/}
IFS=''
name="/background-1.xml"
cat <<EOF > $dir$name
<background>
  <starttime>
    <year>2009</year>
    <month>08</month>
    <day>04</day>
    <hour>00</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at midnight. -->
EOF

echo $dir
if [ -d "$dir" ]; then
  count=0
  for file in $dir/*; do
     echo "h"
     if [ $count == 0 ]; then
       first=$file
     else
       cat <<EOF >> $dir$name
    <to>$file</to>
  </transition>
EOF
     fi
     cat <<EOF >> $dir$name
  <static>
    <duration>1795.0</duration>
    <file>$file</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>$file</from>
EOF
    count=$count+1
  done
  cat <<EOF >> $dir$name
    <to>$first</to>
  </transition>
</background>
EOF
fi
exit