pics 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/README.md +0 -0
- data/bin/pics +5 -0
- data/lib/pics.rb +49 -0
- data/pics.gemspec +35 -0
- metadata +85 -0
data/.gitignore
ADDED
data/README.md
ADDED
File without changes
|
data/bin/pics
ADDED
data/lib/pics.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
class Pics < Thor
|
2
|
+
|
3
|
+
desc 'downcase', 'downcases JPEG extensions'
|
4
|
+
def downcase
|
5
|
+
pictures.each do |file|
|
6
|
+
new_name = file.gsub(/\.[a-zA-Z0-9]*$/, '.jpg')
|
7
|
+
File.rename(file, new_name)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
desc 'sequentize', 'renames JPEG files as a sequence'
|
12
|
+
def sequentize
|
13
|
+
pictures.each do |file|
|
14
|
+
File.rename(file, "_#{file}")
|
15
|
+
end
|
16
|
+
|
17
|
+
index = 1
|
18
|
+
pictures.each do |filename|
|
19
|
+
new_name = "#{'%.10d' % index}.jpg"
|
20
|
+
File.rename(filename, new_name)
|
21
|
+
puts "#{new_name}"
|
22
|
+
index += 1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'set_exif_dates', 'set exif dates of files according to the directory name'
|
27
|
+
def set_exif_dates
|
28
|
+
date = /([0-9]{4})-([0-9]{2})-([0-9]{2})/.match(Dir.pwd).captures
|
29
|
+
y = date[0]
|
30
|
+
m = date[1]
|
31
|
+
d = date[2]
|
32
|
+
|
33
|
+
if yes?("Are you sure to set exif tags of all JPEG files of this directory to #{y}-#{m}-#{d} ? (y/n)")
|
34
|
+
pictures.each do |filename|
|
35
|
+
puts filename
|
36
|
+
# `jhead -mkexif -ds#{y}:#{m}:#{d} -ft "#{filename}"`
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Helpers
|
42
|
+
no_tasks do
|
43
|
+
def pictures
|
44
|
+
Dir['*.{jpg,JPG}']
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
Pics.start
|
data/pics.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{pics}
|
5
|
+
s.version = "0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Aurélien Malisart"]
|
9
|
+
s.date = %q{2011-01-13}
|
10
|
+
s.description = %q{Tool to manage your pictures files}
|
11
|
+
s.email = %q{aurelien.malisart@gmail.com}
|
12
|
+
s.executables = ["pics"]
|
13
|
+
s.extra_rdoc_files = [
|
14
|
+
"README.md"
|
15
|
+
]
|
16
|
+
s.files = [
|
17
|
+
".gitignore",
|
18
|
+
"README.md",
|
19
|
+
"lib/pics.rb",
|
20
|
+
"bin/pics",
|
21
|
+
"pics.gemspec"
|
22
|
+
]
|
23
|
+
s.homepage = %q{http://github.com/javan/whenever}
|
24
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
25
|
+
s.require_paths = ['lib']
|
26
|
+
s.rubygems_version = %q{1.3.7}
|
27
|
+
s.summary = %q{Tool to manage your pictures files.}
|
28
|
+
s.test_files = []
|
29
|
+
|
30
|
+
if s.respond_to? :specification_version then
|
31
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
32
|
+
s.specification_version = 3
|
33
|
+
s.add_dependency(%q<thor>, [">= 0.14.6"])
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: "0.1"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- "Aur\xC3\xA9lien Malisart"
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-01-13 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: thor
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 43
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 14
|
32
|
+
- 6
|
33
|
+
version: 0.14.6
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
description: Tool to manage your pictures files
|
37
|
+
email: aurelien.malisart@gmail.com
|
38
|
+
executables:
|
39
|
+
- pics
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
43
|
+
- README.md
|
44
|
+
files:
|
45
|
+
- .gitignore
|
46
|
+
- README.md
|
47
|
+
- lib/pics.rb
|
48
|
+
- bin/pics
|
49
|
+
- pics.gemspec
|
50
|
+
has_rdoc: true
|
51
|
+
homepage: http://github.com/javan/whenever
|
52
|
+
licenses: []
|
53
|
+
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options:
|
56
|
+
- --charset=UTF-8
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
requirements: []
|
78
|
+
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 1.4.1
|
81
|
+
signing_key:
|
82
|
+
specification_version: 3
|
83
|
+
summary: Tool to manage your pictures files.
|
84
|
+
test_files: []
|
85
|
+
|