1. Joe Judge
  2. django-syncr

Commits

Joe Judge  committed 32d1860

add thumbnails, fix indenting

  • Participants
  • Parent commits 0f3db30
  • Branches default

Comments (0)

Files changed (3)

File syncr/app/picasaweb.py

View file
  • Ignore whitespace
         delta = timedelta(seconds=3)
         if self.cli_verbose:
             status = created and 'created' or 'already exists (same)'
-            #if not created and d_album.updated < updated:
             if not created and updated > (d_album.updated + delta):
                 status = 'updated'
             print 'Album', album.title.text, status
-        #if not created and d_album.updated < updated:
         if not created and (updated > (d_album.updated + delta)):
             for (key, value) in default_dict.items():
                 setattr(d_album, key, value)

File syncr/picasaweb/management/commands/sync_picasaweb.py

View file
  • Ignore whitespace
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# vim: ai ts=4 sw=4 et
+
 """
 Todo:
 - add quiet command
 from optparse import make_option
 import getpass
 
+
 class Command(BaseCommand):
+
     option_list = BaseCommand.option_list + (
-	make_option('--username', '-u', action='store', dest='username',
-		    help='Google account username'),
-	make_option('--password', '-p', action='store', dest='password',
-		    help='Google account password'),
-    )
+            make_option('--username', '-u', action='store', dest='username',
+                help='Google account username'), 
+            make_option('--password', '-p', action='store', dest='password',
+                help='Google account password')
+            )
 
-    help = "Sync picasaweb information for given username and password."
-    args = "[picasaweb username] [picasaweb albumname]"
-    
+    help = 'Sync picasaweb information for given username and password.'
+    args = '[picasaweb albumname(s)]'
+
     requires_model_validation = True
-    
+
     def handle(self, *args, **options):
-	if len(args) > 2:
-            raise CommandError("need zero, one or two arguments. Optional arguments are [user-to-sync] [album-to-sync]")
 
-	from syncr.app.picasaweb import PicasawebSyncr
-	
-	username = options.get('username', None)
-	password = options.get('password', None)
-	
-	if not username:
-	    username = raw_input("Username: ")
-	if username=="" or len(username)<3:
-	    raise CommandError("invalid username")
-	
-	if not password:
-	    password = getpass.getpass()
-	
-	picasaweb_user = username
-	picasaweb_album = None
-	if len(args)==1:
-	    picasaweb_user, = args
-	elif len(args)==2:
-	    picasaweb_user, picasaweb_album = args
-	
-	print "Updating picasaweb for %s" % username
-	ps = PicasawebSyncr(username, password, cli_verbose=1)
-	if picasaweb_album is not None:
-	    ps.syncAlbum(picasaweb_album, username=picasaweb_user)
-	else:
-	    ps.syncAllAlbums(username=picasaweb_user)
-	
-	
+        from syncr.app.picasaweb import PicasawebSyncr
+
+        username = options.get('username', None)
+        password = options.get('password', None)
+
+        if not username:
+            username = raw_input('Username: ')
+        if username == '' or len(username) < 3:
+            raise CommandError('invalid username')
+
+        if not password:
+            password = getpass.getpass()
+
+        picasaweb_user = username
+        picasaweb_album = None
+
+        ps = PicasawebSyncr(username, password, cli_verbose=1)
+        if not args:
+            print 'Updating all picasaweb albums for %s' % username
+            ps.syncAllAlbums(username=picasaweb_user)
+        else:
+            print 'Updating picasaweb albums for %s' % username
+            for picasaweb_album in args:
+                ps.syncAlbum(picasaweb_album, username=picasaweb_user)

File syncr/picasaweb/models.py

View file
  • Ignore whitespace
     thumbnail_url = models.URLField()
     content_url = models.URLField()
     #tag_list = models.CharField(max_length=250)
-    tags = TagField()
+    tags = TagField(null=True) # joe
     enable_comments = models.BooleanField(default=True)
     #license = models.CharField(max_length=50, choices=FLICKR_LICENSES)
     geo_latitude = models.CharField(max_length=50, blank=True)
     updated = models.DateTimeField()
 
     def numPhotos(self):
+        #return len(self.photo_list.objects.all())
         return self.photos.count()
 
     def __unicode__(self):
     description = models.CharField(max_length=512) # summary in api
     location = models.CharField(max_length=200)
     updated = models.DateTimeField()
+    thumbnail_url = models.URLField()
+    thumbnail_height = models.IntegerField()
+    thumbnail_width = models.IntegerField()
     
     photos = models.ManyToManyField('Photo')
     access = models.CharField(max_length=10, choices=PICASAWEB_ACCESS)
 
     def numPhotos(self):
+        #return len(self.photos.objects.all())
         return self.photos.count()
 
     def __unicode__(self):