squarepusher 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5af95a1bb91651737acad0bd3c7bdbc9da54f32a
4
- data.tar.gz: 0f0a0b49404d9c572cb9409c8ad85be2078691de
3
+ metadata.gz: 857a2153d16ce0f3f8fbd698af1518f2c0795459
4
+ data.tar.gz: 9f9ac1657c7967278e5fcd9a2294d8eb1759c79e
5
5
  SHA512:
6
- metadata.gz: 26dce1e4adf0be47f7e9be0588c898841d55faa009295102c411aee30928b02a7726586686003d88f2f1c952837b8fd281625d56f21532fb602c96ffc18892f4
7
- data.tar.gz: 3d4f3a7853e96ef738a595830157ac32610bbf4bd550137b59dbb81772a39bc68f01e12e1dde18da6125b364984ebe33dfdbbd7475a29f66b9930da557bc20aa
6
+ metadata.gz: 55bfd7340dc575c01a0f2431d6b7edf55be2c67a86add122ccc84951293dd1ab9137de9638d57ec5d131986c8ff1a23aa3b54e478fb047f0dfecd8a3c2e5dc28
7
+ data.tar.gz: d167388c0eed291d355c036dbfbd6fe4ebcf487f1f05cfc9fddf2ff72b0629b0ee8c7b346fe70b98c39bbf0bddddd3184a7678c0ae93cdf2d5b403c0ebf6b1b0
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Squarepusher
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
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.5
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-09-29 00:00:00.000000000 Z
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: []