flickru 0.1.0 → 0.1.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/bin/geowiki +1 -1
- data/lib/flickru/location.rb +5 -5
- data/lib/flickru/version.rb +1 -1
- metadata +3 -3
data/bin/geowiki
CHANGED
@@ -61,7 +61,7 @@ curl "http://en.wikipedia.org/wiki/$PAGE" -o "$TMP" 2> /dev/null
|
|
61
61
|
clean_up 1
|
62
62
|
fi
|
63
63
|
|
64
|
-
URL=`cat "$TMP" | tr '"' '\n' | grep geohack | head -n 1 | sed -e 's|&|\&|'`
|
64
|
+
URL=`cat "$TMP" | tr '"' '\n' | grep geohack | head -n 1 | sed -e 's|^//||' -e 's|&|\&|'`
|
65
65
|
|
66
66
|
if [ -z "$URL" ]; then
|
67
67
|
error $LINENO "location not found in Wikipedia page '$PAGE'"
|
data/lib/flickru/location.rb
CHANGED
@@ -49,7 +49,7 @@ class Location
|
|
49
49
|
private
|
50
50
|
|
51
51
|
def Location.parse location
|
52
|
-
#
|
52
|
+
# TODO special characters MAY be escaped
|
53
53
|
idx_accuracy = location.index('#') ? location.index('#') : location.length
|
54
54
|
idx_place = location.index('@') ? location.index('@') : idx_accuracy
|
55
55
|
|
@@ -61,7 +61,7 @@ private
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def Location.locate place
|
64
|
-
the_place = place #
|
64
|
+
the_place = place # needed for RuntimeError reporting
|
65
65
|
begin
|
66
66
|
place = Location.geowiki place \
|
67
67
|
if place !~ /^#{COORD_PATTERN}, *#{COORD_PATTERN}$/
|
@@ -100,9 +100,9 @@ private
|
|
100
100
|
|
101
101
|
def Location.geowiki place
|
102
102
|
wiki = open("http://en.wikipedia.org/wiki/#{place}").read
|
103
|
-
|
104
|
-
.first.sub('&','&')).read
|
105
|
-
|
103
|
+
tool = open(wiki.tr("\"", "\n").split("\n").grep(/geohack/) \
|
104
|
+
.first.sub(/^\/\//,'http://').sub('&','&')).read
|
105
|
+
geo = tool.split("\n").grep(/<span class="geo"/).first
|
106
106
|
latitude = geo.sub(/^.*"Latitude">/, '').sub(/<\/span>, .*/, '')
|
107
107
|
longitude = geo.sub(/.*"Longitude">/, '').sub(/<\/span>.*$/, '')
|
108
108
|
latitude + ", " + longitude
|
data/lib/flickru/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: flickru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
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:
|
13
|
+
date: 2013-05-02 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
23
|
+
version: 1.3.5
|
24
24
|
type: :runtime
|
25
25
|
version_requirements: *id001
|
26
26
|
- !ruby/object:Gem::Dependency
|