updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / nautilus-gkim / GKIM_slideshow
blob772c420708af59dd5290658317d0bc095b0935d4
1 #!/bin/bash
2 # Create a Flash slideshow
3 FILE="";
6 KIM_DIR='/usr/share/GKIM/slideshow'
7 if TITLE=`zenity --entry --title="Titre" --text="Veuillez saisir le titre"`
8 then
9 echo "TITLE = $TITLE";
10 else
11 exit 0;
14 if AUTHOR=`zenity --entry --title="Titre" --text="Veuillez saisir l'auteur" --entry-text="$USER"`
15 then
16 echo "AUTHOR = $AUTHOR";
17 else
18 exit 0;
21 DATE=`date '+%A %-d %B %Y'`;
22 if SCALE=`zenity --entry --title="Titre" --text="Veuillez saisir la résolution des images" --entry-text="600x450"`
23 then
24 echo "SCALE = $SCALE";
25 else
26 exit 0;
29 if DIR=`zenity --title "Selecionner le repertoire où stocker le slideshow" --file-selection --directory`
30 then
31 echo "DIR = $DIR";
32 else
33 exit 0;
36 W=`echo $SCALE | sed 's/[^0-9]/ /g' | awk '{print $1}'`;
37 H=`echo $SCALE | sed 's/[^0-9]/ /g' | awk '{print $2}'`;
39 DIR=`echo $DIR | sed 's/" "/"\ "/g'`;
40 echo $DIR ;
41 mkdir "$DIR"/images;
42 mkdir "$DIR"/images/tmp;
43 cp $KIM_DIR/dewslider.swf "$DIR";
44 # Header of "$DIR"/index.html
45 cp $KIM_DIR/index.part1 "$DIR"/index.html;
46 echo '<h1>'$TITLE'</h1>' >> "$DIR"/index.html;
47 echo '<h5>Auteur: '$AUTHOR'</h5>' >> "$DIR"/index.html;
48 echo '<h5>Date: '$DATE'</h5>' >> "$DIR"/index.html;
49 let W2="$W+40";
50 let H2="$H+60";
51 echo '<object type="application/x-shockwave-flash" data="dewslider.swf?xml=dewslider.xml" width="'$W2'" height="'$H2'">' >> "$DIR"/index.html;
52 cat $KIM_DIR/index.part2 >> "$DIR"/index.html;
53 # Header of "$DIR"/dewslider.xml
54 echo '<?xml version="1.0" ?>' > "$DIR"/dewslider.xml;
55 echo '<album' >> "$DIR"/dewslider.xml;
56 echo 'width="'$W'" height="'$H'"' >> "$DIR"/dewslider.xml;
57 echo 'bgcolor="0xeeeeee" framecolor="0xffffff" padding="10" margin="10"' >> "$DIR"/dewslider.xml;
58 echo 'shadow="8" shadowopacity="15%" shadowcolor="0x000000" showbuttons="on"' >> "$DIR"/dewslider.xml;
59 echo 'buttonstyle="flat" showtxt="on" txtcolor="0xcccccc" auto="5" fullscreen="off"' >> "$DIR"/dewslider.xml;
60 echo '>' >> "$DIR"/dewslider.xml;
62 (compteur=0
63 for i in "$@";do
64 if [ -f "$i" ];then
65 let "compteur +=1"
66 FILE="$i"
67 #convert -resize $SCALE "$FILE" "$DIR"/images/`basename "$FILE"`.jpg;
68 width=`identify -format "%w" "$FILE"`;
69 height=`identify -format "%h" "$FILE"`;
70 if [ "$width" -gt "$height" ]; then
71 convert -resize $SCALE "$FILE" "$DIR"/images/`basename "$FILE"`.jpg;
72 else
73 convert -gravity Center -crop "80x80%%+0+0" -resize ${W}"x" +repage -crop ${W}"x"${H}"+0+0" -resize "x"${H} +repage -crop ${W}"x"${H}"+0+0" -blur 0x40 +repage "$FILE" "$DIR"/images/tmp/`basename "$FILE"`_1.jpg;
74 convert -resize ${W}"x"${H} "$FILE" "$DIR"/images/tmp/`basename "$FILE"`_2.jpg;
75 convert "$DIR"/images/tmp/`basename "$FILE"`_1.jpg "$DIR"/images/tmp/`basename "$FILE"`_2.jpg -gravity Center -composite "$DIR"/images/`basename "$FILE"`.jpg
77 echo '<img src="images/'`basename "$FILE"`'.jpg" title="'`basename "$FILE"`'" />' >> "$DIR"/dewslider.xml;
78 echo "$compteur";
79 fi;
80 done
81 )| zenity --progress \
82 --title="Création du slideshow" \
83 --text="traitement" \
84 --percentage=0;
86 rm -r "$DIR"/images/tmp;
87 echo '</album>' >> "$DIR"/dewslider.xml;
89 firefox "$DIR"/index.html;