faisalraja / flickrsmartsync

Sync your photos to flickr
121 stars 49 forks source link

Video downloads can now work #31

Closed gaberad closed 9 years ago

gaberad commented 10 years ago

I needed to download original videos from flickr, but saw that the download video part was commented out. So I looked into seeing if I could enable it and have been successful in doing so.

It's essentially what was already there, just a couple of tweaks for the filtering of json:

Uncommented it all, changed "startswith('Site')" to "startswith('Video Original')" and removed ".replace('/site/', '/orig/')", and commented out the "continue"

if is_download and photo.get('media') == 'video':
    photo_args = args.copy()
    photo_args['photo_id'] = photo['id']
    sizes = json.loads(api.photos_getSizes(**photo_args))
    if sizes['stat'] != 'ok':
        continue

    original = filter(lambda s: s['label'].startswith('Video Original') and s['media'] == 'video', sizes['sizes']['size'])
    if original:
        photos[photo['title']] = original.pop()['source']
        #     print photos
        # Skipts download video for now since it doesn't work
        #continue

It downloaded all the videos in their original format for me, and MD5 checksums matched.

I can do a pull request if you want, or unless you want to do some testing yourself?

faisalraja commented 10 years ago

Sure I'll just test it after the merge. Thanks