From fc46be28f5b7dc98d05a517e4e6bb57359dbaf4d Mon Sep 17 00:00:00 2001 From: Taku YASUI Date: Mon, 8 Jun 2009 13:28:44 +0000 Subject: [PATCH] * Change 'help' and 'version' instance method to class method on RbPhoto::Import class * Change load timing for gtk library --- bin/rbphoto-import | 10 ++++++- debian/changelog | 5 +++- lib/rbphoto/import.rb | 68 +++++++++++++++++++++---------------------- 3 files changed, 47 insertions(+), 36 deletions(-) diff --git a/bin/rbphoto-import b/bin/rbphoto-import index c33ab80..a80fe73 100755 --- a/bin/rbphoto-import +++ b/bin/rbphoto-import @@ -20,7 +20,6 @@ # $Id$ require 'rbphoto/import' -require 'gtk2' class RbPhoto class Import @@ -204,9 +203,18 @@ end def main opt = RbPhoto::Import::Options.new + if (opt.help) + print RbPhoto::Import.help + exit + elsif (opt.version) + print RbPhoto::Import.version + exit + end + if ( opt.no_gui || ARGV.size >= 3 ) RbPhoto::Import::Cui.new(opt) else + require 'gtk2' RbPhoto::Import::Gui.new(opt) end end diff --git a/debian/changelog b/debian/changelog index bab4f62..fd737c6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,11 @@ rbphoto (0.2.1) unstable; urgency=low * Change maintainer email address + * Change 'help' and 'version' instance method to class method on + RbPhoto::Import class + * Change load timing for gtk library - -- Taku YASUI Mon, 08 Jun 2009 22:24:58 +0900 + -- Taku YASUI Mon, 08 Jun 2009 22:27:19 +0900 rbphoto (0.2.0) unstable; urgency=low diff --git a/lib/rbphoto/import.rb b/lib/rbphoto/import.rb index 7c38efb..27ca052 100755 --- a/lib/rbphoto/import.rb +++ b/lib/rbphoto/import.rb @@ -24,7 +24,6 @@ require 'find' require 'exif' require 'gettext' -require 'gtk2' require 'rbphoto' class Exif @@ -39,17 +38,40 @@ class RbPhoto class Import include GetText bindtextdomain("rbphoto") + + def self.help + return <<_EOT +Usage: #{$0} [options] src_(dir|file)[s]... target_dir +Copy photo image from src to target. it renames photo file name +not to duplicate by its exif data. + +Options: + -D, --datedir copy/move photos with datedir + -f, --force force to overwrite when move + -G, --no-gui disable GTK2+ graphical interface + -m, --move move photos instead of copy + -M, --with-movie process not only images but also movies + -N, --without-rename do not rename photo files + -p, --photographer=id set photographer id (default: $USER) + -n, --no-act do not copy/move only test + -h, --help show this help + -v, --verbose make verbose output + -V, --version show software version +_EOT + end + + def self.version + return <<_EOT +Robust Photo management tool (import) #{RbPhoto::VERSION} + +Copyright (C) Taku YASUI +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +_EOT + end def initialize(opt) @opt = opt - - if ( @opt.version ) - print self.version - exit - elsif ( @opt.help ) - print self.help - exit - end end def show_error(str) @@ -149,35 +171,13 @@ def rename(filename) datedir = '/' + time.strftime('%Y-%m-%d') if ( @opt.datedir ) return @dstdir + datedir + "/#{time.strftime('%Y%m%d-%H%M%S')}#{@postfix}.#{suffix}" end - - def help - return <<_EOT -Usage: #{$0} [options] src_(dir|file)[s]... target_dir -Copy photo image from src to target. it renames photo file name -not to duplicate by its exif data. -Options: - -D, --datedir copy/move photos with datedir - -f, --force force to overwrite when move - -m, --move move photos instead of copy - -M, --with-movie process not only images but also movies - -N, --without-rename do not rename photo files - -p, --photographer=id set photographer id (default: $USER) - -n, --no-act do not copy/move only test - -h, --help show this help - -v, --verbose make verbose output - -V, --version show software version -_EOT + def help + self.class.help end def version - return <<_EOT -Robust Photo management tool (import) #{RbPhoto::VERSION} - -Copyright (C) Taku YASUI -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -_EOT + self.class.version end class Options < Hash