diff options
author | erikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0> | 2007-10-25 01:25:40 (GMT) |
---|---|---|
committer | erikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0> | 2007-10-25 01:25:40 (GMT) |
commit | 27ca5df8cd4a2b2e35a0d66206aae5aafa3cac59 (patch) | |
tree | 995d8802a2ba647dc59db2d44d24abdb70ac4429 /recorded.py | |
parent | d150df5dbcbbf8f24c99e2b81afb924592f26c32 (diff) |
rounded up all base64decs into one function
git-svn-id: http://mediamods.com/public-svn/camera-activity/Record.activity@727 574bc980-5f2d-0410-acbc-c8f9f0eb14e0
Diffstat (limited to 'recorded.py')
-rw-r--r-- | recorded.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/recorded.py b/recorded.py index f306383..30f791b 100644 --- a/recorded.py +++ b/recorded.py @@ -101,12 +101,8 @@ class Recorded: if (self.datastoreOb == None): print("RecordActivity error -- unable to get datastore object in getThumbPixbuf") return None - pbl = gtk.gdk.PixbufLoader() - import base64 - data = base64.b64decode(self.datastoreOb.metadata['preview']) - pbl.write(data) - pbl.close() - return pbl.get_pixbuf() + + return self.pixbufFromString( self.datastoreOb.metadata['preview'] ) def getThumbFilepath( self, meshReq ): @@ -124,16 +120,11 @@ class Recorded: if (self.datastoreOb == None): print("RecordActivity error -- unable to get datastore object in getThumbPixbuf") return None - pbl = gtk.gdk.PixbufLoader() - import base64 - data = base64.b64decode(self.datastoreOb.metadata['preview']) - pbl.write(data) - pbl.close() + img = self.pixbufFromString( self.datastoreOb.metadata['preview'] ) thumbFilepath = os.path.join( self.ca.tempPath, "thumb.png") thumbFilepath = self.ca.m.getUniqueFilepath(thumbFilepath, 0) - pbl.get_pixbuf().save(thumbFilepath, "png", {} ) - + img.save(thumbFilepath, "png", {} ) return thumbFilepath return None @@ -192,4 +183,13 @@ class Recorded: #if this is a buddy's media and you only ever got a thumbnail, then return null and query for the real deal... - return self.datastoreOb.file_path
\ No newline at end of file + return self.datastoreOb.file_path + + + def pixbufFromString( self, str ): + pbl = gtk.gdk.PixbufLoader() + import base64 + data = base64.b64decode( str ) + pbl.write(data) + pbl.close() + return pbl.get_pixbuf()
\ No newline at end of file |