[PATCH] Picasa upload_photo



Hi. This patch can save some posts to the server when uploading photos
in PicasaTwoWay.
Index: conduit/modules/GoogleModule/GoogleModule.py
===================================================================
--- conduit/modules/GoogleModule/GoogleModule.py	(revision: 1460)
+++ conduit/modules/GoogleModule/GoogleModule.py	(working copy)
@@ -570,13 +570,16 @@
         
     def _upload_photo (self, uploadInfo):
         try:
-            gphoto = self.pws.InsertPhotoSimple(
-                                self.galbum,
-                                uploadInfo.name,
-                                uploadInfo.caption,
-                                uploadInfo.url)
-            for tag in uploadInfo.tags:
-                self.pws.InsertTag(gphoto, str(tag))
+            gphoto = gdata.photos.PhotoEntry()
+            gphoto.title = atom.Title(text=uploadInfo.name)
+            if uploadInfo.caption:
+                gphoto.summary = atom.Summary(text=uploadInfo.caption)
+            if uploadInfo.tags:
+                gphoto.media = gdata.media.Group()
+                gphoto.media.keywords = gdata.media.Keywords()
+                gphoto.media.keywords.text = ",".join("%s" % (str(t)) for t in uploadInfo.tags)
+
+            gphoto = self.pws.InsertPhoto(self.galbum, gphoto, uploadInfo.url)
             return Rid(uid=gphoto.gphoto_id.text)
         except Exception, e:
             raise Exceptions.SyncronizeError("Picasa Upload Error.")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]