photo_rename 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3031e21de21dd1b1fa98a72a93c878d03a276618
4
- data.tar.gz: aebd139a00bf7f82199d1bd5ea64bea4f6c429fb
3
+ metadata.gz: 2ec86080ae15389f539c47aafc0f780d795319c7
4
+ data.tar.gz: 03d2696d36dcb5090c4fea24246d2a1a7d8d5a63
5
5
  SHA512:
6
- metadata.gz: 7151029179326ef1a2e5c7af235403ea29942fee08a172be07f90041636a2e62521375bd7b15d86e45a6287da3ede278e7d1f78c30938e517713ec6c971cb4ed
7
- data.tar.gz: e253aafc4f37365235c3c05749add37dad2a882663bc06710165a18195509a119adbf0c946265e2c3e5d4ac95865fd86591cc556bc3e3ce7a0112edbf7ee9e42
6
+ metadata.gz: 9e1543cfc677fa16d43663658a5da164e280ab69f29c5e51f5e9c22d93f9111469546df1841d2d660df6efa104560cd10c69e05cc8796a015c14587e78e29cdb
7
+ data.tar.gz: 3d14851a6b3fa6f2fe52d73dc9d2de3c9e199268edbe2eca1e8daa155c80bb2a7dfd8f55682ab19078773fec012a79c27f06a3a12ca98e72f3d82d37186eed61
data/Gemfile CHANGED
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in photo_rename.gemspec
4
4
  gemspec
5
- gem "awesome_print"
5
+ gem 'awesome_print' , '~> 1.2.0'
data/README.org CHANGED
@@ -1,4 +1,5 @@
1
1
  * Photo Renamer
2
+
2
3
  ** What the script does
3
4
  This script is fairly specific. It renames all JPG files (technically files with a .jpg or .jpeg extenstion) in a given directory to the form IMG_*yyyymmdd*_*hhmmss*.jpg
4
5
 
@@ -12,8 +13,26 @@ After some experimenting I found that if I copy photos from my camera's memory c
12
13
  *IMPORTANT NOTE*
13
14
  Since I am renaming files based on the date created by the device that captured the image, this device's date should be correctly set. (For the next release I want to add more options to manually set the date)
14
15
 
16
+ ** Install
17
+ The easiest way to install the script is by using rubygems.
18
+ #+begin_src bash
19
+ gem install photo_rename
20
+ #+end_src
21
+
22
+ [[./screenshots/install.png]]
23
+
15
24
  ** Usage
16
- [[./screenshots/2014-07-05-135037_818x747_scrot.png]]
25
+ #+begin_src bash
26
+ photo_rename photo_directory
27
+ #+end_src
28
+
29
+ [[./screenshots/example.png]]
30
+ ** Release notes
31
+ *** 0.0.4
32
+ - Do not rename files that are already in the correct format.
33
+
34
+ *** 0.0.1 - 0.0.3
35
+ - Sort out teething problems with gem.
17
36
 
18
37
  ** GNU GPL
19
38
  This program is licensed under [(http://www.gnu.org/licenses/gpl-3.0.txt)[GNU GPL]]
data/bin/photo_rename CHANGED
@@ -5,7 +5,7 @@ require 'photo_rename'
5
5
  def main()
6
6
  photo_rename = Photo_rename.new()
7
7
  ARGV.length == 0 ? print_opts = true : print_opts = false
8
- opts = photo_rename.parse_options(print_opts)
8
+ photo_rename.parse_options(print_opts)
9
9
 
10
10
  ARGV.each do |arg|
11
11
  map = photo_rename.name_map(arg)
data/lib/photo_rename.rb CHANGED
@@ -17,7 +17,7 @@
17
17
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
 
19
19
  require 'optparse'
20
- require "rubygems"
20
+ require 'rubygems'
21
21
  require 'awesome_print'
22
22
 
23
23
  class Photo_rename
@@ -30,20 +30,28 @@ class Photo_rename
30
30
  end
31
31
 
32
32
  def name_map(dir_path)
33
- name_map = {}
33
+ no_change_array = []
34
+ change_map = {}
34
35
  Dir.glob("#{dir_path}/*.[jJ][pP][gG]").sort.each do |f|
35
- mdate = File.mtime(f)
36
- name_map[f] = "#{dir_path}/#{new_name(mdate)}"
36
+ if /[Ii][Mm][Gg]\_[0-9]{8}\_[0-9]{6}\.[Jj][Pp][Gg]/.match(f) == nil
37
+ mdate = File.mtime(f)
38
+ change_map[f] = "#{dir_path}/#{new_name(mdate)}"
39
+ else
40
+ no_change_array.push(f)
41
+ end
37
42
  end
38
- return name_map
43
+ return [no_change_array, change_map]
39
44
  end
40
45
 
41
46
  def print_replace_names(dir_path, map)
42
- puts "We will be renaming the following image files"
43
- ap map
47
+ puts "These files are in the correct format and will remain unchanged:"
48
+ ap map[0], :index => false
49
+ puts ""
50
+ puts "These files will be renamed as follows:"
51
+ ap map[1]
44
52
  puts "Are you sure you want to continue renaming these files (Y/N)"
45
53
  if STDIN.gets.chomp.downcase == "y"
46
- map.each() do |key, value|
54
+ map[1].each() do |key, value|
47
55
  File.rename("#{key}", "#{value}")
48
56
  end
49
57
  end
@@ -1,3 +1,3 @@
1
1
  module PhotoRename
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/photo_rename.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["github@tjaart.co.za"]
11
11
  spec.summary = "Photo renamer"
12
12
  spec.description = "Rename JPG images in a directory based on the date in the file's mtime field. By default the target file names are in the same format as those created by Android devices."
13
- spec.homepage ='https://github.com/tjaartvdwalt/photo-renamer'
13
+ spec.homepage ='https://github.com/tjaartvdwalt/photo_rename'
14
14
  spec.license = "GNU GPL"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -19,7 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.6"
22
- #spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "rake", "~> 10.3"
23
23
 
24
24
  spec.add_runtime_dependency "awesome_print" , "~> 1.2"
25
+
26
+ spec.required_ruby_version = '~> 2.0'
25
27
  end
Binary file
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: photo_rename
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tjaart van der Walt
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.3'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: awesome_print
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -57,8 +71,9 @@ files:
57
71
  - lib/photo_rename.rb
58
72
  - lib/photo_rename/version.rb
59
73
  - photo_rename.gemspec
60
- - screenshots/2014-07-05-135037_818x747_scrot.png
61
- homepage: https://github.com/tjaartvdwalt/photo-renamer
74
+ - screenshots/example.png
75
+ - screenshots/install.png
76
+ homepage: https://github.com/tjaartvdwalt/photo_rename
62
77
  licenses:
63
78
  - GNU GPL
64
79
  metadata: {}
@@ -68,9 +83,9 @@ require_paths:
68
83
  - lib
69
84
  required_ruby_version: !ruby/object:Gem::Requirement
70
85
  requirements:
71
- - - ">="
86
+ - - "~>"
72
87
  - !ruby/object:Gem::Version
73
- version: '0'
88
+ version: '2.0'
74
89
  required_rubygems_version: !ruby/object:Gem::Requirement
75
90
  requirements:
76
91
  - - ">="