squarepusher 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/squarepusher/core.rb +25 -3
- data/lib/squarepusher/version.rb +1 -1
- data/squarepusher.gemspec +2 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 857a2153d16ce0f3f8fbd698af1518f2c0795459
|
4
|
+
data.tar.gz: 9f9ac1657c7967278e5fcd9a2294d8eb1759c79e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55bfd7340dc575c01a0f2431d6b7edf55be2c67a86add122ccc84951293dd1ab9137de9638d57ec5d131986c8ff1a23aa3b54e478fb047f0dfecd8a3c2e5dc28
|
7
|
+
data.tar.gz: d167388c0eed291d355c036dbfbd6fe4ebcf487f1f05cfc9fddf2ff72b0629b0ee8c7b346fe70b98c39bbf0bddddd3184a7678c0ae93cdf2d5b403c0ebf6b1b0
|
data/lib/squarepusher/core.rb
CHANGED
@@ -188,10 +188,15 @@ module Squarepusher
|
|
188
188
|
return flickr.photos.search(args)
|
189
189
|
end
|
190
190
|
|
191
|
+
def random_contact
|
192
|
+
contact_hash = flickr.contacts.getList().to_hash()
|
193
|
+
pages = contact_hash["pages"].to_i
|
194
|
+
puts "WARNING - #{pages} pages of contacts found - only using first one" if pages > 1
|
195
|
+
contacts = contact_hash["contact"]
|
196
|
+
contacts[rand(contacts.size)]
|
197
|
+
end
|
198
|
+
|
191
199
|
def random_favorite_of_mine(args={})
|
192
|
-
# TODO: find a clean way to select a random page
|
193
|
-
# may need to allow client to pass in context object to store
|
194
|
-
# page count, which could be persisted by client to disk, cache, db, etc.
|
195
200
|
faves = flickr.favorites.getList(args)
|
196
201
|
raise Exception.new("no favorites found") if faves.size == 0
|
197
202
|
|
@@ -207,6 +212,23 @@ module Squarepusher
|
|
207
212
|
choice
|
208
213
|
end
|
209
214
|
|
215
|
+
def random_favorite_of_contact(contact_id, args={})
|
216
|
+
args[:user_id] = contact_id
|
217
|
+
faves = flickr.favorites.getPublicList(args)
|
218
|
+
raise Exception.new("no favorites found") if faves.size == 0
|
219
|
+
|
220
|
+
faves_hash = faves.to_hash
|
221
|
+
# puts "hash: #{faves_hash.inspect}"
|
222
|
+
photos = faves_hash["photo"]
|
223
|
+
pages = faves_hash["pages"]
|
224
|
+
|
225
|
+
fire_event(:domain => :flickr, :user => contact_id, :favorite_page_count => pages)
|
226
|
+
|
227
|
+
choice = photos[rand(photos.size)]
|
228
|
+
|
229
|
+
choice
|
230
|
+
end
|
231
|
+
|
210
232
|
def download_favorites(output_dir, page=1, &photo_call)
|
211
233
|
puts "page: #{page}"
|
212
234
|
count = 0
|
data/lib/squarepusher/version.rb
CHANGED
data/squarepusher.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.email = 'mhawthorne@gmail.com'
|
12
12
|
s.homepage = 'https://github.com/mhawthorne/squarepusher'
|
13
13
|
s.summary = "downloads photos from flickr"
|
14
|
+
s.license = 'Apache 2.0'
|
14
15
|
|
15
16
|
s.add_dependency 'flickraw'
|
16
17
|
|
@@ -20,4 +21,4 @@ Gem::Specification.new do |s|
|
|
20
21
|
s.require_paths = ["lib"]
|
21
22
|
|
22
23
|
s.rubyforge_project = 'nowarning'
|
23
|
-
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squarepusher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mhawthorne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flickraw
|
@@ -42,7 +42,8 @@ files:
|
|
42
42
|
- lib/squarepusher/version.rb
|
43
43
|
- squarepusher.gemspec
|
44
44
|
homepage: https://github.com/mhawthorne/squarepusher
|
45
|
-
licenses:
|
45
|
+
licenses:
|
46
|
+
- Apache 2.0
|
46
47
|
metadata: {}
|
47
48
|
post_install_message:
|
48
49
|
rdoc_options: []
|