[ '--clean', '-c', GetoptLong::NO_ARGUMENT, _("Clean destination directory") ],
[ '--theme', '-t', GetoptLong::REQUIRED_ARGUMENT, _("Select HTML theme to use") ],
- [ '--size', '-z', GetoptLong::REQUIRED_ARGUMENT, _("Size of images for `fullscreen' slideshow") ],
[ '--captions', '-C', GetoptLong::REQUIRED_ARGUMENT, _("File containing captions of images") ],
[ '--captions-skel', '-k', GetoptLong::REQUIRED_ARGUMENT, _("Filename where the script will output a captions skeleton") ],
#- default values for some globals
$convert = 'convert -interlace line +profile "*"'
-$size = 'medium'
$verbose_level = 2
$captions = {}
when '--theme'
select_theme(arg)
- when '--size'
- $size = arg
when '--captions'
if File.readable?(arg)
use_captions(arg)
select_theme('simple')
end
- size = $images_size.detect { |e| e['name'] == $size }
- if !size
- die __("Size %s not found in parameters of theme.", $size)
- else
- $sizeval = size['size']
- $sizeval_thumbnails = size['thumbnails']
- msg 3, __("Using sizes: fullscreen=%s, thumbnails=%s", $sizeval, $sizeval_thumbnails)
- end
end
def select_theme(name)
msg 2, __("Outputting in %s...", dest_dir)
#- resizes
- fullscreen_images = []
- thumbnail_images = []
+ for sizeobj in $images_size
+ fullscreen_images ||= {}
+ fullscreen_images[sizeobj['name']] = []
+ thumbnail_images ||= {}
+ thumbnail_images[sizeobj['name']] = []
+ thumbnail_videos ||= {}
+ thumbnail_videos[sizeobj['name']] = []
+ end
+
images.each { |img|
base_dest_img = dest_dir + '/' + img.sub(/\.[^\.]+$/, '')
- fullscreen_dest_img = base_dest_img + "-#{$sizeval}.jpg"
- thumbnail_dest_img = base_dest_img + "-#{$sizeval_thumbnails}.jpg"
- fullscreen_images << File.basename(fullscreen_dest_img)
- thumbnail_images << File.basename(thumbnail_dest_img)
- if !File.exists?(fullscreen_dest_img) || !File.exists?(thumbnail_dest_img)
- convert_options = ''
- orientation = `exif #{img}`.detect { |line| line =~ /^Orientation/ }
- if orientation =~ /right - top/
- convert_options += '-rotate 90 '
- end
- if orientation =~ /left - bottom/
- convert_options += '-rotate -90 '
- end
- if !File.exists?(fullscreen_dest_img)
- psys("#{$convert} #{convert_options}-geometry #{$sizeval} '#{dir}/#{img}' '#{fullscreen_dest_img}'")
- end
- if !File.exists?(thumbnail_dest_img)
- psys("#{$convert} #{convert_options}-geometry #{$sizeval_thumbnails} '#{dir}/#{img}' '#{thumbnail_dest_img}'")
+ for sizeobj in $images_size
+ size_fullscreen = sizeobj['fullscreen']
+ size_thumbnails = sizeobj['thumbnails']
+ fullscreen_dest_img = base_dest_img + "-#{size_fullscreen}.jpg"
+ thumbnail_dest_img = base_dest_img + "-#{size_thumbnails}.jpg"
+ fullscreen_images[sizeobj['name']] << File.basename(fullscreen_dest_img)
+ thumbnail_images[sizeobj['name']] << File.basename(thumbnail_dest_img)
+ if !File.exists?(fullscreen_dest_img) || !File.exists?(thumbnail_dest_img)
+ convert_options = ''
+ orientation = `exif '#{dir}/#{img}'`.detect { |line| line =~ /^Orientation/ }
+ if orientation =~ /right - top/
+ convert_options += '-rotate 90 '
+ end
+ if orientation =~ /left - bottom/
+ convert_options += '-rotate -90 '
+ end
+ if !File.exists?(fullscreen_dest_img)
+ psys("#{$convert} #{convert_options}-geometry #{size_fullscreen} '#{dir}/#{img}' '#{fullscreen_dest_img}'")
+ end
+ if !File.exists?(thumbnail_dest_img)
+ psys("#{$convert} #{convert_options}-geometry #{size_thumbnails} '#{dir}/#{img}' '#{thumbnail_dest_img}'")
+ end
end
end
}
#- create thumbnails for videos
- thumbnail_videos = []
videos.each { |video|
- thumbnail_dest_img = dest_dir + '/' + video.sub(/\.[^\.]+$/, '') + "-#{$sizeval_thumbnails}.jpg"
- thumbnail_videos << File.basename(thumbnail_dest_img)
- if !File.exists?(thumbnail_dest_img)
- cmd = "transcode -a 0 -c 1 -i '#{dir}/#{video}' -y jpg -o #{dest_dir}/screenshot.jpg >/dev/null 2>/dev/null"
- msg 2, cmd
- if system(cmd)
- sys("#{$convert} -geometry #{$sizeval_thumbnails} #{dest_dir}/screenshot.jpg000000.jpg '#{thumbnail_dest_img}'")
- destvideo = "#{dest_dir}/#{video}"
- if !File.exists?(destvideo)
- psys("cp '#{dir}/#{video}' '#{destvideo}'")
+ for sizeobj in $images_size
+ size_thumbnails = sizeobj['thumbnails']
+ thumbnail_dest_img = dest_dir + '/' + video.sub(/\.[^\.]+$/, '') + "-#{size_thumbnails}.jpg"
+ thumbnail_videos[sizeobj['name']] << File.basename(thumbnail_dest_img)
+ if !File.exists?(thumbnail_dest_img)
+ if !File.exists?("#{dest_dir}/screenshot.jpg000000.jpg")
+ cmd = "transcode -a 0 -c 1 -i '#{dir}/#{video}' -y jpg -o #{dest_dir}/screenshot.jpg >/dev/null 2>/dev/null"
+ msg 2, cmd
+ if !system(cmd)
+ break
+ end
end
+ sys("#{$convert} -geometry #{size_thumbnails} #{dest_dir}/screenshot.jpg000000.jpg '#{thumbnail_dest_img}'")
end
+ end
+ destvideo = "#{dest_dir}/#{video}"
+ if !File.exists?(destvideo)
+ psys("cp '#{dir}/#{video}' '#{destvideo}'")
+ end
+ if File.exists?("#{dest_dir}/screenshot.jpg000000.jpg")
File.delete("#{dest_dir}/screenshot.jpg000000.jpg")
- #mencoder $i -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o foo.avi -frames 1
- end
+ end
+ #mencoder $i -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o foo.avi -frames 1
}
+ sizenames = { 'small' => _("small"), 'medium' => _("medium"), 'large' => _("large") }
+
#- index.html (page with thumbnails)
- html = $html_thumbnails.collect { |l| l.clone }
- iterations = {}
- for i in html
- i.sub!(/~~run_slideshow~~/, _('Run slideshow!'))
- i.sub!(/~~title~~/, File.basename(dir))
- if i =~ /~~iterate(\d)_open(_max(\d+))?~~/
- for iter in iterations.values
- if iter['open']
- iter['open'] = false
- iter['close_wait'] = $1.to_i
+ for sizeobj in $images_size
+ html = $html_thumbnails.collect { |l| l.clone }
+ iterations = {}
+ for i in html
+ i.sub!(/~~run_slideshow~~/, _('Run slideshow!'))
+ i.sub!(/~~title~~/, File.basename(dir))
+ for sizeobj2 in $images_size
+ if sizeobj != sizeobj2
+ i.sub!(/~~size_#{sizeobj2['name']}~~/, '<a href="index-' + sizeobj2['name'] + '.html">' + sizenames[sizeobj2['name']] + '</a>')
+ else
+ i.sub!(/~~size_#{sizeobj2['name']}~~/, sizenames[sizeobj2['name']])
end
end
- iterations[$1.to_i] = { 'open' => true, 'max' => $3, 'opening' => '', 'closing' => '' }
- if $1.to_i == 1
- i.sub!(/.*/, '~~thumbnails~~')
- else
- i.sub!(/.*/, '')
- end
- elsif i =~ /~~iterate(\d)_close~~/
- iterations[$1.to_i]['open'] = false;
- iterations[$1.to_i]['close'] = true;
- i.sub!(/.*/, '')
- else
- for iter in iterations.values
- if iter['open']
- iter['opening'] += i
- i.sub!(/.*/, '')
+ if i =~ /~~iterate(\d)_open(_max(\d+))?~~/
+ for iter in iterations.values
+ if iter['open']
+ iter['open'] = false
+ iter['close_wait'] = $1.to_i
+ end
end
- if !iter['close'] && iter['close_wait'] && iterations[iter['close_wait']]['close']
- iter['closing'] += i
+ iterations[$1.to_i] = { 'open' => true, 'max' => $3, 'opening' => '', 'closing' => '' }
+ if $1.to_i == 1
+ i.sub!(/.*/, '~~thumbnails~~')
+ else
i.sub!(/.*/, '')
end
+ elsif i =~ /~~iterate(\d)_close~~/
+ iterations[$1.to_i]['open'] = false;
+ iterations[$1.to_i]['close'] = true;
+ i.sub!(/.*/, '')
+ else
+ for iter in iterations.values
+ if iter['open']
+ iter['opening'] += i
+ i.sub!(/.*/, '')
+ end
+ if !iter['close'] && iter['close_wait'] && iterations[iter['close_wait']]['close']
+ iter['closing'] += i
+ i.sub!(/.*/, '')
+ end
+ end
end
end
- end
- html_thumbnails = ''
- for iter in iterations.values
- iter['value'] = 1
- end
- for file in entries
- type = images.include?(file) ? 'image' : videos.include?(file) ? 'video' : nil
- if type
- for level in iterations.keys.sort
- if iterations[level]['value'] == 1 || level == iterations.keys.max
- html_thumbnails += iterations[level]['opening']
+ html_thumbnails = ''
+ for iter in iterations.values
+ iter['value'] = 1
+ end
+ for file in entries
+ type = images.include?(file) ? 'image' : videos.include?(file) ? 'video' : nil
+ if type
+ for level in iterations.keys.sort
+ if iterations[level]['value'] == 1 || level == iterations.keys.max
+ html_thumbnails += iterations[level]['opening']
+ end
+ iterations[level]['value'] += 1
+ if iterations[level]['max'] && iterations[level]['value'] > iterations[level]['max'].to_i
+ iterations[level]['value'] = 1
+ iterations[level-1]['value'] = 1
+ html_thumbnails += iterations[level-1]['closing']
+ end
end
- iterations[level]['value'] += 1
- if iterations[level]['max'] && iterations[level]['value'] > iterations[level]['max'].to_i
- iterations[level]['value'] = 1
- iterations[level-1]['value'] = 1
- html_thumbnails += iterations[level-1]['closing']
+ if type == 'image'
+ index = images.index(file)
+ html_thumbnails.gsub!(/~~image_iteration~~/,
+ '<a href="image-' + sizeobj['name'] + '.html?current=' + fullscreen_images[sizeobj['name']][index] + '">' +
+ '<img src="' + thumbnail_images[sizeobj['name']][index] + '" border="0"/></a>')
+ html_thumbnails.gsub!(/~~caption_iteration~~/,
+ find_caption_value("#{dir}/#{images[index]}") || images[index])
+ html_thumbnails.gsub!(/~~ifimage\?~~([^~]+)~~/) { $1 }
+ html_thumbnails.gsub!(/~~ifvideo\?~~[^~]+~~/, '')
+ elsif type == 'video'
+ index = videos.index(file)
+ html_thumbnails.gsub!(/~~image_iteration~~/,
+ '<a href="' + videos[index] + '"><img src="' + thumbnail_videos[sizeobj['name']][index] + '" border="0"/></a>')
+ html_thumbnails.gsub!(/~~caption_iteration~~/,
+ find_caption_value("#{dir}/#{videos[index]}") || videos[index])
+ html_thumbnails.gsub!(/~~ifimage\?~~[^~]+~~/, '')
+ html_thumbnails.gsub!(/~~ifvideo\?~~([^~]+)~~/) { $1 }
end
end
- if type == 'image'
- index = images.index(file)
- html_thumbnails.gsub!(/~~image_iteration~~/,
- '<a href="image.html?current=' + fullscreen_images[index] + '"><img src="' + thumbnail_images[index] + '" border="0"/></a>')
- html_thumbnails.gsub!(/~~caption_iteration~~/,
- find_caption_value("#{dir}/#{images[index]}") || images[index])
- html_thumbnails.gsub!(/~~ifimage\?~~([^~]+)~~/) { $1 }
- html_thumbnails.gsub!(/~~ifvideo\?~~[^~]+~~/, '')
- elsif type == 'video'
- index = videos.index(file)
- html_thumbnails.gsub!(/~~image_iteration~~/,
- '<a href="' + videos[index] + '"><img src="' + thumbnail_videos[index] + '" border="0"/></a>')
- html_thumbnails.gsub!(/~~caption_iteration~~/,
- find_caption_value("#{dir}/#{videos[index]}") || videos[index])
- html_thumbnails.gsub!(/~~ifimage\?~~[^~]+~~/, '')
- html_thumbnails.gsub!(/~~ifvideo\?~~([^~]+)~~/) { $1 }
- end
end
+ for level in iterations.keys.sort.reverse
+ html_thumbnails += iterations[level]['closing']
+ end
+ for i in html
+ i.sub!(/~~thumbnails~~/, html_thumbnails)
+ end
+ ios = File.open("#{dest_dir}/index-#{sizeobj['name']}.html", "w")
+ ios.write(html)
+ ios.close
end
- for level in iterations.keys.sort.reverse
- html_thumbnails += iterations[level]['closing']
- end
- for i in html
- i.sub!(/~~thumbnails~~/, html_thumbnails)
- end
- ios = File.open("#{dest_dir}/index.html", "w")
- ios.write(html)
- ios.close
#- image.html (page with fullscreen images)
- html = $html_images.collect { |l| l.clone }
- images4js = fullscreen_images.collect { |e| "\"#{e}\"" }.join(', ')
#- don't ask me why I need so many backslashes... the aim is to print \\\" for each " in the javascript source
captions4js = find_captions(dir, images).collect { |e| e ? '"' + e.gsub('"', '\\\\\\\\\\\\\\\\\"' ) + '"' : '""' }.join(', ')
find_captions(dir, videos) #- dummy for --captions-skel
- for i in html
- i.sub!(/~~images~~/, images4js)
- i.sub!(/~~captions~~/, captions4js)
- i.sub!(/~~title~~/, File.basename(dir))
- i.sub!(/~~thumbnails~~/, _('Return to thumbnails'))
+ for sizeobj in $images_size
+ html = $html_images.collect { |l| l.clone }
+ images4js = fullscreen_images[sizeobj['name']].collect { |e| "\"#{e}\"" }.join(', ')
+ otherimages4js = ''
+ othersizes = []
+ for sizeobj2 in $images_size
+ if sizeobj != sizeobj2
+ otherimages4js += "var images_#{sizeobj2['name']} = new Array(" + fullscreen_images[sizeobj2['name']].collect { |e| "\"#{e}\"" }.join(', ') + ")\n"
+ othersizes << "\"#{sizeobj2['name']}\""
+ end
+ end
+ for i in html
+ i.sub!(/~~images~~/, images4js)
+ i.sub!(/~~other_images~~/, otherimages4js)
+ i.sub!(/~~other_sizes~~/, othersizes.join(', '))
+ i.sub!(/~~captions~~/, captions4js)
+ i.sub!(/~~title~~/, File.basename(dir))
+ i.sub!(/~~thumbnails~~/, '<a href="index-' + sizeobj['name'] + '.html">' + _('Return to thumbnails') + '</a>')
+ for sizeobj2 in $images_size
+ if sizeobj != sizeobj2
+ i.sub!(/~~size_#{sizeobj2['name']}~~/,
+ '<a href="image-' + sizeobj2['name'] + '.html" id="link' + sizeobj2['name'] + '">' + sizenames[sizeobj2['name']] + '</a>')
+ else
+ i.sub!(/~~size_#{sizeobj2['name']}~~/,
+ sizenames[sizeobj2['name']])
+ end
+ end
+ end
+ ios = File.open("#{dest_dir}/image-#{sizeobj['name']}.html", "w")
+ ios.write(html)
+ ios.close
end
- ios = File.open("#{dest_dir}/image.html", "w")
- ios.write(html)
- ios.close
#- copy any resource file that goes with the theme (css, images..)
for entry in Dir.entries("#{$FPATH}/themes/#{$theme}")
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2005-03-05 19:19+0100\n"
-"PO-Revision-Date: 2005-03-05 19:20+0100\n"
+"POT-Creation-Date: 2005-03-06 17:18+0100\n"
+"PO-Revision-Date: 2005-03-06 17:20+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
msgstr "Sélectionner le thème HTML à utiliser"
#: ../booh:45
-msgid "Size of images for `fullscreen' slideshow"
-msgstr "Taille des images pour la présentation plein-écran"
-
-#: ../booh:46
msgid "File containing captions of images"
msgstr "Fichier contenant les légendes des images"
-#: ../booh:47
+#: ../booh:46
msgid "Filename where the script will output a captions skeleton"
msgstr "Nom de fichier à utiliser pour la création du squelette des légendes"
-#: ../booh:49
+#: ../booh:48
msgid "Specify the number of processors for multi-processors machines"
msgstr ""
"Spécifier le nombre de processeurs pour les ordinateurs multi-processeurs"
-#: ../booh:51
+#: ../booh:50
msgid ""
"Set max verbosity level (0: errors, 1: warnings, 2: important messages, 3: "
"other messages)"
"Déterminer le niveau de verbosité maximal (0 : erreurs, 1: avertissements, "
"2 : messages importants, 3 : autres messages)"
-#: ../booh:65
+#: ../booh:69
msgid "Usage: %s [OPTION]..."
msgstr "Utilisation: %s [OPTION]..."
-#: ../booh:74
+#: ../booh:78
msgid "***ERROR***: %s"
msgstr "***ERREUR*** : %s"
-#: ../booh:76
+#: ../booh:80
msgid "Warning: %s"
msgstr "Avertissement : %s"
-#: ../booh:104
+#: ../booh:108
msgid "Argument to --source must be a directory"
msgstr "L'argument de --source doit être un répertoire"
-#: ../booh:109
+#: ../booh:113
msgid "If --destination exists, it must be a directory"
msgstr "Si --destination existe, il doit être un répertoire"
-#: ../booh:122
+#: ../booh:124
msgid "Captions file does not exist or is unreadable."
msgstr "Le fichier de légendes n'existe pas ou est non lisible."
-#: ../booh:126
+#: ../booh:128
msgid "Captions skeleton file already exists, wont overwrite"
msgstr ""
"Le fichier pour le squelette de légendes existe déjà, et je ne vais pas le "
"remplacer"
-#: ../booh:147
+#: ../booh:149
msgid "Missing --source parameter."
msgstr "Il manque le paramètre --source."
-#: ../booh:150
+#: ../booh:152
msgid "Missing --destination parameter."
msgstr "Il manque le paramètre --destination."
-#: ../booh:159
-msgid "Size %s not found in parameters of theme."
-msgstr "Taille %s non trouvée dans les paramètres du thème."
+#: ../booh:163
+msgid "Selecting theme `%s'"
+msgstr "Sélection du thème `%s'"
-#: ../booh:162
-msgid "Using size for fullscreen images of value: %s"
-msgstr "Utilisation de la taille pour images plein-écran de valeur : %s"
-
-#: ../booh:170
+#: ../booh:166
msgid "Theme was not found (tried %s directory)."
msgstr "Thème non trouvé (le répertoire %s a été essayé)."
-#: ../booh:180
-msgid "Unrecognized line in %s: %s"
-msgstr "Ligne non reconnue dans %s : %s"
-
-#: ../booh:191
+#: ../booh:186
msgid ""
"The `%s' program is typically needed. Re-run with --no-check if you're sure "
"you're fine without it."
"Le programme `%s' est typiquement nécessaire. Relancez avec --no-check si "
"vous êtes sûr que vous n'en aurez pas besoin."
-#: ../booh:201
+#: ../booh:196
msgid "No `%s' found for substitution"
msgstr "`%s' non trouvé pour substitution"
-#: ../booh:207
-msgid "Read theme `%s'"
-msgstr "Lecture du thème `%s'"
+#: ../booh:267
+msgid "Handling %s from captions list..."
+msgstr "Prise en charge de %s selon la liste des légendes..."
-#: ../booh:247
+#: ../booh:272
msgid "Examining %s..."
msgstr "Examen de %s..."
-#: ../booh:249
+#: ../booh:276
msgid "\t%s images"
msgstr "\t%s images"
-#: ../booh:251
+#: ../booh:278
msgid "\t%s videos"
msgstr "\t%s vidéos"
-#: ../booh:255
+#: ../booh:282
msgid "Outputting in %s..."
msgstr "Écriture dans %s..."
-#: ../html_merges.rb:231 ../html_merges.rb:265
+#: ../booh:349
+msgid "small"
+msgstr "petit"
+
+#: ../booh:349
+msgid "medium"
+msgstr "moyen"
+
+#: ../booh:349
+msgid "large"
+msgstr "grand"
+
+#: ../booh:356 ../html_merges.rb:262 ../html_merges.rb:296
msgid "Run slideshow!"
msgstr "Lancer la présentation !"
-#: ../html_merges.rb:232
+#: ../booh:465
+msgid "Return to thumbnails"
+msgstr "Retourner aux vignettes"
+
+#: ../html_merges.rb:263
msgid "Stop slideshow"
msgstr "Arrêter la présentation"
-#: ../html_merges.rb:241
+#: ../html_merges.rb:272
msgid "<<- First"
msgstr "<<- Premier"
-#: ../html_merges.rb:247
+#: ../html_merges.rb:278
msgid "<- Previous"
msgstr "<- Précédent"
-#: ../html_merges.rb:253
+#: ../html_merges.rb:284
msgid "Next ->"
msgstr "Prochain ->"
-#: ../html_merges.rb:259
+#: ../html_merges.rb:290
msgid "Last ->>"
msgstr "Dernier ->>"
+