Skip to content

Commit

Permalink
Use Flickr public URL instead of raw snapshot URL
Browse files Browse the repository at this point in the history
  • Loading branch information
loren committed Jul 30, 2014
1 parent 819aab9 commit 0ab10cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/workers/flickr_photos_importer.rb
Expand Up @@ -57,12 +57,16 @@ def store_photo(photo, type)
description: photo.description,
taken_at: photo.datetaken,
popularity: photo.views,
url: photo.url_o,
url: flickr_url(photo.owner, photo.id),
thumbnail_url: photo.url_q)
rescue Exception => e
Rails.logger.warn("Trouble storing Flickr photo #{photo.inspect}: #{e}")
end

def flickr_url(owner, flickr_id)
"http://www.flickr.com/photos/#{owner}/#{flickr_id}/"
end

def last_uploaded_ts(photos)
photos.to_a.last.dateupload.to_i
rescue Exception => e
Expand Down
2 changes: 1 addition & 1 deletion spec/workers/flickr_photos_importer_spec.rb
Expand Up @@ -60,7 +60,7 @@
expect(first.description).to eq('description1')
expect(first.taken_at).to eq(Date.parse("2014-07-09"))
expect(first.popularity).to eq(100)
expect(first.url).to eq('http://photo1')
expect(first.url).to eq('http://www.flickr.com/photos/owner1/photo1/')
expect(first.thumbnail_url).to eq('http://photo_thumbnail1')
end
end
Expand Down

0 comments on commit 0ab10cd

Please sign in to comment.