flickru 0.0.10 → 0.0.11

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.
Files changed (51) hide show
  1. data/bin/geowiki +21 -20
  2. data/lib/flickru.rb +4 -7
  3. data/lib/flickru/flickr.rb +3 -3
  4. data/lib/flickru/location.rb +15 -4
  5. data/lib/flickru/version.rb +1 -1
  6. data/var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#Country/Troll Face@Spain#Country.jpg +0 -0
  7. data/var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#ReGiOn/Troll Face@Spain#ReGiOn.jpg +0 -0
  8. data/var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#STREET/Troll Face@Spain#STREET.jpg +0 -0
  9. data/var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#city/Troll Face@Spain#city.jpg +0 -0
  10. data/var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#wOrld/Troll Face@Spain#wOrld.jpg +0 -0
  11. data/var/ts/tc_accuracies/Testing Collection/Troll Face@Spain/Troll Face@Spain.jpg +0 -0
  12. data/var/ts/tc_collections/Testing Collection 2/ Troll Face A/troll-face A1.jpg +0 -0
  13. data/var/ts/tc_collections/Testing Collection 2/ Troll Face B/troll-face B1.jpg +0 -0
  14. data/var/ts/tc_collections/Testing Collection 2/ Troll Face B/troll-face B2.jpg +0 -0
  15. data/var/ts/tc_collections/Testing Collection 3/ Troll Face A/troll-face A1.jpg +0 -0
  16. data/var/ts/tc_collections/Testing Collection 3/ Troll Face B/troll-face B1.jpg +0 -0
  17. data/var/ts/tc_collections/Testing Collection 3/ Troll Face B/troll-face B2.jpg +0 -0
  18. data/var/ts/tc_collections/Testing Collection 3/ Troll Face C/troll-face C1.jpg +0 -0
  19. data/var/ts/tc_collections/Testing Collection 3/ Troll Face C/troll-face C2.jpg +0 -0
  20. data/var/ts/tc_collections/Testing Collection 3/ Troll Face C/troll-face C3.jpg +0 -0
  21. data/var/ts/tc_date_taken/Testing Collection/With Exif Metadata/ork.jpg +0 -0
  22. data/var/ts/tc_date_taken/Testing Collection/With Exif Metadata/ork.tiff +0 -0
  23. data/var/ts/tc_date_taken/Testing Collection/Without Exif Metadata/ork.gif +0 -0
  24. data/var/ts/tc_date_taken/Testing Collection/Without Exif Metadata/ork.jpg +0 -0
  25. data/var/ts/tc_filetypes/DUMMY_FILE +0 -0
  26. data/var/ts/tc_filetypes/Testing Collection/Photo/GIF photo.GiF +0 -0
  27. data/var/ts/tc_filetypes/Testing Collection/Photo/JPEG photo.jpEg +0 -0
  28. data/var/ts/tc_filetypes/Testing Collection/Photo/JPG photo.jpg +0 -0
  29. data/var/ts/tc_filetypes/Testing Collection/Photo/PNG photo.PNG +0 -0
  30. data/var/ts/tc_filetypes/Testing Collection/Photo/TGA photo.TGA +0 -0
  31. data/var/ts/tc_filetypes/Testing Collection/Photo/TIFF photo.TifF +0 -0
  32. data/var/ts/tc_filetypes/Testing Collection/Photo/dummy.tmp b/data/var/ts/tc_filetypes/Testing → Collection/Photo/dummy.tmp +0 -0
  33. data/var/ts/tc_filetypes/Testing Collection/Photo/dummy.txt b/data/var/ts/tc_filetypes/Testing → Collection/Photo/dummy.txt +0 -0
  34. data/var/ts/tc_filetypes/Testing Collection/Video/avi video.AVI +0 -0
  35. data/var/ts/tc_filetypes/Testing Collection/Video/dummy.tgz b/data/var/ts/tc_filetypes/Testing → Collection/Video/dummy.tgz +0 -0
  36. data/var/ts/tc_filetypes/Testing Collection/Video/dummy.zip b/data/var/ts/tc_filetypes/Testing → Collection/Video/dummy.zip +0 -0
  37. data/var/ts/tc_filetypes/Testing Collection/Video/mpeg video.mpEg +0 -0
  38. data/var/ts/tc_filetypes/Testing Collection/Video/mpg video.mpg +0 -0
  39. data/var/ts/tc_filetypes/Testing Collection/dummy.doc b/data/var/ts/tc_filetypes/Testing → Collection/dummy.doc +0 -0
  40. data/var/ts/tc_filetypes/Testing Collection/dummy.txt b/data/var/ts/tc_filetypes/Testing → Collection/dummy.txt +0 -0
  41. data/var/ts/tc_large_files/Testing Collection/Too Large!/80MB-of-zeros.mpg.zip +0 -0
  42. data/var/ts/tc_locations/Testing Collection/Quebec#region/Quebec#region.jpg +0 -0
  43. data/var/ts/tc_locations/Testing Collection/Troll Face/Troll Face.jpg +0 -0
  44. data/var/ts/tc_locations/Testing Collection/Troll Face@38.356797,-0.474376#world/Troll Face@38.356797,-0.474376#world.jpg +0 -0
  45. data/var/ts/tc_locations/Testing Collection/Troll Face@38.356797,-0.474376/Troll Face@38.356797,-0.474376.jpg +0 -0
  46. data/var/ts/tc_locations/Testing Collection/Troll Face@Montreal/Troll Face@Montreal.jpg +0 -0
  47. data/var/ts/tc_locations/Testing Collection/Troll Face@Quebec#region/Troll Face@Quebec#region.jpg +0 -0
  48. data/var/ts/tc_whitespaces/Testing Collection/ Troll Face / Troll Face .jpg +0 -0
  49. data/var/ts/tc_whitespaces/Testing Collection/ Troll Face @ Spain # city / Troll Face @ Spain # city .jpg +0 -0
  50. data/var/ts/tc_whitespaces/Testing Collection/ Troll Face @ Spain / Troll Face @ Spain .jpg +0 -0
  51. metadata +92 -2
