
Untitled
By: a guest on
Aug 3rd, 2012 | syntax:
None | size: 0.75 KB | hits: 7 | expires: Never
flickr = require './flickr'
photos = flickr.results.photos.photo
# Example input object
###
id: 6711220011
owner: 43769855@N02
secret: fa596d04c5
server: 7162
farm: 8
title: 109
ispublic: 1
isfriend: 0
isfamily": 0
###
# Example target object
###
id: "5681612321"
image: "http://farm6.static.flickr.com/5188/5681612321_681b61281e_z.jpg"
thumbnail: "http://farm6.static.flickr.com/5188/5681612321_681b61281e_s.jpg"
###
new_photos = []
console.log 'mapping', photos.length, 'original photos'
for p in photos
new_photos.push
id: p.id
image: "http://farm#{p.farm}.staticflickr.com/#{p.server}/#{p.id}_#{p.secret}_z.jpg"
thumbnail: "http://farm#{p.farm}.staticflickr.com/#{p.server}/#{p.id}_#{p.secret}_s.jpg"
console.log 'done.\n', JSON.stringify new_photos