@@ -24,7 +24,6 @@ | ||
24 | 24 | require 'find' |
25 | 25 | require 'exif' |
26 | 26 | require 'gettext' |
27 | -require 'gtk2' | |
28 | 27 | require 'rbphoto' |
29 | 28 | |
30 | 29 | class Exif |
@@ -39,17 +38,40 @@ | ||
39 | 38 | class Import |
40 | 39 | include GetText |
41 | 40 | bindtextdomain("rbphoto") |
41 | + | |
42 | + def self.help | |
43 | + return <<_EOT | |
44 | +Usage: #{$0} [options] src_(dir|file)[s]... target_dir | |
45 | +Copy photo image from src to target. it renames photo file name | |
46 | +not to duplicate by its exif data. | |
42 | 47 | |
48 | +Options: | |
49 | + -D, --datedir copy/move photos with datedir | |
50 | + -f, --force force to overwrite when move | |
51 | + -G, --no-gui disable GTK2+ graphical interface | |
52 | + -m, --move move photos instead of copy | |
53 | + -M, --with-movie process not only images but also movies | |
54 | + -N, --without-rename do not rename photo files | |
55 | + -p, --photographer=id set photographer id (default: $USER) | |
56 | + -n, --no-act do not copy/move only test | |
57 | + -h, --help show this help | |
58 | + -v, --verbose make verbose output | |
59 | + -V, --version show software version | |
60 | +_EOT | |
61 | + end | |
62 | + | |
63 | + def self.version | |
64 | + return <<_EOT | |
65 | +Robust Photo management tool (import) #{RbPhoto::VERSION} | |
66 | + | |
67 | +Copyright (C) Taku YASUI <tach@debian.or.jp> | |
68 | +This is free software; see the source for copying conditions. There is NO | |
69 | +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
70 | +_EOT | |
71 | + end | |
72 | + | |
43 | 73 | def initialize(opt) |
44 | 74 | @opt = opt |
45 | - | |
46 | - if ( @opt.version ) | |
47 | - print self.version | |
48 | - exit | |
49 | - elsif ( @opt.help ) | |
50 | - print self.help | |
51 | - exit | |
52 | - end | |
53 | 75 | end |
54 | 76 | |
55 | 77 | def show_error(str) |
@@ -149,35 +171,13 @@ | ||
149 | 171 | datedir = '/' + time.strftime('%Y-%m-%d') if ( @opt.datedir ) |
150 | 172 | return @dstdir + datedir + "/#{time.strftime('%Y%m%d-%H%M%S')}#{@postfix}.#{suffix}" |
151 | 173 | end |
152 | - | |
174 | + | |
153 | 175 | def help |
154 | - return <<_EOT | |
155 | -Usage: #{$0} [options] src_(dir|file)[s]... target_dir | |
156 | -Copy photo image from src to target. it renames photo file name | |
157 | -not to duplicate by its exif data. | |
158 | - | |
159 | -Options: | |
160 | - -D, --datedir copy/move photos with datedir | |
161 | - -f, --force force to overwrite when move | |
162 | - -m, --move move photos instead of copy | |
163 | - -M, --with-movie process not only images but also movies | |
164 | - -N, --without-rename do not rename photo files | |
165 | - -p, --photographer=id set photographer id (default: $USER) | |
166 | - -n, --no-act do not copy/move only test | |
167 | - -h, --help show this help | |
168 | - -v, --verbose make verbose output | |
169 | - -V, --version show software version | |
170 | -_EOT | |
176 | + self.class.help | |
171 | 177 | end |
172 | 178 | |
173 | 179 | def version |
174 | - return <<_EOT | |
175 | -Robust Photo management tool (import) #{RbPhoto::VERSION} | |
176 | - | |
177 | -Copyright (C) Taku YASUI <tach@debian.or.jp> | |
178 | -This is free software; see the source for copying conditions. There is NO | |
179 | -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
180 | -_EOT | |
180 | + self.class.version | |
181 | 181 | end |
182 | 182 | |
183 | 183 | class Options < Hash |