From: gc Date: Sat, 5 Nov 2005 21:21:09 +0000 (+0000) Subject: remove removed subdirectories from config on --merge-config X-Git-Tag: 0.9.0~338 X-Git-Url: http://git.zarb.org/?p=booh;a=commitdiff_plain;h=f0d0813c189d4b3b94953e1eecf7eb7b2e7d9934 remove removed subdirectories from config on --merge-config --- diff --git a/bin/booh b/bin/booh index ce5ba1e..aff026b 100755 --- a/bin/booh +++ b/bin/booh @@ -3313,7 +3313,7 @@ def create_menu_and_toolbar tooltips.set_tip($merge_newsubs, utf8(_("Take into account new subalbums in currently viewed subalbum (and only here)")), nil) filesubmenu.append($merge = Gtk::ImageMenuItem.new(utf8(_("Scan source directory to merge new subalbums and new/removed images/videos"))).set_sensitive(false)) $merge.image = Gtk::Image.new("#{$FPATH}/images/stock-reset-16.png") - tooltips.set_tip($merge, utf8(_("Take into account new subalbums (subdirectories) and new/removed images/videos in existing subalbums (anywhere)")), nil) + tooltips.set_tip($merge, utf8(_("Take into account new/removed subalbums (subdirectories) and new/removed images/videos in existing subalbums (anywhere)")), nil) filesubmenu.append( Gtk::SeparatorMenuItem.new) filesubmenu.append($generate = Gtk::ImageMenuItem.new(utf8(_("Generate web-album"))).set_sensitive(false)) $generate.image = Gtk::Image.new("#{$FPATH}/images/stock-web-16.png") diff --git a/bin/booh-backend b/bin/booh-backend index bcb7fb3..3e090fb 100755 --- a/bin/booh-backend +++ b/bin/booh-backend @@ -43,7 +43,7 @@ $options = [ [ '--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") ], [ '--config-skel', '-k', GetoptLong::REQUIRED_ARGUMENT, _("Filename where the script will output a config skeleton") ], - [ '--merge-config', '-M', GetoptLong::REQUIRED_ARGUMENT, _("File containing config listing, where to merge new images/videos from --source, and change theme info") ], + [ '--merge-config', '-M', GetoptLong::REQUIRED_ARGUMENT, _("File containing config listing, where to merge new/removed images/videos from --source, and change theme info") ], [ '--merge-config-onedir', '-O', GetoptLong::REQUIRED_ARGUMENT, _("File containing config listing, for merging the subdir specified with --dir") ], [ '--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") ], @@ -590,12 +590,19 @@ def walk_source_dir elsif $mode == 'merge_config_subdirs' examined_dirs = `find '#{$onedir}' -type d -follow`.sort.collect { |v| v.chomp }.delete_if { |v| optxpath.has_key?(utf8(v)) } else - examined_dirs = `find '#{$source}' -type d -follow`.sort + examined_dirs = `find '#{$source}' -type d -follow`.sort.collect { |v| v.chomp } + if $mode == 'merge_config' + $xmldoc.elements.each('//dir') { |elem| + if ! examined_dirs.include?(elem.attributes['path']) + msg 2, _("Merging config: removing directory %s from config, isn't on filesystem anymore") % elem.attributes['path'] + elem.remove + end + } + end end info("directories: #{examined_dirs.length}, sizes: #{$images_size.length}") examined_dirs.each { |dir| - dir.chomp! if File.basename(dir) =~ /^\./ msg 1, _("Ignoring directory %s, begins with a dot (indicating a hidden directory)") % dir next @@ -997,7 +1004,6 @@ def walk_source_dir } examined_dirs.each { |dir| - dir.chomp! info("index.html: #{dir}|#{$source}") xmldir = optxpath[utf8(dir)]