photo_rename 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.document +5 -0
- data/Gemfile +16 -4
- data/README.md +89 -0
- data/Rakefile +55 -3
- data/VERSION +1 -0
- data/bin/photo_rename +3 -3
- data/lib/photo_rename.rb +19 -6
- data/lib/photo_rename/version.rb +1 -1
- data/photo_rename.gemspec +68 -23
- data/test/helper.rb +34 -0
- data/test/test_photo_rename.rb +7 -0
- metadata +80 -21
- data/.gitignore +0 -22
- data/README.org +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a20d12e50f922698424746ea8206ea72230bb793
|
4
|
+
data.tar.gz: a6a9c6b88d896a15b1e5a0a7a91225177591e0a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2366457fdf78e74faeb28f9a3ab79108fce51c03db57338544dadfc2926f162a60b6bd99e5a1bb357905fc8769c95432951b9020de27f98324801f854c09f182
|
7
|
+
data.tar.gz: f898f40546b680eb0bdf9a9086319b4cf952b94c39325981bdde4da44d72c3342190efd56ecde4326e1c9bdd7fc6f322a2862e1d04793a9cdbfeb92609b0f41e
|
data/.document
ADDED
data/Gemfile
CHANGED
@@ -1,5 +1,17 @@
|
|
1
|
-
source
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
gem 'awesome_print' , '~> 1.6'
|
6
|
+
gem 'mini_exiftool' , '~> 2.5'
|
7
|
+
|
8
|
+
# Add dependencies to develop your gem here.
|
9
|
+
# Include everything needed to run rake, tests, features, etc.
|
10
|
+
group :development do
|
11
|
+
gem "shoulda", ">= 0"
|
12
|
+
gem "rdoc", "~> 3.12"
|
13
|
+
gem "bundler", "~> 1.0"
|
14
|
+
gem "jeweler", "~> 2.0.1"
|
15
|
+
gem "simplecov", ">= 0"
|
16
|
+
end
|
2
17
|
|
3
|
-
# Specify your gem's dependencies in photo_rename.gemspec
|
4
|
-
gemspec
|
5
|
-
gem 'awesome_print' , '~> 1.2.0'
|
data/README.md
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# Photo Renamer #
|
2
|
+
|
3
|
+
![img](//badge.fury.io/rb/photo_rename.svg)
|
4
|
+
|
5
|
+
## What the script does ##
|
6
|
+
|
7
|
+
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<sub>\*</sub>yyyymmdd\*<sub>\*</sub>hhmmss\*.jpg
|
8
|
+
|
9
|
+
## Rationale ##
|
10
|
+
|
11
|
+
The naming pattern described above is the naming pattern used by the stock Android camera.Renaming photos taken with other devices to this scheme allows me to seamlessly merge photos into a single directory and maintain consistent file names.
|
12
|
+
|
13
|
+
## Extracting the date ##
|
14
|
+
|
15
|
+
### exif meta data ###
|
16
|
+
Per default we now use the JPEG `exif meta data` to find the creation date of the file. This gives much more reliable results than using the `mtime` of the file.
|
17
|
+
|
18
|
+
The case that convinced me this change was necessary:
|
19
|
+
I wanted to rename images that was recovered after being deleted. The recovery process changed the `mtime` of the files, but the `meta data` remained intact.
|
20
|
+
|
21
|
+
### mtime ###
|
22
|
+
|
23
|
+
It is still possible to find the date with `mtime` using the `-f` command line switch, but using the `exif metadata` is the highly preferred method.
|
24
|
+
|
25
|
+
~~After some experimenting I found that if I copy photos from my camera's memory card to my PC the "Modify Time" field gets preserved. Therefore I use this field as the basis for renaming the files. Obviously if you modify the file before renaming the mtime field will get updated and your file name will be wrong, so be warned!~~
|
26
|
+
|
27
|
+
~~**IMPORTANT NOTE**~~
|
28
|
+
~~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)~~
|
29
|
+
|
30
|
+
|
31
|
+
## Installation ##
|
32
|
+
|
33
|
+
### Dependencies ###
|
34
|
+
Since version `0.1.0` we use exif metadata to get the file creation date by default. We use the ruby library `mini_exiftool` which has a dependency on [exiftool](http://www.sno.phy.queensu.ca/~phil/exiftool/).
|
35
|
+
|
36
|
+
`exiftool` should be easily installable through the package manager of most distributions.
|
37
|
+
|
38
|
+
**Arch Linux**
|
39
|
+
|
40
|
+
```bash
|
41
|
+
pacman -S perl-image-exiftool
|
42
|
+
```
|
43
|
+
|
44
|
+
**Ubuntu**
|
45
|
+
|
46
|
+
```bash
|
47
|
+
apt-get install libimage-exiftool-perl
|
48
|
+
```
|
49
|
+
|
50
|
+
**OSX**
|
51
|
+
http://www.sno.phy.queensu.ca/~phil/exiftool/ExifTool-10.00.dmg
|
52
|
+
|
53
|
+
**Windows**
|
54
|
+
http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool-10.00.zip
|
55
|
+
|
56
|
+
|
57
|
+
### Ruby Gems ###
|
58
|
+
|
59
|
+
The easiest way to install the script is by using rubygems.
|
60
|
+
|
61
|
+
gem install photo_rename
|
62
|
+
|
63
|
+
![img](./screenshots/install.png)
|
64
|
+
|
65
|
+
## Usage ##
|
66
|
+
|
67
|
+
photo_rename photo_directory
|
68
|
+
|
69
|
+
![img](./screenshots/example.png)
|
70
|
+
|
71
|
+
|
72
|
+
## Release notes ##
|
73
|
+
|
74
|
+
### 0.1.0 ###
|
75
|
+
|
76
|
+
- Use mini_exiftool to get the date from image metadata
|
77
|
+
- Removed `-b` command line option, as this is not implemented yet
|
78
|
+
|
79
|
+
### 0.0.4 ###
|
80
|
+
|
81
|
+
- Do not rename files that are already in the correct format.
|
82
|
+
|
83
|
+
### 0.0.1 - 0.0.3 ###
|
84
|
+
|
85
|
+
- Sort out teething problems with gem.
|
86
|
+
|
87
|
+
### License ###
|
88
|
+
|
89
|
+
This program is licensed under [(<http://www.gnu.org/licenses/gpl-3.0.txt>)[GNU GPL]]
|
data/Rakefile
CHANGED
@@ -1,4 +1,56 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = "photo_rename"
|
18
|
+
gem.homepage = "http://github.com/tjaartvdwalt/photo_rename"
|
19
|
+
gem.license = "GPL"
|
20
|
+
gem.summary = "Photo renamer"
|
21
|
+
gem.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."
|
22
|
+
gem.email = "github@tjaart.co.za"
|
23
|
+
gem.authors = ["Tjaart van der Walt"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
|
26
|
+
# include the file runner
|
27
|
+
gem.files.include 'bin/*'
|
28
|
+
|
29
|
+
end
|
30
|
+
Jeweler::RubygemsDotOrgTasks.new
|
31
|
+
|
32
|
+
require 'rake/testtask'
|
33
|
+
Rake::TestTask.new(:test) do |test|
|
34
|
+
test.libs << 'lib' << 'test'
|
35
|
+
test.pattern = 'test/**/test_*.rb'
|
36
|
+
test.verbose = true
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Code coverage detail"
|
40
|
+
task :simplecov do
|
41
|
+
ENV['COVERAGE'] = "true"
|
42
|
+
Rake::Task['test'].execute
|
43
|
+
end
|
44
|
+
|
45
|
+
task :default => :test
|
46
|
+
|
47
|
+
require 'rdoc/task'
|
48
|
+
Rake::RDocTask.new do |rdoc|
|
49
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
50
|
+
|
51
|
+
rdoc.rdoc_dir = 'rdoc'
|
52
|
+
rdoc.title = "photo_rename #{version}"
|
53
|
+
rdoc.rdoc_files.include('README*')
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
+
end
|
4
56
|
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.5
|
data/bin/photo_rename
CHANGED
@@ -5,11 +5,11 @@ 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
|
-
photo_rename.parse_options(print_opts)
|
8
|
+
options = photo_rename.parse_options(print_opts)
|
9
9
|
|
10
10
|
ARGV.each do |arg|
|
11
|
-
|
12
|
-
|
11
|
+
map = photo_rename.name_map(arg, options)
|
12
|
+
photo_rename.print_replace_names(arg, map)
|
13
13
|
end
|
14
14
|
|
15
15
|
end
|
data/lib/photo_rename.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# photo_renamer renames all .jpg files in a given directory to the form IMG_*yyyymmdd*_*hhmmss*.jpg
|
4
|
-
# Copyright (C)
|
4
|
+
# Copyright (C) 2015 Tjaart van der Walt
|
5
5
|
|
6
6
|
# This program is free software: you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU General Public License as published by
|
@@ -19,6 +19,7 @@
|
|
19
19
|
require 'optparse'
|
20
20
|
require 'rubygems'
|
21
21
|
require 'awesome_print'
|
22
|
+
require 'mini_exiftool'
|
22
23
|
|
23
24
|
class Photo_rename
|
24
25
|
def new_name(mdate)
|
@@ -29,12 +30,19 @@ class Photo_rename
|
|
29
30
|
return ret_string
|
30
31
|
end
|
31
32
|
|
32
|
-
def name_map(dir_path)
|
33
|
+
def name_map(dir_path, options)
|
33
34
|
no_change_array = []
|
34
35
|
change_map = {}
|
35
36
|
Dir.glob("#{dir_path}/*.[jJ][pP][gG]").sort.each do |f|
|
36
37
|
if /[Ii][Mm][Gg]\_[0-9]{8}\_[0-9]{6}\.[Jj][Pp][Gg]/.match(f) == nil
|
37
|
-
|
38
|
+
|
39
|
+
if not options[:file] then
|
40
|
+
photo = MiniExiftool.new f
|
41
|
+
mdate = photo[:DateTimeOriginal]
|
42
|
+
puts mdate
|
43
|
+
else
|
44
|
+
mdate = File.mtime(f)
|
45
|
+
end
|
38
46
|
change_map[f] = "#{dir_path}/#{new_name(mdate)}"
|
39
47
|
else
|
40
48
|
no_change_array.push(f)
|
@@ -63,9 +71,14 @@ class Photo_rename
|
|
63
71
|
optparse = OptionParser.new do|opts|
|
64
72
|
opts.banner = "Usage: photo_renamer.rb [options] dir1 [dir2 ...]"
|
65
73
|
|
66
|
-
options[:batch] = false
|
67
|
-
opts.on( '-b', '--batch', 'Batch mode. Will not ask confirmation before renaming.' ) do
|
68
|
-
|
74
|
+
# options[:batch] = false
|
75
|
+
# opts.on( '-b', '--batch', 'Batch mode. Will not ask confirmation before renaming.' ) do
|
76
|
+
# options[:batch] = true
|
77
|
+
# end
|
78
|
+
|
79
|
+
options[:file] = false
|
80
|
+
opts.on( '-f', '--filedate', 'Use the file creation date, instead of the exif meta data' ) do
|
81
|
+
options[:file] = true
|
69
82
|
end
|
70
83
|
|
71
84
|
opts.on( '-h', '--help', 'Display this screen' ) do
|
data/lib/photo_rename/version.rb
CHANGED
data/photo_rename.gemspec
CHANGED
@@ -1,27 +1,72 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: photo_rename 0.0.5 ruby lib
|
5
6
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
9
|
-
spec.authors = ["Tjaart van der Walt"]
|
10
|
-
spec.email = ["github@tjaart.co.za"]
|
11
|
-
spec.summary = "Photo renamer"
|
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_rename'
|
14
|
-
spec.license = "GNU GPL"
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "photo_rename"
|
9
|
+
s.version = "0.0.5"
|
15
10
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Tjaart van der Walt"]
|
14
|
+
s.date = "2015-09-02"
|
15
|
+
s.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."
|
16
|
+
s.email = "github@tjaart.co.za"
|
17
|
+
s.executables = ["photo_rename"]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"README.md"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
"COPYING",
|
24
|
+
"Gemfile",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/photo_rename",
|
29
|
+
"lib/photo_rename.rb",
|
30
|
+
"lib/photo_rename/version.rb",
|
31
|
+
"photo_rename.gemspec",
|
32
|
+
"screenshots/example.png",
|
33
|
+
"screenshots/install.png",
|
34
|
+
"test/helper.rb",
|
35
|
+
"test/test_photo_rename.rb"
|
36
|
+
]
|
37
|
+
s.homepage = "http://github.com/tjaartvdwalt/photo_rename"
|
38
|
+
s.licenses = ["GPL"]
|
39
|
+
s.rubygems_version = "2.4.8"
|
40
|
+
s.summary = "Photo renamer"
|
20
41
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
s.specification_version = 4
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_runtime_dependency(%q<awesome_print>, ["~> 1.6"])
|
47
|
+
s.add_runtime_dependency(%q<mini_exiftool>, ["~> 2.5"])
|
48
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
49
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
50
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
51
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
52
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<awesome_print>, ["~> 1.6"])
|
55
|
+
s.add_dependency(%q<mini_exiftool>, ["~> 2.5"])
|
56
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
57
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
58
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
59
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
60
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
61
|
+
end
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<awesome_print>, ["~> 1.6"])
|
64
|
+
s.add_dependency(%q<mini_exiftool>, ["~> 2.5"])
|
65
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
66
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
67
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
68
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
69
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
70
|
+
end
|
27
71
|
end
|
72
|
+
|
data/test/helper.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
module SimpleCov::Configuration
|
4
|
+
def clean_filters
|
5
|
+
@filters = []
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
SimpleCov.configure do
|
10
|
+
clean_filters
|
11
|
+
load_adapter 'test_frameworks'
|
12
|
+
end
|
13
|
+
|
14
|
+
ENV["COVERAGE"] && SimpleCov.start do
|
15
|
+
add_filter "/.rvm/"
|
16
|
+
end
|
17
|
+
require 'rubygems'
|
18
|
+
require 'bundler'
|
19
|
+
begin
|
20
|
+
Bundler.setup(:default, :development)
|
21
|
+
rescue Bundler::BundlerError => e
|
22
|
+
$stderr.puts e.message
|
23
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
24
|
+
exit e.status_code
|
25
|
+
end
|
26
|
+
require 'test/unit'
|
27
|
+
require 'shoulda'
|
28
|
+
|
29
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
30
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
31
|
+
require 'photo_rename'
|
32
|
+
|
33
|
+
class Test::Unit::TestCase
|
34
|
+
end
|
metadata
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: photo_rename
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tjaart van der Walt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: awesome_print
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
|
-
type: :
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
@@ -25,57 +25,116 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: mini_exiftool
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: shoulda
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rdoc
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.12'
|
34
62
|
type: :development
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
66
|
- - "~>"
|
39
67
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
68
|
+
version: '3.12'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
70
|
+
name: bundler
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
73
|
- - "~>"
|
46
74
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
48
|
-
type: :
|
75
|
+
version: '1.0'
|
76
|
+
type: :development
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
82
|
+
version: '1.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: jeweler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.0.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.0.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
55
111
|
description: Rename JPG images in a directory based on the date in the file's mtime
|
56
112
|
field. By default the target file names are in the same format as those created
|
57
113
|
by Android devices.
|
58
|
-
email:
|
59
|
-
- github@tjaart.co.za
|
114
|
+
email: github@tjaart.co.za
|
60
115
|
executables:
|
61
116
|
- photo_rename
|
62
117
|
extensions: []
|
63
|
-
extra_rdoc_files:
|
118
|
+
extra_rdoc_files:
|
119
|
+
- README.md
|
64
120
|
files:
|
65
|
-
- ".
|
121
|
+
- ".document"
|
66
122
|
- COPYING
|
67
123
|
- Gemfile
|
68
|
-
- README.
|
124
|
+
- README.md
|
69
125
|
- Rakefile
|
126
|
+
- VERSION
|
70
127
|
- bin/photo_rename
|
71
128
|
- lib/photo_rename.rb
|
72
129
|
- lib/photo_rename/version.rb
|
73
130
|
- photo_rename.gemspec
|
74
131
|
- screenshots/example.png
|
75
132
|
- screenshots/install.png
|
76
|
-
|
133
|
+
- test/helper.rb
|
134
|
+
- test/test_photo_rename.rb
|
135
|
+
homepage: http://github.com/tjaartvdwalt/photo_rename
|
77
136
|
licenses:
|
78
|
-
-
|
137
|
+
- GPL
|
79
138
|
metadata: {}
|
80
139
|
post_install_message:
|
81
140
|
rdoc_options: []
|
@@ -83,9 +142,9 @@ require_paths:
|
|
83
142
|
- lib
|
84
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
144
|
requirements:
|
86
|
-
- - "
|
145
|
+
- - ">="
|
87
146
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
147
|
+
version: '0'
|
89
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
149
|
requirements:
|
91
150
|
- - ">="
|
@@ -93,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
152
|
version: '0'
|
94
153
|
requirements: []
|
95
154
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
155
|
+
rubygems_version: 2.4.8
|
97
156
|
signing_key:
|
98
157
|
specification_version: 4
|
99
158
|
summary: Photo renamer
|
data/.gitignore
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.bundle
|
19
|
-
*.so
|
20
|
-
*.o
|
21
|
-
*.a
|
22
|
-
mkmf.log
|
data/README.org
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
* Photo Renamer
|
2
|
-
|
3
|
-
** What the script does
|
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
|
5
|
-
|
6
|
-
** Rationale
|
7
|
-
The naming pattern described above is the naming pattern used by the stock Android camera.
|
8
|
-
Renaming photos taken with other devices to this scheme allows me to seamlessly merge photos into a single directory and maintain consistent file names.
|
9
|
-
|
10
|
-
** mtime
|
11
|
-
After some experimenting I found that if I copy photos from my camera's memory card to my PC the "Modify Time" field gets preserved. Therefore I use this field as the basis for renaming the files. Obviously if you modify the file before renaming the mtime field will get updated and your file name will be wrong, so be warned!
|
12
|
-
|
13
|
-
*IMPORTANT NOTE*
|
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)
|
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
|
-
|
24
|
-
** Usage
|
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.
|
36
|
-
|
37
|
-
** GNU GPL
|
38
|
-
This program is licensed under [(http://www.gnu.org/licenses/gpl-3.0.txt)[GNU GPL]]
|