def sync(self): f = FlickrSyncr(settings.FLICKR_API['key'], settings.FLICKR_API['secret'] ) for sync in settings.FLICKR_FOLLOW: f.syncAllPhotoSets(sync) logging.info('Sychronized')
def sync_flickr(): from syncr.app.flickr import FlickrSyncr key = settings.FLICKR['key'] secret = settings.FLICKR['secret'] username = settings.FLICKR['username'] fs = FlickrSyncr(key, secret) fs.syncRecentPhotos(username, days=1) for photo in Photo.objects.all(): try: fs.syncPhoto(photo.flickr_id) except Exception, e: print e
def flickr_synchronize2(request): if request.method == 'POST': form_username = GrabFlickrByUsername(request.POST) #flag = request.POST == ['choice'] if form_username.is_valid(): flickr_syncr_instance = FlickrSyncr(settings.FLICKR_API_KEY, settings.FLICKR_API_SECRET) flickr_username = request.POST["flickr_username"] log.info('FlickrSync by user name: "' + flickr_username + '" submitted. ' + 'It will sync All Photo Sets of ' + flickr_username) try: flickr_syncr_instance.syncAllPhotoSets(flickr_username) except AttributeError: errors = 'Error! Username "' + flickr_username + '" has no photosets or photos!' log.info('Sync for user "' + flickr_username + '" has failed') return render_to_response( 'cgbflickr/cgb_flickr2.html', { 'user': request.user, 'form': form_username, 'errors': errors, }) else: return render_to_response('cgbflickr/cgb_flickr2.html', { 'user': request.user, 'form': form_username, }) flickr_photos = Photo.objects.all().order_by( '-upload_date') #list of photos got flickr_photos_count = flickr_photos.count() #change user to flickr user data return render_to_response( 'cgbflickr/cgb_flickr3.html', { 'user': request.user, 'flickr_photos': flickr_photos, 'flickr_photos_count': flickr_photos_count, }) else: form_username = GrabFlickrByUsername() # An unbound form return render_to_response('cgbflickr/cgb_flickr2.html', { 'user': request.user, 'form': form_username, })
def update_feed(request): flickrSearchTerms = getattr(settings, 'FLICKR_SEARCH', 'ultimatefrisbee') flickrSyncr = FlickrSyncr(getattr(settings, 'FLICKR_KEY', None), getattr(settings, 'FLICKR_SECRET', None)) flickrSearchFeed = feedparser.parse('http://api.flickr.com/services/feeds/photos_public.gne?tags=' + flickrSearchTerms + '&format=atom') for photo in flickrSearchFeed.entries: photoID = photo.id.rsplit('/', 1)[1] try: flickrSyncr.syncPhoto(photoID) except FlickrError: print 'flickr parse error' messages.success(request, 'The social feed was updated successfully (maybe).') return HttpResponseRedirect(reverse('home')) return render_to_response('index/content.html', {'content': 'update'}, context_instance=RequestContext(request))
def flickr_synchronize2(request): if request.method == 'POST': form_username = GrabFlickrByUsername(request.POST) #flag = request.POST == ['choice'] if form_username.is_valid(): flickr_syncr_instance = FlickrSyncr(settings.FLICKR_API_KEY, settings.FLICKR_API_SECRET) flickr_username = request.POST["flickr_username"] log.info( 'FlickrSync by user name: "' + flickr_username + '" submitted. '+ 'It will sync All Photo Sets of '+ flickr_username ) try: flickr_syncr_instance.syncAllPhotoSets(flickr_username) except AttributeError: errors = 'Error! Username "'+flickr_username+'" has no photosets or photos!' log.info('Sync for user "'+flickr_username+'" has failed') return render_to_response ('cgbflickr/cgb_flickr2.html', {'user': request.user, 'form':form_username, 'errors':errors, }) else: return render_to_response('cgbflickr/cgb_flickr2.html', {'user': request.user, 'form':form_username, }) flickr_photos = Photo.objects.all().order_by('-upload_date')#list of photos got flickr_photos_count = flickr_photos.count() #change user to flickr user data return render_to_response('cgbflickr/cgb_flickr3.html', {'user': request.user, 'flickr_photos': flickr_photos, 'flickr_photos_count':flickr_photos_count, }) else: form_username = GrabFlickrByUsername()# An unbound form return render_to_response('cgbflickr/cgb_flickr2.html', {'user': request.user, 'form': form_username, })
def update_feed(request): # try: # twitterSyncr = TwitterSyncr('aaultimate') # twitterSearchFeed = feedparser.parse('http://search.twitter.com/search.atom?lang=en&q=ultimate+frisbee') # for tweet in twitterSearchFeed.entries: # twitterID = tweet.id[tweet.id.rindex(':')+1:] # try: # twitterSyncr.syncTweet(twitterID) # except TwitterError: # print 'twitter parse error' # except: # print 'twitter unknown error' # except: # print 'twitter unknown feed error' flickrSyncr = FlickrSyncr('1d6f830e7130f7196c4104d70589c031', '73ad75aac80ea1a8') flickrSearchFeed = feedparser.parse('http://api.flickr.com/services/feeds/photos_public.gne?tags=frisbee&format=atom') for photo in flickrSearchFeed.entries: photoID = photo.id.rsplit('/', 1)[1] try: flickrSyncr.syncPhoto(photoID) except FlickrError: print 'flickr parse error' messages.success(request, 'The social feed was updated successfully (maybe).') return HttpResponseRedirect(reverse('home')) return render_to_response('index/content.html', {'content': 'update'}, context_instance=RequestContext(request))
def sync_flickr(): from syncr.app.flickr import FlickrSyncr key = settings.FLICKR["key"] secret = settings.FLICKR["secret"] username = settings.FLICKR["username"] fs = FlickrSyncr(key, secret) fs.syncRecentPhotos(username, days=1) for photo in Photo.objects.all(): try: fs.syncPhoto(photo.flickr_id) except Exception as e: print(e)
def handle(self, *args, **options): f = FlickrSyncr(settings.API_KEY, settings.API_SECRET) f.syncMinimal('samuelclay', days=365)
import sys, os os.environ['DJANGO_SETTINGS_MODULE'] = 'spectrum.settings' import settings from django.conf import settings from syncr.app.delicious import DeliciousSyncr d = DeliciousSyncr(settings.DELICIOUS_USER, settings.DELICIOUS_PASS) d.syncRecent(count=20) from syncr.app.flickr import FlickrSyncr f = FlickrSyncr(settings.FLICKR_API_KEY, settings.FLICKR_API_SECRET) f.syncRecentPhotos('lather rinse repeat', days=60) from lastfm.lastfm import LastfmSyncr l=LastfmSyncr() l.syncposts(user='******', chart='weeklyartistchart') l.syncposts(user='******', chart='weeklytrackchart') l.syncposts(user='******', chart='weeklyalbumchart') l.syncposts(user='******', chart='recentlovedtracks') l.syncposts(user='******', chart='recenttracks') from tumblr.tumblr import TumblrSyncr t=TumblrSyncr() t.syncposts('missliz') t.syncposts('didntwrite')
def handle(self, *args, **options): f = FlickrSyncr(settings.API_KEY, settings.API_SECRET) f.syncAllPhotoSets('samuelclay')