Skip to content

Commit

Permalink
* Change 'help' and 'version' instance method to class method on
Browse files Browse the repository at this point in the history
   RbPhoto::Import class
 * Change load timing for gtk library
  • Loading branch information
tach committed Jun 8, 2009
1 parent 0abfa97 commit fc46be2
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 36 deletions.
10 changes: 9 additions & 1 deletion bin/rbphoto-import
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# $Id$

require 'rbphoto/import'
require 'gtk2'

class RbPhoto
class Import
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -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 <[email protected]> Mon, 08 Jun 2009 22:24:58 +0900
-- Taku YASUI <[email protected]> Mon, 08 Jun 2009 22:27:19 +0900

rbphoto (0.2.0) unstable; urgency=low

Expand Down
68 changes: 34 additions & 34 deletions lib/rbphoto/import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
require 'find'
require 'exif'
require 'gettext'
require 'gtk2'
require 'rbphoto'

class Exif
Expand All @@ -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 <[email protected]>
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)
Expand Down Expand Up @@ -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 <[email protected]>
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
Expand Down

0 comments on commit fc46be2

Please sign in to comment.