/usr/bin/gallery1-to-slideshow is in dvd-slideshow 0.8.4.2-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | #!/bin/bash
# gallery1-to-slideshow
# was gallery2slideshow
# Copyright 2003 Scott Dylewski <scott at dylewski.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
version='0.8.1'
changes ()
{
echo 'Changes:
0.8.1
Escape colons in subtitles
0.7.5
No changes
0.7.4
Fixed bug where no pictures were found with new version of gallery 1.5
Fixed bug near line 279 with a missing "fi" statement.
0.7.3
Changed name from gallery2slideshow to gallery1-to-slideshow to avoid
confusion... it does not work on gallery v.2.x albums!
Add -b background image option
Fix for finding all images in album. Thanks Ivan Espinosa!
Added a few more quotes around variables to help with spaces in filenames.
0.7.2 Another fix to allow newlines in gallery comments
These should correctly get translated into \n characters.
Strips out <a href=""> and </a> tags also.
0.7.0 Fix to not show hidden pictures for gallery v1.4.3-pl1
( thanks Frederic! )
Fixed bug when passing html links in subtitle field
dvd-slideshow supports duration in fractional seconds.
Allow for "." as the album path
0.5.2 -i switch not required for album path
0.5.0 Added option (-c duration) to do a crossfade between every picture.
This script automatically removes ":" and <return> characters
from the comment field.
0.4 Added default fade in at beginning and out at end
0.3 Added extra file checking before processing for better stability
from Scott Merrill <skippy at skippy.net> Thanks!!!
0.2 Initial release'
}
help ()
{
echo "gallery1-to-slideshow $version"
echo "gallery1-to-slideshow is part of the dvd-slideshow set of tools."
echo 'Copyright 2003 Scott Dylewski <scott at dylewski.com>'
echo 'http://freshmeat.net/dvdslideshow'
echo '
gallery1-to-slideshow description:
Generates a text file listing of the pictures visible in a given
"Gallery" (http://gallery.sourceforge.net) photo album
in order to easily pass the information to dvd_slideshow
Usage: gallery1-to-slideshow [-o <output_directory>] [-t <time_per_picture>]
[-b <background image>] [-c duration] <path_to_album>
Options:
path_to_album
Path to the album that you want to generate a slideshow for.
[-o output_directory]
Path to the directory where you want to output file written.
Default is the current working directory.
[-t time_per_picture]
Number of seconds that the picture will be visible
on the dvd movie. You can edit the output file to make
changes to specific lines.
Default is 5 seconds.
[-b <background image>]
Specify background image to use for slideshow.
[-c duration]
Add a crossfade between every picture for duration seconds.
-h or -help
Prints this help.
'
}
if [ $# -lt 1 ]; then
help
exit 1
fi
## setup initial variables:
debug=0 # 1 or 0
crossfade=0
for arg
do
case "$arg" in
-i) shift ; album_path="$1" ; shift ;;
-o) shift; output_dir="$1"; shift ;;
-t) shift; duration="$1"; shift ;;
-c) shift; crossfade=1; crossfade_duration="$1"; shift ;;
-h) help ; exit 0 ; shift ;;
-?) help ; exit 0 ; shift ;;
-help) help ; exit 0 ; shift ;;
esac
done
if [ -z "$album_path" ] ; then
album_path="$1"
fi
if [ -z "$album_path" ] ; then
echo "[gallery1-to-slideshow] Error: No album specified"
exit 1
fi
if [ -z "$output_dir" ] ; then
output_dir="`pwd`"
fi
if [ -z "$duration" ] ; then
duration="5"
fi
## check_rm checks to see if the file exists before it's deleted:
check_rm ()
{
if [ -f $1 ] ; then
rm $1
fi
}
cleanup ()
{
## clean up temporary files
echo "done"
}
forcequit () ## function gets run when we have some sort of forcequit...
{
## clean up temporary files
cleanup
exit 0
}
trap 'forcequit' INT
trap 'forcequit' KILL
trap 'forcequit' TERM
# sanity checking
# did the user give us a valid input file to work with?
if [ ! -f "$album_path" ]; then
# it's not a regular file
if [ ! -d "$album_path" ]; then
# it's not a directory!
echo "[gallery1-to-slideshow] Bad input file (-i $album_path)!"
exit 1;
else
# check for '.' path
if [ "$album_path" == '.' ]; then
# use current directory
album_path="`pwd`"
fi
# it is a directory, so use album.dat
echo "[gallery1-to-slideshow] Using album.dat in $album_path";
album_file="album.dat";
if [ ! -f "$album_path/$album_file" ]; then
# there's no album.dat file there!
echo "[gallery1-to-slideshow] No such file $album_path/$album_file!";
echo "[gallery1-to-slideshow] Aborting!";
exit 1;
fi
fi
else
# it is a regular file!
echo "[gallery1-to-slideshow] ERROR: you must specify a directory name!"
exit 1
# album=`basename "${album_path}"`;
# album_path=`echo $album_path | sed -e "s/$album//"`;
fi
# make sure $album_path has no trailing slash
album_path=`echo "$album_path" | sed -e 's/\/$//'`;
album=`basename "${album_path}"`;
if [ -z "$output_dir" ]; then
# no output directory specified!
echo "[gallery1-to-slideshow] Invalid output destination (-o $output_dir)!";
echo "[gallery1-to-slideshow] *** Using $album_path instead.";
output_dir=$album_path;
fi
if [ ! -d "$output_dir" ]; then
# I'm sure it was a simple typo.
echo "[gallery1-to-slideshow] Invalid output destination (-o $output_dir)!";
echo "[gallery1-to-slideshow] *** Using $album_path instead.";
output_dir=$album_path;
fi
# make sure $output_dir has no trailing slash
output_dir=`echo $output_dir | sed -e 's/\/$//'`;
## now let's do some checking to see if the user put in the full path?
echo "[gallery1-to-slideshow] path=$album_path"
echo "[gallery1-to-slideshow] album=$album"
echo "[gallery1-to-slideshow] album_file=$album_file"
echo "[gallery1-to-slideshow] output_dir=$output_dir"
outfile="$output_dir/$album".txt
echo "[gallery1-to-slideshow] output file=$output_dir/$album".txt
## if title is wanted:
summary=`awk -F'"title"' '{print $2}' "${album_path}"/album.dat | awk -F'"' '{print $2}'`
#gallery_version=`awk -F'"version"' '{print $2}' "${album_path}"/album.dat | awk -F'"' '{print $2}'`
pictures=`awk -F'albumitem' '{print NF}' "${album_path}"/photos.dat`
echo "#background:1::black" > "$outfile"
echo "#background:0::background.jpg" >> "$outfile"
echo "fadein:1" >> "$outfile"
echo "title:$duration:$album:$summary" >> "$outfile"
echo "[gallery1-to-slideshow] title:$duration:$album:$summary"
echo "#background:0::black" >> "$outfile"
## else do not make a title.
## fade in after title:
echo "fadeout:2" >> "$outfile"
echo "background:1" >> "$outfile"
# add music? this makes it easier to just un-comment stuff
echo '# remember format is:' >> "$outfile"
echo '# musicfile.mp3:audio_track:[fadein:fadein_time:fadeout:fadeout_time]' >> "$outfile"
echo "#musicfile.mp3:1:fadein:1:fadeout:5" >> "$outfile"
echo 'fadein:1' >> "$outfile"
## get the total number of pictures:
# anybody know a better way to get rid of potential returns?
pictures=`awk -F'albumitem' '{print NF}' "${album_path}"/photos.dat`
pictures=`echo $pictures | tr [:space:] ' '`
# sometimes the pictures string now has a space in-between
# this is from someone entering return (^M) characters in their
# comments fields
total_pictures=0
total_lines=0
for i in $pictures ; do
total_pictures=$(( $total_pictures + $i ))
total_lines=$(( $total_lines + 1 ))
done
total_pictures=$(( $total_pictures - 1 ))
pictures2=`awk -F'AlbumItem' '{print NF}' "${album_path}"/photos.dat`
pictures2=`echo $pictures2 | tr [:space:] ' '`
# sometimes the pictures string now has a space in-between
# this is from someone entering return (^M) characters in their
# comments fields
total_pictures2=0
total_lines=0
for i in $pictures2 ; do
total_pictures2=$(( $total_pictures2 + $i ))
total_lines=$(( $total_lines + 1 ))
done
total_pictures2=$(( $total_pictures2 - 1 ))
#echo "total_pictures=$total_pictures total_pictures2=$total_pictures2"
# pick the greater of the two methods:
if [ "$total_pictures2" -gt "$total_pictures" ] ; then
## Newer versions of gallery use "AlbumItem" instead of "albumitem"
newgallery=1
# pictures=`awk -F'AlbumItem' '{print NF}' "${album_path}"/photos.dat`
total_pictures="$total_pictures2"
echo "[gallery1-to-slideshow] new gallery version"
else
newgallery=0
echo "[gallery1-to-slideshow] old gallery version"
fi
echo "[gallery1-to-slideshow] total pictures=$total_pictures"
#pictures=$(( $pictures + 1 ))
## yeah, this is slow, but not as slow as typing in everything
## from the gallery yourself...
j=1
for i in `seq 2 $total_pictures`; do
## get rid of potential newlines in comments sections first:
if [ "$newgallery" -eq 1 ] ; then
albumitem=`cat "$album_path/photos.dat" | tr '\n' '\a' | awk -F'AlbumItem' '{print $'"$i"'}'`
else
albumitem=`cat "$album_path/photos.dat" | tr '\n' '\a' | awk -F'albumitem' '{print $'"$i"'}'`
fi
filename[$j]=`echo "${albumitem}" | awk -F'"name"' '{print $2}' | awk -F'"' '{print $2}'`
comment[$j]=`echo "${albumitem}" | awk -F'"caption"' '{print $2}' | awk -F':"' '{print $2}' | awk -F'";' '{print $1}' | tr '\a' ' ' | sed -e 's/\r/\\\\n/' | sed -e 's/<a href.*">//' | sed -e 's/<\/a>//' | sed -e 's/\:/\\\:/g'`
hidden[$j]=`echo "${albumitem}" | awk -F'"hidden"' '{print $2}' | awk -F';' '{print $2}'`
if [ "${hidden[$j]}" == 'N' ] || [ -z "${hidden[$j]}" ] ; then ## only include this picture if it's shown in the gallery
new_filename="${album_path}/${filename[$j]}.jpg"
echo "[gallery1-to-slideshow] picture $j of $total_pictures"
echo "[gallery1-to-slideshow] filename=${new_filename} comment=${comment[$j]}"
## write to file:
## Fix by Ivan Espinosa 1/2006
if [ -r "${new_filename}" ] ; then
if [ "$j" -ne 1 ] ; then
if [ "$crossfade" -eq 1 ] ; then
echo "crossfade:$crossfade_duration:" >> "$outfile"
fi
fi
echo "${new_filename}:$duration:${comment[$j]}" >> "$outfile"
fi
# if [ "$crossfade" -eq 1 ] && [ "$(($i+1))" -lt "$total_pictures" ] ; then
# echo "crossfade:$crossfade_duration:" >> "$outfile"
# fi
let j=$j+1
else
echo "[gallery1-to-slideshow] picture $j of $total_pictures Hidden in Gallery"
let j=$j+1
fi
done
echo ' ' >> "$outfile"
echo '# to insert a title slide in the middle of the slideshow, use this:' >> "$outfile"
echo '#fadeout:1' >> "$outfile"
echo '#background:1' >> "$outfile"
echo '#background:1::background.jpg' >> "$outfile"
echo '#title:5::Title Text' >> "$outfile"
echo '#background:0::black' >> "$outfile"
echo '#fadeout:1' >> "$outfile"
echo '#fadein:1' >> "$outfile"
echo ' ' >> "$outfile"
## fade out at end
echo "fadeout:1" >> "$outfile"
## stop the music before the final fadeout to the background:
echo "silence:1:" >> "$outfile"
echo "background:1" >> "$outfile"
echo '#fadein:1' >> "$outfile"
echo '#background.jpg:1' >> "$outfile"
cleanup
|