flickru 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/flickru.rb +1 -1
- data/lib/flickru/flickr.rb +1 -1
- data/lib/flickru/location.rb +2 -8
- data/lib/flickru/version.rb +1 -1
- data/spec/flickru_spec.rb +5 -1
- data/var/ts/tc_sorting/Testing Collection/a.jpg +0 -0
- data/var/ts/tc_sorting/Testing Collection/b.jpg +0 -0
- data/var/ts/tc_sorting/Testing Collection/c.jpg +0 -0
- data/var/ts/tc_sorting/Testing Collection/d.jpg +0 -0
- data/var/ts/tc_sorting/Testing Collection/e.jpg +0 -0
- metadata +172 -139
data/lib/flickru.rb
CHANGED
@@ -71,7 +71,7 @@ def self.flickru photo_dir
|
|
71
71
|
Printer.info "#{File.human_readable_size total_size} to upload"
|
72
72
|
journey = Journey.new total_size
|
73
73
|
photoset_ids = Set.new
|
74
|
-
photos.each do |photo|
|
74
|
+
photos.sort.each do |photo|
|
75
75
|
Printer.info "file '#{File.join File.basename(File.dirname(photo)), File.basename(photo)}' under process"
|
76
76
|
begin
|
77
77
|
photo_id = Flickr.upload_photo photo
|
data/lib/flickru/flickr.rb
CHANGED
data/lib/flickru/location.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# ruby
|
2
2
|
require 'rbconfig'
|
3
3
|
# gems
|
4
|
-
require 'cache'
|
5
4
|
require 'colorize'
|
6
5
|
require 'escape'
|
7
6
|
require 'open-uri'
|
@@ -49,8 +48,6 @@ class Location
|
|
49
48
|
|
50
49
|
private
|
51
50
|
|
52
|
-
@@cache = Cache.new
|
53
|
-
|
54
51
|
def Location.parse location
|
55
52
|
# TODO special characters MAY be escaped
|
56
53
|
idx_accuracy = location.index('#') ? location.index('#') : location.length
|
@@ -102,15 +99,12 @@ private
|
|
102
99
|
end
|
103
100
|
|
104
101
|
def Location.geowiki place
|
105
|
-
|
106
|
-
return @@cache[place]
|
107
|
-
end
|
108
|
-
wiki = open("http://en.wikipedia.org/wiki/#{place}").read
|
102
|
+
wiki = open("http://en.wikipedia.org/wiki/#{URI::encode(place)}").read
|
109
103
|
tool = open(wiki.tr("\"", "\n").split("\n").grep(/geohack/) \
|
110
104
|
.first.sub(/^\/\//,'http://').sub('&','&')).read
|
111
105
|
geo = tool.split("\n").grep(/<span class="geo"/).first
|
112
106
|
latitude = geo.sub(/^.*"Latitude">/, '').sub(/<\/span>, .*/, '')
|
113
107
|
longitude = geo.sub(/.*"Longitude">/, '').sub(/<\/span>.*$/, '')
|
114
|
-
|
108
|
+
latitude + ", " + longitude
|
115
109
|
end
|
116
110
|
end
|
data/lib/flickru/version.rb
CHANGED
data/spec/flickru_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# gems
|
2
2
|
require 'colorize'
|
3
3
|
require 'simplecov'
|
4
|
-
SimpleCov.coverage_dir(File.
|
4
|
+
SimpleCov.coverage_dir(File.join('var', 'cov'))
|
5
5
|
SimpleCov.start # should be before loading flickru code!
|
6
6
|
# flickru
|
7
7
|
require 'flickru'
|
@@ -43,6 +43,10 @@ describe Flickru do
|
|
43
43
|
Flickru.flickru "var/ts/tc_whitespaces"
|
44
44
|
end
|
45
45
|
|
46
|
+
it "processing by alphabetical order (by filename)" do
|
47
|
+
Flickru.flickru "var/ts/tc_sorting"
|
48
|
+
end
|
49
|
+
|
46
50
|
after(:all) do
|
47
51
|
puts "\nRemember to delete the testing files that have been just uploaded to your Flickr's collection 'Testing Collection*'.".red
|
48
52
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,172 +1,196 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: flickru
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Jesus Pardillo
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-08-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: bundler
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
18
|
+
requirements:
|
21
19
|
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
20
|
+
- !ruby/object:Gem::Version
|
23
21
|
version: 1.3.5
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: colorize
|
28
23
|
prerelease: false
|
29
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.3.5
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: colorize
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
30
33
|
none: false
|
31
|
-
requirements:
|
34
|
+
requirements:
|
32
35
|
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
36
|
+
- !ruby/object:Gem::Version
|
34
37
|
version: 0.5.8
|
35
38
|
type: :runtime
|
36
|
-
version_requirements: *id002
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: escape
|
39
39
|
prerelease: false
|
40
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.5.8
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: escape
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
41
49
|
none: false
|
42
|
-
requirements:
|
50
|
+
requirements:
|
43
51
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
52
|
+
- !ruby/object:Gem::Version
|
45
53
|
version: 0.0.4
|
46
54
|
type: :runtime
|
47
|
-
version_requirements: *id003
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: exifr
|
50
55
|
prerelease: false
|
51
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
57
|
none: false
|
53
|
-
requirements:
|
58
|
+
requirements:
|
54
59
|
- - ~>
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version:
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
name: flickraw
|
61
|
-
prerelease: false
|
62
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.4
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: exifr
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
63
65
|
none: false
|
64
|
-
requirements:
|
66
|
+
requirements:
|
65
67
|
- - ~>
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version:
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.1.3
|
68
70
|
type: :runtime
|
69
|
-
version_requirements: *id005
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: rubygems-update
|
72
71
|
prerelease: false
|
73
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.1.3
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: flickraw-cached
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
74
81
|
none: false
|
75
|
-
requirements:
|
82
|
+
requirements:
|
76
83
|
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version:
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '20120701'
|
79
86
|
type: :runtime
|
80
|
-
version_requirements: *id006
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: unicode_utils
|
83
87
|
prerelease: false
|
84
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
89
|
none: false
|
86
|
-
requirements:
|
90
|
+
requirements:
|
87
91
|
- - ~>
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version:
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '20120701'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rubygems-update
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.0.7
|
90
102
|
type: :runtime
|
91
|
-
version_requirements: *id007
|
92
|
-
- !ruby/object:Gem::Dependency
|
93
|
-
name: simplecov
|
94
103
|
prerelease: false
|
95
|
-
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
105
|
none: false
|
97
|
-
requirements:
|
106
|
+
requirements:
|
98
107
|
- - ~>
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
version: 0.
|
101
|
-
|
102
|
-
version_requirements: *id008
|
103
|
-
- !ruby/object:Gem::Dependency
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.0.7
|
110
|
+
- !ruby/object:Gem::Dependency
|
104
111
|
name: rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.14.1
|
118
|
+
type: :development
|
105
119
|
prerelease: false
|
106
|
-
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 2.14.1
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: simplecov
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
107
129
|
none: false
|
108
|
-
requirements:
|
130
|
+
requirements:
|
109
131
|
- - ~>
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version:
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 0.7.1
|
112
134
|
type: :development
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 0.7.1
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: unicode_utils
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ~>
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 1.4.0
|
150
|
+
type: :runtime
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ~>
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: 1.4.0
|
158
|
+
description: ! "Command-line tool that automatises photo/video uploads to Flickr.\n\nEntering
|
159
|
+
'flickru <directory>' in your command line, any photos under 'directory' (and subdirs)\nare
|
160
|
+
uploaded to your Flickr account (interactively entered the first time you start
|
161
|
+
flickru).\n\nPhotos are identified by case-insensitive extensions: GIF, JPEG, JPG,
|
162
|
+
PNG, and TIFF.\nVideos are identified by case-insensitive extensions: AVI, MPEG,
|
163
|
+
and MPG.\n\nflickru automatically sets the following Flickr metadata:\n (1) date
|
164
|
+
taken: file last-modification time, unless JPEG/TIFF Exif metadatum\n 'date_time_original'
|
165
|
+
is found (Flickr understands it natively).\n (2) privacy policy: private, visible
|
166
|
+
by friends & family, hidden for public\n searches\n (3) safety level: safe\n
|
167
|
+
(4) permissions: friends & family can add comments to the photo and its notes;\n
|
168
|
+
\ nobody can add notes and tags to the photo\n (5) description: for videos longer
|
169
|
+
than 90s (Flickr's longest allowed duration)\n but shorter than 500MB (Flickr's
|
170
|
+
maximum permisible size), it will contain\n an annotation about its large duration.\n
|
171
|
+
(6) title: extracted from the parent directory name\n (7) geolocation & accuracy:
|
172
|
+
extracted from the parent directory name, unless\n JPEG/TIFF Exif GPS metadata
|
173
|
+
is found (Flickr understands them natively).\n\nBefore uploading photos, please,
|
174
|
+
make sure that you have correctly named each\nphotos parent directory according
|
175
|
+
to the name format 'TITLE[@LOCATION[#PRECISION]]',\nwhere:\n (1) TITLE is the desired
|
176
|
+
title for the photos stored in the directory. If no\n LOCATION is given, flickru
|
177
|
+
tries to extract the location from Wikipedia\n page TITLE.\n (2) LOCATION is
|
178
|
+
the location of the photos, specified as:\n (a) the Wikipedia page name (whitespaces
|
179
|
+
allowed) of the location or\n (b) its coordinates LATITUDE,LONGITUDE\n (3) PRECISION
|
180
|
+
is the Flickr geolocation precision. Flickru sets it to one of\n the following
|
181
|
+
case insentitive literals: 'street', 'city', 'region',\n 'country', 'world'.\n\nPhotos
|
182
|
+
are classified into photosets. If the photoset does not exist, flickru\ncreates
|
183
|
+
it. This photoset is named after its grandparent directory. The\nphotoset is arranged
|
184
|
+
by 'date taken' (older first).\n\nTo see some examples on the directory structure
|
185
|
+
recognised by flickru, please\nexplore the subdirectories under 'var/ts'.\n\nGitHub
|
186
|
+
\ : http://github.com/jesuspv/flickru\nRubyGems: http://rubygems.org/gems/flickru\n"
|
187
|
+
email:
|
162
188
|
- dev@jesuspardillo.com
|
163
|
-
executables:
|
189
|
+
executables:
|
164
190
|
- flickru
|
165
191
|
extensions: []
|
166
|
-
|
167
192
|
extra_rdoc_files: []
|
168
|
-
|
169
|
-
files:
|
193
|
+
files:
|
170
194
|
- README
|
171
195
|
- bin/flickru
|
172
196
|
- bin/geowiki
|
@@ -220,38 +244,41 @@ files:
|
|
220
244
|
- var/ts/tc_large_files/Testing Collection/Too Large!/80MB-of-zeros.mpg.zip
|
221
245
|
- var/ts/tc_locations/Testing Collection/Quebec#region/Quebec#region.jpg
|
222
246
|
- var/ts/tc_locations/Testing Collection/Troll Face/Troll Face.jpg
|
223
|
-
- var/ts/tc_locations/Testing Collection/Troll Face@38.356797,-0.474376#world/Troll
|
247
|
+
- var/ts/tc_locations/Testing Collection/Troll Face@38.356797,-0.474376#world/Troll
|
248
|
+
Face@38.356797,-0.474376#world.jpg
|
224
249
|
- var/ts/tc_locations/Testing Collection/Troll Face@38.356797,-0.474376/Troll Face@38.356797,-0.474376.jpg
|
225
250
|
- var/ts/tc_locations/Testing Collection/Troll Face@Montreal/Troll Face@Montreal.jpg
|
226
251
|
- var/ts/tc_locations/Testing Collection/Troll Face@Quebec#region/Troll Face@Quebec#region.jpg
|
252
|
+
- var/ts/tc_sorting/Testing Collection/a.jpg
|
253
|
+
- var/ts/tc_sorting/Testing Collection/b.jpg
|
254
|
+
- var/ts/tc_sorting/Testing Collection/c.jpg
|
255
|
+
- var/ts/tc_sorting/Testing Collection/d.jpg
|
256
|
+
- var/ts/tc_sorting/Testing Collection/e.jpg
|
227
257
|
homepage: http://github.com/jesuspv/flickru
|
228
258
|
licenses: []
|
229
|
-
|
230
259
|
post_install_message:
|
231
260
|
rdoc_options: []
|
232
|
-
|
233
|
-
require_paths:
|
261
|
+
require_paths:
|
234
262
|
- lib
|
235
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
263
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
236
264
|
none: false
|
237
|
-
requirements:
|
238
|
-
- -
|
239
|
-
- !ruby/object:Gem::Version
|
240
|
-
version:
|
241
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
265
|
+
requirements:
|
266
|
+
- - ! '>='
|
267
|
+
- !ruby/object:Gem::Version
|
268
|
+
version: '0'
|
269
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
270
|
none: false
|
243
|
-
requirements:
|
244
|
-
- -
|
245
|
-
- !ruby/object:Gem::Version
|
246
|
-
version:
|
271
|
+
requirements:
|
272
|
+
- - ! '>='
|
273
|
+
- !ruby/object:Gem::Version
|
274
|
+
version: '0'
|
247
275
|
requirements: []
|
248
|
-
|
249
276
|
rubyforge_project:
|
250
|
-
rubygems_version: 1.8.
|
277
|
+
rubygems_version: 1.8.25
|
251
278
|
signing_key:
|
252
279
|
specification_version: 3
|
253
280
|
summary: Command-line Flickr upload automator
|
254
|
-
test_files:
|
281
|
+
test_files:
|
255
282
|
- spec/flickru_spec.rb
|
256
283
|
- var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#Country/Troll Face@Spain#Country.jpg
|
257
284
|
- var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#ReGiOn/Troll Face@Spain#ReGiOn.jpg
|
@@ -293,7 +320,13 @@ test_files:
|
|
293
320
|
- var/ts/tc_large_files/Testing Collection/Too Large!/80MB-of-zeros.mpg.zip
|
294
321
|
- var/ts/tc_locations/Testing Collection/Quebec#region/Quebec#region.jpg
|
295
322
|
- var/ts/tc_locations/Testing Collection/Troll Face/Troll Face.jpg
|
296
|
-
- var/ts/tc_locations/Testing Collection/Troll Face@38.356797,-0.474376#world/Troll
|
323
|
+
- var/ts/tc_locations/Testing Collection/Troll Face@38.356797,-0.474376#world/Troll
|
324
|
+
Face@38.356797,-0.474376#world.jpg
|
297
325
|
- var/ts/tc_locations/Testing Collection/Troll Face@38.356797,-0.474376/Troll Face@38.356797,-0.474376.jpg
|
298
326
|
- var/ts/tc_locations/Testing Collection/Troll Face@Montreal/Troll Face@Montreal.jpg
|
299
327
|
- var/ts/tc_locations/Testing Collection/Troll Face@Quebec#region/Troll Face@Quebec#region.jpg
|
328
|
+
- var/ts/tc_sorting/Testing Collection/a.jpg
|
329
|
+
- var/ts/tc_sorting/Testing Collection/b.jpg
|
330
|
+
- var/ts/tc_sorting/Testing Collection/c.jpg
|
331
|
+
- var/ts/tc_sorting/Testing Collection/d.jpg
|
332
|
+
- var/ts/tc_sorting/Testing Collection/e.jpg
|