tallakt-picsort 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (8) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +22 -0
  4. data/README.rdoc +16 -0
  5. data/Rakefile +55 -0
  6. data/VERSION +1 -0
  7. data/bin/picsort +49 -0
  8. metadata +81 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (THE MIT LICENSE)
2
+
3
+ Copyright (c) 2009 Tallak Tveide
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,16 @@
1
+ = tallakt-picsort
2
+
3
+ A script to move image files to folders with the same name as image date
4
+
5
+ = Example
6
+
7
+ picsort --base /my/picture/folder/ temp/folder/*.jpg /temp/folder/*.cr2
8
+
9
+ The script will look at the EXIF information in each image file ad determine
10
+ the name of the folder where it should reside.
11
+
12
+ This works much like the Canon USB import driver on windows
13
+
14
+ == Copyright
15
+
16
+ Copyright (c) 2009 Tallak Tveide. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "tallakt-picsort"
8
+ gem.summary = %Q{Move image files to folders based on exif date}
9
+ gem.description = %Q{A simple command line utility that reads the date of image files ans moves them to a folder with the same name aas the ate}
10
+ gem.email = "tallak@tveide.net"
11
+ gem.homepage = "http://github.com/tallakt/tallakt-picsort"
12
+ gem.authors = ["Tallak Tveide"]
13
+ gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
+ gem.executables = ["picsort"]
15
+ gem.add_runtime_dependency(%q<exifr>, [">= 0.10.8"])
16
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
+ end
18
+ Jeweler::GemcutterTasks.new
19
+ rescue LoadError
20
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
21
+ end
22
+
23
+ require 'rake/testtask'
24
+ Rake::TestTask.new(:test) do |test|
25
+ test.libs << 'lib' << 'test'
26
+ test.pattern = 'test/**/test_*.rb'
27
+ test.verbose = true
28
+ end
29
+
30
+ begin
31
+ require 'rcov/rcovtask'
32
+ Rcov::RcovTask.new do |test|
33
+ test.libs << 'test'
34
+ test.pattern = 'test/**/test_*.rb'
35
+ test.verbose = true
36
+ end
37
+ rescue LoadError
38
+ task :rcov do
39
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
40
+ end
41
+ end
42
+
43
+ task :test => :check_dependencies
44
+
45
+ task :default => :test
46
+
47
+ require 'rake/rdoctask'
48
+ Rake::RDocTask.new do |rdoc|
49
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "tallakt-picsort #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/picsort ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'exifr'
5
+ require 'fileutils'
6
+ require 'optparse'
7
+
8
+ options = {:base => '.'}
9
+ opts = OptionParser.new do |opts|
10
+ opts.banner = "Usage: picsort [options] <files>"
11
+
12
+ opts.on("-b", "--base BASEDIR", "Base folder (default: current path)") do |v|
13
+ p 'BASE ' + v
14
+ options[:base] = v
15
+ end
16
+ # No argument, shows at tail. This will print an options summary.
17
+ # Try it and see!
18
+ opts.on_tail("-h", "--help", "Show this message") do
19
+ puts opts
20
+ exit
21
+ end
22
+ end.parse!
23
+
24
+
25
+ ARGV.each do |imgfile|
26
+ begin
27
+ date = nil
28
+ begin
29
+ date = EXIFR::JPEG.new(imgfile).date_time
30
+ rescue
31
+ date = EXIFR::TIFF.new(imgfile).date_time
32
+ end
33
+
34
+ foldername = File.join(options[:base], '%04i_%02i_%02i' % [date.year, date.month, date.day])
35
+ newfilename = File.join(foldername, File.split(imgfile).last)
36
+
37
+ if File.expand_path(imgfile) != File.expand_path(newfilename)
38
+ puts '%s -> %s' % [imgfile, newfilename]
39
+
40
+ FileUtils.mkdir_p foldername
41
+ FileUtils.mv imgfile, newfilename, :force => true
42
+ end
43
+ rescue RuntimeError
44
+ # ok.. no info available
45
+ rescue
46
+ $stderr.puts $!
47
+ end
48
+ end
49
+
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tallakt-picsort
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tallak Tveide
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-11-10 00:00:00 +01:00
13
+ default_executable: picsort
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: thoughtbot-shoulda
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: exifr
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.10.8
34
+ version:
35
+ description: A simple command line utility that reads the date of image files ans moves them to a folder with the same name aas the ate
36
+ email: tallak@tveide.net
37
+ executables:
38
+ - picsort
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.rdoc
44
+ files:
45
+ - .document
46
+ - .gitignore
47
+ - LICENSE
48
+ - README.rdoc
49
+ - Rakefile
50
+ - VERSION
51
+ - bin/picsort
52
+ has_rdoc: true
53
+ homepage: http://github.com/tallakt/tallakt-picsort
54
+ licenses: []
55
+
56
+ post_install_message:
57
+ rdoc_options:
58
+ - --charset=UTF-8
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: "0"
66
+ version:
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: "0"
72
+ version:
73
+ requirements: []
74
+
75
+ rubyforge_project:
76
+ rubygems_version: 1.3.5
77
+ signing_key:
78
+ specification_version: 3
79
+ summary: Move image files to folders based on exif date
80
+ test_files: []
81
+