if $config['mproc']
options += "--mproc #{$config['mproc'].to_i} "
end
- options += "--comments-format '#{$config['comments-format']}'"
+ options += "--comments-format '#{$config['comments-format']}' "
+ if $config['transcode-videos']
+ options += "--transcode-videos '#{$config['transcode-videos']}' "
+ end
return options
end
tooltips.set_tip(deleteondisk_check, utf8(_("Normally, deleting an image or video in booh only removes it from the web-album. If you check this option, the original file in source directory will be removed as well. Undo is possible, since actual deletion is performed only when web-album is saved.")), nil)
smp_check.signal_connect('toggled') {
- if smp_check.active?
- smp_hbox.sensitive = true
- else
- smp_hbox.sensitive = false
- end
+ smp_hbox.sensitive = smp_check.active?
}
if $config['mproc']
smp_check.active = true
FileSource
SceneType")), { :scrolled => true })
}
-
tbl.attach(update_exif_orientation_check = Gtk::CheckButton.new(utf8(_("Update file's EXIF orientation when rotating a picture"))),
0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK, 2, 2)
tooltips.set_tip(update_exif_orientation_check, utf8(_("When rotating a picture (Alt-Right/Left), also update EXIF orientation in the file itself")), nil)
update_exif_orientation_check.active = $config['rotate-set-exif'] == 'true'
+ tbl.attach(transcode_videos = Gtk::CheckButton.new(utf8(_("Transcode videos"))).set_active(!$config['transcode-videos'].nil?),
+ 0, 1, 3, 4, Gtk::FILL, Gtk::SHRINK, 2, 2)
+ transcode_videos.active = ! $config['transcode-videos'].nil?
+ tbl.attach(transcode_videos_command = Gtk::Entry.new.set_text($config['transcode-videos'] || 'avi:mencoder -nosound -ovc xvid -xvidencopts bitrate=800:me_quality=6 -o %o %f'),
+ 1, 2, 3, 4, Gtk::FILL, Gtk::SHRINK, 2, 2)
+ tooltips.set_tip(transcode_videos, utf8(_("First put the extension of the output video and a colon; then use %f to specify the input and %o the output;
+for example: avi:mencoder -nosound -ovc xvid -xvidencopts bitrate=800:me_quality=6 -o %o %f")), nil)
+ transcode_videos.signal_connect('toggled') {
+ transcode_videos_command.sensitive = transcode_videos.active?
+ }
+ transcode_videos_command.sensitive = transcode_videos.active?
dialog.vbox.show_all
dialog.run { |response|
$config['convert-enhance'] = from_utf8(enhance_entry.text)
$config['comments-format'] = from_utf8(commentsformat_entry.text.gsub(/'/, ''))
$config['rotate-set-exif'] = update_exif_orientation_check.active?.to_s
+ if transcode_videos.active?
+ $config['transcode-videos'] = transcode_videos_command.text
+ else
+ $config.delete('transcode-videos')
+ end
end
}
dialog.destroy
#- options
$options = [
- [ '--help', '-h', GetoptLong::NO_ARGUMENT, _("Get help message") ],
- [ '--version', '-V', GetoptLong::NO_ARGUMENT, _("Print version and exit") ],
+ [ '--help', '-h', GetoptLong::NO_ARGUMENT, _("Get help message") ],
+ [ '--version', '-V', GetoptLong::NO_ARGUMENT, _("Print version and exit") ],
[ '--source', '-s', GetoptLong::REQUIRED_ARGUMENT, _("Directory which contains original images/videos as files or subdirs") ],
[ '--destination', '-d', GetoptLong::REQUIRED_ARGUMENT, _("Directory which will contain the web-album") ],
-# [ '--clean', '-c', GetoptLong::NO_ARGUMENT, _("Clean destination directory") ],
[ '--theme', '-t', GetoptLong::REQUIRED_ARGUMENT, _("Select HTML theme to use") ],
[ '--config', '-C', GetoptLong::REQUIRED_ARGUMENT, _("File containing config listing images and videos within directories with captions") ],
[ '--merge-config-subdirs', '-U', GetoptLong::REQUIRED_ARGUMENT, _("File containing config listing, for merging the new subdirs down the subdir specified with --dir") ],
[ '--dir', '-D', GetoptLong::REQUIRED_ARGUMENT, _("Directory for merge with --merge-config-onedir or --merge-config-subdirs") ],
[ '--use-config', '-u', GetoptLong::REQUIRED_ARGUMENT, _("File containing config listing, where to change theme info") ],
- [ '--force', '-f', GetoptLong::NO_ARGUMENT, _("Force generation of album even if the GUI marked some directories as already generated") ],
+ [ '--force', '-f', GetoptLong::NO_ARGUMENT, _("Force generation of album even if the GUI marked some directories as already generated") ],
[ '--sizes', '-S', GetoptLong::REQUIRED_ARGUMENT, _("Specify the list of images sizes to use instead of all specified in the theme (this is a comma-separated list)") ],
[ '--multi-languages', '-L', GetoptLong::REQUIRED_ARGUMENT, _("Specify the list of languages to support (uses Apache MultiViews); this is a comma-separated list of supported languages, with last element used as the fallback language; for example: 'fr,eo,en,en'; supported languages: %s") % SUPPORTED_LANGUAGES.join(', ') ],
[ '--thumbnails-per-row', '-T', GetoptLong::REQUIRED_ARGUMENT, _("Specify the amount of thumbnails per row in the thumbnails page (if applicable in theme)") ],
[ '--thumbnails-per-page', '-p', GetoptLong::REQUIRED_ARGUMENT, _("Specify the amount of thumbnails per page in the thumbnails page, after which split occurs") ],
- [ '--optimize-for-32', '-o', GetoptLong::NO_ARGUMENT, _("Resize images with optimized sizes for 3/2 aspect ratio rather than 4/3 (typical aspect ratio of pictures from non digital cameras are 3/2 when pictures from digital cameras are 4/3)") ],
+ [ '--optimize-for-32', '-o', GetoptLong::NO_ARGUMENT, _("Resize images with optimized sizes for 3/2 aspect ratio rather than 4/3 (typical aspect ratio of pictures from non digital cameras are 3/2 when pictures from digital cameras are 4/3)") ],
+ [ '--transcode-videos', '-r', GetoptLong::REQUIRED_ARGUMENT, _("Transcode videos with given external program; %f is the placeholder for the input video, %o for the output video; before the external program, the output video extension should be given followed by a colon") ],
[ '--index-link', '-l', GetoptLong::REQUIRED_ARGUMENT, _("Specify the HTML markup to use on the bottom of pages for a small link returning to wherever you see fit in your website (or somewhere else)") ],
[ '--made-with', '-n', GetoptLong::REQUIRED_ARGUMENT, _("Specify the HTML markup to use on the bottom of pages for a small 'made with' message") ],
[ '--comments-format','-c', GetoptLong::REQUIRED_ARGUMENT, _("Specify comments format to use for images instead of only filename when creating new albums; use ImageMagick's format") ],
when '--optimize-for-32'
$optimize_for_32 = true
+ when '--transcode-videos'
+ parts = arg.split(':', 2)
+ if parts.size != 2 || parts[0] =~ / / || arg !~ /%f/ || arg !~ /%o/
+ die _("--transcode-videos: argument must be the external program for transcoding, and contain %f for the input video, %o for the output video, and before the external program, the output video extension should be given followed by a colon")
+ end
+ $transcode_videos = arg
+
when '--made-with'
$madewith = arg
select_theme($theme, $limit_sizes, $optimize_for_32, $N_per_row)
if !$xmldoc
- additional_params = ''
+ $xmldoc = Document.new "<booh/>"
+ $xmldoc << XMLDecl.new(XMLDecl::DEFAULT_VERSION, $CURRENT_CHARSET)
+ $xmldoc.root.add_attribute('version', $VERSION)
+ $xmldoc.root.add_attribute('source', $source)
+ $xmldoc.root.add_attribute('destination', $dest)
+ $xmldoc.root.add_attribute('theme', $theme)
if $limit_sizes
- additional_params += "limit-sizes='#{$limit_sizes}'"
+ $xmldoc.root.add_attribute('limit-sizes', $limit_sizes)
end
if $multi_languages
- additional_params += " multi-languages='#{$multi_languages[0].join(',')},#{$multi_languages[1]}'"
+ $xmldoc.root.add_attribute('multi-languages', $multi_languages[0].join(',') + ',' + $multi_languages[1])
end
if $optimize_for_32
- additional_params += " optimize-for-32='true'"
+ $xmldoc.root.add_attribute('optimize-for-32', true)
end
if $N_per_row
- additional_params += " thumbnails-per-row='#{$N_per_row}'"
+ $xmldoc.root.add_attribute('thumbnails-per-row', $N_per_row)
end
if $N_per_page
- additional_params += " thumbnails-per-page='#{$N_per_page}'"
+ $xmldoc.root.add_attribute('thumbnails-per-page', $N_per_page)
end
if $madewith
- additional_params += " made-with='#{$madewith}'"
+ $xmldoc.root.add_attribute('made-with', $madewith)
end
if $indexlink
- additional_params += " index-link='#{$indexlink}'"
+ $xmldoc.root.add_attribute('index-link', $indexlink)
end
- $xmldoc = Document.new "<booh version='#{$VERSION}' source='#{utf8($source)}' destination='#{utf8($dest)}' theme='#{$theme}' #{additional_params}/>"
- $xmldoc << XMLDecl.new(XMLDecl::DEFAULT_VERSION, $CURRENT_CHARSET)
$mode = 'gen_config'
end
end
end
+ if $transcode_videos
+ $xmldoc.root.add_attribute('transcode-videos', $transcode_videos)
+ else
+ $xmldoc.root.delete_attribute('transcode-videos')
+ end
+
if $madewith
$madewith = $madewith.gsub('%booh', '"http://booh.org/"')
end
}
videos.size >= 1 and msg 3, _("\tcreating videos thumbnails...")
+ transcoded_videos = {}
#- create thumbnails for videos
videos.each { |video|
todo << { 'filename' => thumbnail_dest_img, 'size' => size_thumbnails }
end
gen_thumbnails_element("#{dir}/#{video}", xmldir, true, todo)
- end
- destvideo = "#{dest_dir}/#{video}"
- if !File.exists?(destvideo)
- if $hardlinks_ok
- if ! sys("ln '#{dir}/#{video}' '#{destvideo}'")
- $hardlinks_ok = false
+
+ if $transcode_videos
+ parts = $transcode_videos.split(':', 2)
+ basedestvideo = video.sub(/\.\w+/, '') + '.' + parts[0]
+ transcoded_videos[video] = basedestvideo
+ destvideo = "#{dest_dir}/#{basedestvideo}"
+ if ! File.exists?(destvideo)
+ psys(parts[1].gsub(/%f/, "'#{dir}/#{video}'").gsub(/%o/, "'#{destvideo}'"))
+ end
+ else
+ destvideo = "#{dest_dir}/#{video}"
+ if ! File.exists?(destvideo)
+ if $hardlinks_ok
+ if ! sys("ln '#{dir}/#{video}' '#{destvideo}'")
+ $hardlinks_ok = false
+ end
+ end
+ if ! $hardlinks_ok
+ psys("cp '#{dir}/#{video}' '#{destvideo}'")
+ end
end
- end
- if ! $hardlinks_ok
- psys("cp '#{dir}/#{video}' '#{destvideo}'")
end
end
}
all_elements = fullscreen_images.collect { |e| e[1] }.flatten.
concat(thumbnail_images.collect { |e| e[1] }.flatten).
concat(thumbnail_videos.collect { |e| e[1] }.flatten).
- concat(videos).
+ concat($transcode_videos ? transcoded_videos.values : videos).
push('.htaccess')
to_del = Dir.entries(dest_dir).find_all { |e| !File.directory?(File.join(dest_dir, e)) && !all_elements.include?(e) && e !~ /^thumbnails-\w+\.jpg/ } - themestuff - themestuff_root
if to_del.size > 0
index = videos.index(file)
if File.exists?("#{dest_dir}/#{thumbnail_videos[sizeobj['name']][index]}")
html_elem.gsub!(/~~image_iteration~~/,
- '<a href="' + videos[index] + '">' + img_element("#{dest_dir}/#{thumbnail_videos[sizeobj['name']][index]}") + '</a>')
+ '<a href="' + ( $transcode_videos ? transcoded_videos[videos[index]] : videos[index] ) + '">' +
+ img_element("#{dest_dir}/#{thumbnail_videos[sizeobj['name']][index]}") + '</a>')
else
html_elem.gsub!(/~~image_iteration~~/,
- '<a href="' + videos[index] + '">' + defer_translation(N_("(no preview)")) + '</a>')
+ '<a href="' + ( $transcode_videos ? transcoded_videos[videos[index]] : videos[index] ) + '">' +
+ defer_translation(N_("(no preview)")) + '</a>')
end
html_elem.gsub!(/~~caption_iteration~~/, find_caption_value(xmldir, videos[index]) || utf8(videos[index]))
html_elem.gsub!(/~~ifimage\?~~(.+?)~~fi~~/, '')