@@ -3,24 +3,25 @@
3
3
  APP_NAME=`basename $0`
4
4
 
5
5
  function error {
6
- echo -e "\E[31m$APP_NAME: $1: $2$(tput sgr0)" 1>&2
6
+ # \E[31m 0
7
+ echo -e "\033[31m$APP_NAME: $1: $2\033[0m" 1>&2
7
8
  }
8
9
 
9
10
  if [ $# -ne 1 ]; then
10
- echo "$APP_NAME - find coordinates of a place described by Wikipedia"
11
- echo "usage: $APP_NAME <place Wikipedia page>"
12
- echo "example: $APP_NAME 'Mille-Isles, Quebec'"
13
- error $LINENO "wrong number of arguments"
14
- exit 1
11
+ echo "$APP_NAME - find coordinates of a place described by Wikipedia"
12
+ echo "usage: $APP_NAME <place Wikipedia page>"
13
+ echo "example: $APP_NAME 'Mille-Isles, Quebec'"
14
+ error $LINENO "wrong number of arguments"
15
+ exit 1
15
16
  fi
16
17
 
17
18
  PAGE=`echo "$1" | tr ' ' '_'`
18
19
 
19
20
  # temporal file management
20
21
  if [ -d /tmp ]; then
21
- TMP="/tmp/$PAGE.tmp.$$.$RANDOM.html"
22
+ TMP="/tmp/$PAGE.tmp.$$.$RANDOM.html"
22
23
  else
23
- TMP="$PAGE.tmp.html"
24
+ TMP="$PAGE.tmp.html"
24
25
  fi
25
26
  function clean_up {
26
27
  rm -f "$TMP"
@@ -30,24 +31,24 @@ trap clean_up SIGHUP SIGINT SIGTERM
30
31
 
31
32
  curl "http://en.wikipedia.org/wiki/$PAGE" > "$TMP" 2> /dev/null
32
33
 
33
- if [ $? -ne 0 ]; then
34
- error $LINENO "Wikipedia page '$PAGE' not found"
35
- clean_up 1
36
- fi
34
+ if [ $? -ne 0 ]; then
35
+ error $LINENO "Wikipedia page '$PAGE' not found"
36
+ clean_up 1
37
+ fi
37
38
 
38
39
  URL=`cat "$TMP" | tr '"' '\n' | grep geohack | head -n 1 | sed -e 's|&amp;|\&|'`
39
40
 
40
- if [ -z "$URL" ]; then
41
- error $LINENO "location not found in Wikipedia page '$PAGE'"
42
- clean_up 1
43
- fi
41
+ if [ -z "$URL" ]; then
42
+ error $LINENO "location not found in Wikipedia page '$PAGE'"
43
+ clean_up 1
44
+ fi
44
45
 
45
46
  curl "$URL" > "$TMP" 2> /dev/null
46
47
 
47
- if [ $? -ne 0 ]; then
48
- error $LINENO "GeoHack URL '$URL' not found"
49
- clean_up 1
50
- fi
48
+ if [ $? -ne 0 ]; then
49
+ error $LINENO "GeoHack URL '$URL' not found"
50
+ clean_up 1
51
+ fi
51
52
 
52
53
  cat "$TMP" | grep '<span class="geo"' | sed -e 's|^.*"Latitude">\([^<]*\)</span>, .*"Longitude">\([^<]*\)</span>.*$|\1, \2|'
53
54
 
@@ -24,11 +24,6 @@ def Flickru.usage
24
24
  Printer.show "\n#{IO.read(readme)}"
25
25
  end
26
26
 
27
- def Flickru.die code, message
28
- Printer.error "error:#{code}: #{message}"
29
- exit 1
30
- end
31
-
32
27
  def Flickru.config_filename
33
28
  File.join ENV['HOME'], "." + File.basename(__FILE__, File.extname(__FILE__)) + "rc"
34
29
  end
@@ -92,8 +87,10 @@ def self.flickru photo_dir
92
87
  Printer.ask "Please, review whether: any of your photos need to be rotated,\n" +
93
88
  " better primary photos for your sets have been uploaded,\n" +
94
89
  " and better collection mosaics can be randomised."
95
- rescue
96
- die __LINE__, $!
90
+ rescue Exception => e
91
+ file_line = e.backtrace[0].split(':')
92
+ Printer.error "error:#{File.basename file_line[0]}:#{file_line[1]}: #{e.message}"
93
+ exit 1
97
94
  end
98
95
 
99
96
  end # module Flickru
@@ -53,9 +53,9 @@ module Flickr
53
53
  if date.nil? then date = File.mtime(photo).strftime "%y-%m-%d %H:%M:%S" end
54
54
 
55
55
  loc = Location.new photo
56
- Printer.show "uploading as " +
57
- (loc.nil? ? "\"#{loc.name.black}\" (no location given)" : loc.to_s.black) +
58
- " taken on #{date}... "
56
+ Printer.show "uploading " +
57
+ (loc.nil? ? "#{loc.name.black} (no location given)" : loc.to_s) +
58
+ " taken on #{date.black}... "
59
59
  begin
60
60
  id = flickr.upload_photo photo, :title => UnicodeUtils.nfkc(loc.name), :is_public => 0,
61
61
  :description => description, :tags => UPLOADING_TAG,
@@ -1,4 +1,7 @@
1
+ # ruby
2
+ require 'rbconfig'
1
3
  # gems
4
+ require 'colorize'
2
5
  require 'escape'
3
6
  # flickru
4
7
  require 'flickru/ruby'
@@ -38,8 +41,8 @@ class Location
38
41
 
39
42
  def to_s
40
43
  place = @place.nil? ? "an undefined place" : @place
41
- "\"#{@name}\" at #{place} (~#{accuracy_to_s}) " +
42
- "on lat: #{@latitude}, lon: #{@longitude}"
44
+ "#{@name.black} at #{place.black} (~#{accuracy_to_s.black}) " +
45
+ "on lat: #{@latitude.black}, lon: #{@longitude.black}"
43
46
  end
44
47
 
45
48
  private
@@ -59,7 +62,10 @@ private
59
62
  def self.locate place
60
63
  the_place = place # needed for RuntimeError reporting
61
64
  begin
62
- place = `#{Escape.shell_command [GEOWIKI, place]} 2> /dev/null`[0..-2] \
65
+ is_win = RbConfig::CONFIG['target_os'].downcase.include? 'mswin32'
66
+ command = Escape.shell_command (if is_win then ['bash', GEOWIKI, place]
67
+ else [ GEOWIKI, place] end)
68
+ place = `#{command} 2> /dev/null`[0..-2] \
63
69
  if place !~ /^#{COORD_PATTERN}, *#{COORD_PATTERN}$/
64
70
  if place =~ /^#{COORD_PATTERN}, *#{COORD_PATTERN}$/
65
71
  # latitude, longitude
@@ -68,7 +74,12 @@ private
68
74
  raise RuntimeError
69
75
  end
70
76
  rescue
71
- raise RuntimeError, "location #{the_place} not found"
77
+ message = "location #{the_place} not found"
78
+ if is_win
79
+ message += ", please, verify that command 'bash' (from, e.g., " +
80
+ "http://unxutils.sourceforge.net) is in your PATH"
81
+ end
82
+ raise RuntimeError, message
72
83
  end
73
84
  end
74
85
 
@@ -1,5 +1,5 @@
1
1
  module Flickru
2
2
  unless defined? VERSION
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
4
4
  end
5
5
  end
File without changes
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: flickru
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.10
5
+ version: 0.0.11
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jesus Pardillo
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-01-07 00:00:00 Z
13
+ date: 2012-01-08 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -177,6 +177,51 @@ files:
177
177
  - lib/flickru/string.rb
178
178
  - lib/flickru/version.rb
179
179
  - spec/flickru_spec.rb
180
+ - var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#Country/Troll Face@Spain#Country.jpg
181
+ - var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#ReGiOn/Troll Face@Spain#ReGiOn.jpg
182
+ - var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#STREET/Troll Face@Spain#STREET.jpg
183
+ - var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#city/Troll Face@Spain#city.jpg
184
+ - var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#wOrld/Troll Face@Spain#wOrld.jpg
185
+ - var/ts/tc_accuracies/Testing Collection/Troll Face@Spain/Troll Face@Spain.jpg
186
+ - var/ts/tc_collections/Testing Collection 2/ Troll Face A/troll-face A1.jpg
187
+ - var/ts/tc_collections/Testing Collection 2/ Troll Face B/troll-face B1.jpg
188
+ - var/ts/tc_collections/Testing Collection 2/ Troll Face B/troll-face B2.jpg
189
+ - var/ts/tc_collections/Testing Collection 3/ Troll Face A/troll-face A1.jpg
190
+ - var/ts/tc_collections/Testing Collection 3/ Troll Face B/troll-face B1.jpg
191
+ - var/ts/tc_collections/Testing Collection 3/ Troll Face B/troll-face B2.jpg
192
+ - var/ts/tc_collections/Testing Collection 3/ Troll Face C/troll-face C1.jpg
193
+ - var/ts/tc_collections/Testing Collection 3/ Troll Face C/troll-face C2.jpg
194
+ - var/ts/tc_collections/Testing Collection 3/ Troll Face C/troll-face C3.jpg
195
+ - var/ts/tc_date_taken/Testing Collection/With Exif Metadata/ork.jpg
196
+ - var/ts/tc_date_taken/Testing Collection/With Exif Metadata/ork.tiff
197
+ - var/ts/tc_date_taken/Testing Collection/Without Exif Metadata/ork.gif
198
+ - var/ts/tc_date_taken/Testing Collection/Without Exif Metadata/ork.jpg
199
+ - var/ts/tc_filetypes/DUMMY_FILE
200
+ - var/ts/tc_filetypes/Testing Collection/Photo/GIF photo.GiF
201
+ - var/ts/tc_filetypes/Testing Collection/Photo/JPEG photo.jpEg
202
+ - var/ts/tc_filetypes/Testing Collection/Photo/JPG photo.jpg
203
+ - var/ts/tc_filetypes/Testing Collection/Photo/PNG photo.PNG
204
+ - var/ts/tc_filetypes/Testing Collection/Photo/TGA photo.TGA
205
+ - var/ts/tc_filetypes/Testing Collection/Photo/TIFF photo.TifF
206
+ - var/ts/tc_filetypes/Testing Collection/Photo/dummy.tmp
207
+ - var/ts/tc_filetypes/Testing Collection/Photo/dummy.txt
208
+ - var/ts/tc_filetypes/Testing Collection/Video/avi video.AVI
209
+ - var/ts/tc_filetypes/Testing Collection/Video/dummy.tgz
210
+ - var/ts/tc_filetypes/Testing Collection/Video/dummy.zip
211
+ - var/ts/tc_filetypes/Testing Collection/Video/mpeg video.mpEg
212
+ - var/ts/tc_filetypes/Testing Collection/Video/mpg video.mpg
213
+ - var/ts/tc_filetypes/Testing Collection/dummy.doc
214
+ - var/ts/tc_filetypes/Testing Collection/dummy.txt
215
+ - var/ts/tc_large_files/Testing Collection/Too Large!/80MB-of-zeros.mpg.zip
216
+ - var/ts/tc_locations/Testing Collection/Quebec#region/Quebec#region.jpg
217
+ - var/ts/tc_locations/Testing Collection/Troll Face/Troll Face.jpg
218
+ - var/ts/tc_locations/Testing Collection/Troll Face@38.356797,-0.474376#world/Troll Face@38.356797,-0.474376#world.jpg
219
+ - var/ts/tc_locations/Testing Collection/Troll Face@38.356797,-0.474376/Troll Face@38.356797,-0.474376.jpg
220
+ - var/ts/tc_locations/Testing Collection/Troll Face@Montreal/Troll Face@Montreal.jpg
221
+ - var/ts/tc_locations/Testing Collection/Troll Face@Quebec#region/Troll Face@Quebec#region.jpg
222
+ - var/ts/tc_whitespaces/Testing Collection/ Troll Face / Troll Face .jpg
223
+ - "var/ts/tc_whitespaces/Testing Collection/ Troll Face @ Spain # city / Troll Face @ Spain # city .jpg"
224
+ - var/ts/tc_whitespaces/Testing Collection/ Troll Face @ Spain / Troll Face @ Spain .jpg
180
225
  homepage: http://rubygems.org/gems/flickru
181
226
  licenses: []
182
227
 
@@ -206,3 +251,48 @@ specification_version: 3
206
251
  summary: Command-line Flickr upload automator
207
252
  test_files:
208
253
  - spec/flickru_spec.rb
254
+ - var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#Country/Troll Face@Spain#Country.jpg
255
+ - var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#ReGiOn/Troll Face@Spain#ReGiOn.jpg
256
+ - var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#STREET/Troll Face@Spain#STREET.jpg
257
+ - var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#city/Troll Face@Spain#city.jpg
258
+ - var/ts/tc_accuracies/Testing Collection/Troll Face@Spain#wOrld/Troll Face@Spain#wOrld.jpg
259
+ - var/ts/tc_accuracies/Testing Collection/Troll Face@Spain/Troll Face@Spain.jpg
260
+ - var/ts/tc_collections/Testing Collection 2/ Troll Face A/troll-face A1.jpg
261
+ - var/ts/tc_collections/Testing Collection 2/ Troll Face B/troll-face B1.jpg
262
+ - var/ts/tc_collections/Testing Collection 2/ Troll Face B/troll-face B2.jpg
263
+ - var/ts/tc_collections/Testing Collection 3/ Troll Face A/troll-face A1.jpg
264
+ - var/ts/tc_collections/Testing Collection 3/ Troll Face B/troll-face B1.jpg
265
+ - var/ts/tc_collections/Testing Collection 3/ Troll Face B/troll-face B2.jpg
266
+ - var/ts/tc_collections/Testing Collection 3/ Troll Face C/troll-face C1.jpg
267
+ - var/ts/tc_collections/Testing Collection 3/ Troll Face C/troll-face C2.jpg
268
+ - var/ts/tc_collections/Testing Collection 3/ Troll Face C/troll-face C3.jpg
269
+ - var/ts/tc_date_taken/Testing Collection/With Exif Metadata/ork.jpg
270
+ - var/ts/tc_date_taken/Testing Collection/With Exif Metadata/ork.tiff
271
+ - var/ts/tc_date_taken/Testing Collection/Without Exif Metadata/ork.gif
272
+ - var/ts/tc_date_taken/Testing Collection/Without Exif Metadata/ork.jpg
273
+ - var/ts/tc_filetypes/DUMMY_FILE
274
+ - var/ts/tc_filetypes/Testing Collection/Photo/GIF photo.GiF
275
+ - var/ts/tc_filetypes/Testing Collection/Photo/JPEG photo.jpEg
276
+ - var/ts/tc_filetypes/Testing Collection/Photo/JPG photo.jpg
277
+ - var/ts/tc_filetypes/Testing Collection/Photo/PNG photo.PNG
278
+ - var/ts/tc_filetypes/Testing Collection/Photo/TGA photo.TGA
279
+ - var/ts/tc_filetypes/Testing Collection/Photo/TIFF photo.TifF
280
+ - var/ts/tc_filetypes/Testing Collection/Photo/dummy.tmp
281
+ - var/ts/tc_filetypes/Testing Collection/Photo/dummy.txt
282
+ - var/ts/tc_filetypes/Testing Collection/Video/avi video.AVI
283
+ - var/ts/tc_filetypes/Testing Collection/Video/dummy.tgz
284
+ - var/ts/tc_filetypes/Testing Collection/Video/dummy.zip
285
+ - var/ts/tc_filetypes/Testing Collection/Video/mpeg video.mpEg
286
+ - var/ts/tc_filetypes/Testing Collection/Video/mpg video.mpg
287
+ - var/ts/tc_filetypes/Testing Collection/dummy.doc
288
+ - var/ts/tc_filetypes/Testing Collection/dummy.txt
289
+ - var/ts/tc_large_files/Testing Collection/Too Large!/80MB-of-zeros.mpg.zip
290
+ - var/ts/tc_locations/Testing Collection/Quebec#region/Quebec#region.jpg
291
+ - var/ts/tc_locations/Testing Collection/Troll Face/Troll Face.jpg
292
+ - var/ts/tc_locations/Testing Collection/Troll Face@38.356797,-0.474376#world/Troll Face@38.356797,-0.474376#world.jpg
293
+ - var/ts/tc_locations/Testing Collection/Troll Face@38.356797,-0.474376/Troll Face@38.356797,-0.474376.jpg
294
+ - var/ts/tc_locations/Testing Collection/Troll Face@Montreal/Troll Face@Montreal.jpg
295
+ - var/ts/tc_locations/Testing Collection/Troll Face@Quebec#region/Troll Face@Quebec#region.jpg
296
+ - var/ts/tc_whitespaces/Testing Collection/ Troll Face / Troll Face .jpg
297
+ - "var/ts/tc_whitespaces/Testing Collection/ Troll Face @ Spain # city / Troll Face @ Spain # city .jpg"
298
+ - var/ts/tc_whitespaces/Testing Collection/ Troll Face @ Spain / Troll Face @ Spain .jpg