diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-04-17 14:20:39 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2009-04-17 14:20:39 (GMT) |
commit | 7564597666a078d00ec7072d2abe2440e224e9c0 (patch) | |
tree | 5e2ccae70f58ce49892ab6f2f865ad3712a9d27b /recorded.py | |
parent | ccca798196b9eef3e08c93826f4d4f8f4f85327e (diff) |
Replate tabs by spaces
Diffstat (limited to 'recorded.py')
-rw-r--r-- | recorded.py | 282 |
1 files changed, 141 insertions, 141 deletions
diff --git a/recorded.py b/recorded.py index 488a01c..8639a70 100644 --- a/recorded.py +++ b/recorded.py @@ -30,144 +30,144 @@ import record class Recorded: - def __init__( self ): - self.type = -1 - self.time = None - self.recorderName = None - self.recorderHash = None - self.title = None - self.colorStroke = None - self.colorFill = None - self.mediaMd5 = None - self.thumbMd5 = None - self.mediaBytes = None - self.thumbBytes = None - self.tags = None - - #flag to alert need to re-datastore the title - self.metaChange = False - - #when you are datastore-serialized, you get one of these ids... - self.datastoreId = None - self.datastoreOb = None - - #if not from the datastore, then your media is here... - self.mediaFilename = None - self.thumbFilename = None - self.audioImageFilename = None - - #for flagging when you are being saved to the datastore for the first time... - #and just because you have a datastore id, doesn't mean you're saved - self.savedMedia = False - self.savedXml = False - - #assume you took the picture - self.buddy = False - self.downloadedFromBuddy = False - self.triedMeshBuddies = [] - self.meshDownloading = False - self.meshDownloadingFrom = "" - self.meshDownloadingFromNick = "" - self.meshDownlodingPercent = 0.0 - self.meshDownloadingProgress = False - #if someone is downloading this, then hold onto it - self.meshUploading = False - self.meshReqCallbackId = 0 - - self.deleted = False - - - def setTitle( self, newTitle ): - self.title = newTitle - self.metaChange = True - - - def setTags( self, newTags ): - self.tags = newTags - self.metaChange = True - - - def isClipboardCopyable( self ): - copyme = True - if (self.buddy): - if (not self.downloadedFromBuddy): - return False - return copyme - - - #scenarios: - #launch, your new thumb -- Journal/session - #launch, your new media -- Journal/session - #launch, their new thumb -- Journal/session/buddy - #launch, their new media -- ([request->]) Journal/session/buddy - #relaunch, your old thumb -- metadataPixbuf on request (or save to Journal/session..?) - #relaunch, your old media -- datastoreObject->file (hold onto the datastore object, delete if deleted) - #relaunch, their old thumb -- metadataPixbuf on request (or save to Journal/session..?) - #relaunch, their old media -- datastoreObject->file (hold onto the datastore object, delete if deleted) | ([request->]) Journal/session/buddy - - def getThumbPixbuf( self ): - thumbPixbuf = None - thumbFilepath = self.getThumbFilepath() - if ( os.path.isfile(thumbFilepath) ): - thumbPixbuf = gtk.gdk.pixbuf_new_from_file(thumbFilepath) - return thumbPixbuf - - - def getThumbFilepath( self ): - return os.path.join(Instance.instancePath, self.thumbFilename) - - - def getAudioImagePixbuf( self ): - audioPixbuf = None - - if (self.audioImageFilename == None): - audioPixbuf = self.getThumbPixbuf() - else: - audioFilepath = self.getAudioImageFilepath() - if (audioFilepath != None): - audioPixbuf = gtk.gdk.pixbuf_new_from_file(audioFilepath) - - return audioPixbuf - - - def getAudioImageFilepath( self ): - if (self.audioImageFilename != None): - audioFilepath = os.path.join(Instance.instancePath, self.audioImageFilename) - return os.path.abspath(audioFilepath) - else: - return self.getThumbFilepath() - - - def getMediaFilepath(self): - if (self.datastoreId == None): - if (not self.buddy): - #just taken by you, so it is in the tempSessionDir - mediaFilepath = os.path.join(Instance.instancePath, self.mediaFilename) - return os.path.abspath(mediaFilepath) - else: - if (self.downloadedFromBuddy): - #the user has requested the high-res version, and it has downloaded - mediaFilepath = os.path.join(Instance.instancePath, self.mediaFilename) - return os.path.abspath(mediaFilepath) - else: - if self.mediaFilename == None: - #creating a new filepath, probably just got here from the mesh - ext = Constants.mediaTypes[self.type][Constants.keyExt] - recdPath = os.path.join(Instance.instancePath, "recdFile_"+self.mediaMd5+"."+ext) - recdPath = utils.getUniqueFilepath(recdPath, 0) - self.mediaFilename = os.path.basename(recdPath) - mediaFilepath = os.path.join(Instance.instancePath, self.mediaFilename) - return os.path.abspath(mediaFilepath) - else: - mediaFilepath = os.path.join(Instance.instancePath, self.mediaFilename) - return os.path.abspath(mediaFilepath) - - else: #pulling from the datastore, regardless of who took it, cause we got it - #first, get the datastoreObject and hold the reference in this Recorded instance - if (self.datastoreOb == None): - self.datastoreOb = serialize.getMediaFromDatastore( self ) - if (self.datastoreOb == None): - print("RecordActivity error -- unable to get datastore object in getMediaFilepath") - return None - - return self.datastoreOb.file_path
\ No newline at end of file + def __init__( self ): + self.type = -1 + self.time = None + self.recorderName = None + self.recorderHash = None + self.title = None + self.colorStroke = None + self.colorFill = None + self.mediaMd5 = None + self.thumbMd5 = None + self.mediaBytes = None + self.thumbBytes = None + self.tags = None + + #flag to alert need to re-datastore the title + self.metaChange = False + + #when you are datastore-serialized, you get one of these ids... + self.datastoreId = None + self.datastoreOb = None + + #if not from the datastore, then your media is here... + self.mediaFilename = None + self.thumbFilename = None + self.audioImageFilename = None + + #for flagging when you are being saved to the datastore for the first time... + #and just because you have a datastore id, doesn't mean you're saved + self.savedMedia = False + self.savedXml = False + + #assume you took the picture + self.buddy = False + self.downloadedFromBuddy = False + self.triedMeshBuddies = [] + self.meshDownloading = False + self.meshDownloadingFrom = "" + self.meshDownloadingFromNick = "" + self.meshDownlodingPercent = 0.0 + self.meshDownloadingProgress = False + #if someone is downloading this, then hold onto it + self.meshUploading = False + self.meshReqCallbackId = 0 + + self.deleted = False + + + def setTitle( self, newTitle ): + self.title = newTitle + self.metaChange = True + + + def setTags( self, newTags ): + self.tags = newTags + self.metaChange = True + + + def isClipboardCopyable( self ): + copyme = True + if (self.buddy): + if (not self.downloadedFromBuddy): + return False + return copyme + + + #scenarios: + #launch, your new thumb -- Journal/session + #launch, your new media -- Journal/session + #launch, their new thumb -- Journal/session/buddy + #launch, their new media -- ([request->]) Journal/session/buddy + #relaunch, your old thumb -- metadataPixbuf on request (or save to Journal/session..?) + #relaunch, your old media -- datastoreObject->file (hold onto the datastore object, delete if deleted) + #relaunch, their old thumb -- metadataPixbuf on request (or save to Journal/session..?) + #relaunch, their old media -- datastoreObject->file (hold onto the datastore object, delete if deleted) | ([request->]) Journal/session/buddy + + def getThumbPixbuf( self ): + thumbPixbuf = None + thumbFilepath = self.getThumbFilepath() + if ( os.path.isfile(thumbFilepath) ): + thumbPixbuf = gtk.gdk.pixbuf_new_from_file(thumbFilepath) + return thumbPixbuf + + + def getThumbFilepath( self ): + return os.path.join(Instance.instancePath, self.thumbFilename) + + + def getAudioImagePixbuf( self ): + audioPixbuf = None + + if (self.audioImageFilename == None): + audioPixbuf = self.getThumbPixbuf() + else: + audioFilepath = self.getAudioImageFilepath() + if (audioFilepath != None): + audioPixbuf = gtk.gdk.pixbuf_new_from_file(audioFilepath) + + return audioPixbuf + + + def getAudioImageFilepath( self ): + if (self.audioImageFilename != None): + audioFilepath = os.path.join(Instance.instancePath, self.audioImageFilename) + return os.path.abspath(audioFilepath) + else: + return self.getThumbFilepath() + + + def getMediaFilepath(self): + if (self.datastoreId == None): + if (not self.buddy): + #just taken by you, so it is in the tempSessionDir + mediaFilepath = os.path.join(Instance.instancePath, self.mediaFilename) + return os.path.abspath(mediaFilepath) + else: + if (self.downloadedFromBuddy): + #the user has requested the high-res version, and it has downloaded + mediaFilepath = os.path.join(Instance.instancePath, self.mediaFilename) + return os.path.abspath(mediaFilepath) + else: + if self.mediaFilename == None: + #creating a new filepath, probably just got here from the mesh + ext = Constants.mediaTypes[self.type][Constants.keyExt] + recdPath = os.path.join(Instance.instancePath, "recdFile_"+self.mediaMd5+"."+ext) + recdPath = utils.getUniqueFilepath(recdPath, 0) + self.mediaFilename = os.path.basename(recdPath) + mediaFilepath = os.path.join(Instance.instancePath, self.mediaFilename) + return os.path.abspath(mediaFilepath) + else: + mediaFilepath = os.path.join(Instance.instancePath, self.mediaFilename) + return os.path.abspath(mediaFilepath) + + else: #pulling from the datastore, regardless of who took it, cause we got it + #first, get the datastoreObject and hold the reference in this Recorded instance + if (self.datastoreOb == None): + self.datastoreOb = serialize.getMediaFromDatastore( self ) + if (self.datastoreOb == None): + print("RecordActivity error -- unable to get datastore object in getMediaFilepath") + return None + + return self.datastoreOb.file_path
\ No newline at end of file |