print('=============================================') print('Pages: {0} | Per page: {1} | Total: {2}'.format(npages, ppage, total)) print('=============================================') for pg in range(1, npages + 1): page = flickr.photos.getWithGeoData(api_key=api_key, user_id=user_id, privacy_filter='1', extras='geo,tags', page=pg, per_page=ppage)['photos']['photo'] ppage = len(page) print('\n\n\nPage: {0}/{1} | Photos: {2}'.format(pg, npages, ppage)) print('---------------------------------------------') for ph in range(0, ppage): procs.processPhoto(page[ph], photos_base_url, user_id, 0) print('\n\n') earth_file = open( "/home/pi/flickr_tasks/generate_kml/my_flickr_photos.earth.kml", "a") earth_file.write(" </Folder>\n</Document>\n</kml>\n") earth_file.close() mymaps_file = open( "/home/pi/flickr_tasks/generate_kml/my_flickr_photos.mymaps.kml", "a") mymaps_file.write(" </Folder>\n</Document>\n</kml>\n") mymaps_file.close()
#===== MAIN CODE ==============================================================# photos = flickr.people.getPhotos(user_id=user_id) npages = int(photos['photos']['pages']) ppage = int(photos['photos']['perpage']) total = int(photos['photos']['total']) print('=============================================') print('Pages: {0} | Per page: {1} | Total: {2}'.format(npages, ppage, total)) print('=============================================') summary = open(procs.summary_file, 'w') summary.write('SUMMARY REPORT:\n') summary.write('-----------------------------------------------\n') summary.close() for pg in range(npages, 0, -1): page = flickr.people.getPhotos(user_id=user_id, page=pg) ppage = len(page['photos']['photo']) print('\n\n\nPage: {0}/{1} | Photos: {2}'.format(pg, npages, ppage)) print('---------------------------------------------') for ph in range(ppage - 1, -1, -1): photo_id = page['photos']['photo'][ph]['id'] photo_title = page['photos']['photo'][ph]['title'] print(u'\nid: {0}\ntitle: {1}'.format(photo_id, photo_title)) procs.processPhoto(photo_id, photo_title, user_id) print('\n\n')
#===== MAIN CODE ==============================================================# photoset_id = data.photoset_id photoset = flickr.photosets.getPhotos(photoset_id=photoset_id, user_id=user_id) npages = int(photoset['photoset']['pages']) ppage = int(photoset['photoset']['perpage']) total = int(photoset['photoset']['total']) print('=============================================') print('Pages: {0} | Per page: {1} | Total: {2}'.format(npages, ppage, total)) print('=============================================') for pg in range(1, npages + 1): page = flickr.photosets.getPhotos(photoset_id=photoset_id, user_id=user_id, page=pg) ppage = len(page['photoset']['photo']) print('\n\nPage: {0}/{1} | Photos: {2}'.format(pg, npages, ppage)) print('---------------------------------------------') for ph in range(0, ppage): photo_id = page['photoset']['photo'][ph]['id'] photo_title = page['photoset']['photo'][ph]['title'] print(u'\nid: {0}\ntitle: {1}'.format(photo_id, photo_title)) procs.processPhoto(photo_id, user_id) print('\n')
print('=============================================') print('Pages: {0} | Per page: {1} | Total: {2}'.format(npages, ppage, total)) print('=============================================') for pg in range(1, npages + 1): page = flickr.people.getPhotos(user_id=user_id, page=pg) ppage = len(page['photos']['photo']) print('\n\n\nPage: {0}/{1} | Photos: {2}'.format(pg, npages, ppage)) print('---------------------------------------------') for ph in range(0, ppage): photo_id = page['photos']['photo'][ph]['id'] photo_title = page['photos']['photo'][ph]['title'] print(u'\nid: {0}\ntitle: {1}'.format(photo_id, photo_title)) set_id = procs.processPhoto(photo_id, photo_title, user_id, set_id, set_title) print('\n\n') # Send e-mail if set_id != '': try: #hostname = socket.gethostname() hostname = "Flickr\ Tasks" photos_url = flickr.people.getInfo( api_key=api_key, user_id=user_id)['person']['photosurl']['_content'] mail_body = "\"Some photos are missing exif information. Open the set \'{0}\' to see them:\n{1}albums/{2}\"".format( set_title, photos_url, set_id) mail_send = "echo {0} | mail -s {1} -a From:\{2}\<{3}\> {4}".format( mail_body, mail.SUBJECT, hostname, mail.FROM, mail.TO)
procs.createDeleteFile() photos = flickr.people.getPhotos(user_id=user_id) npages = int(photos['photos']['pages']) ppage = int(photos['photos']['perpage']) total = int(photos['photos']['total']) print('=============================================') print('Pages: {0} | Per page: {1} | Total: {2}'.format(npages, ppage, total)) print('=============================================') user_url = flickr.urls.getUserPhotos(api_key=api_key)['user']['url'] for pg in range(1, npages + 1): page = flickr.people.getPhotos(user_id=user_id, page=pg) ppage = len(page['photos']['photo']) print('\n\n\nPage: {0}/{1} | Photos: {2}'.format(pg, npages, ppage)) print('---------------------------------------------') for ph in range(0, ppage): photo_id = page['photos']['photo'][ph]['id'] photo_title = page['photos']['photo'][ph]['title'] photo_url = user_url + photo_id print(u'\nid: {0}\ntitle: {1}\nurl: {2}'.format( photo_id, photo_title, photo_url)) procs.processPhoto(photo_id, photo_title, photo_url) print('\n\n')