diff options
Diffstat (limited to 'recorded.py')
-rwxr-xr-x[-rw-r--r--] | recorded.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/recorded.py b/recorded.py index 9296742..d4e6d64 100644..100755 --- a/recorded.py +++ b/recorded.py @@ -24,10 +24,13 @@ import gtk import constants from instance import Instance import utils +import datetime import serialize +import copy class Recorded: - def __init__( self ): + def __init__( self, activity ): + self.activity = activity self.type = -1 self.time = None self.recorderName = None @@ -40,6 +43,10 @@ class Recorded: self.mediaBytes = None self.thumbBytes = None self.tags = None + + #set location of the files (if it may change upstream) + self.loc = self.activity.Instance.get_path() + self.saveInternal = True #flag to alert need to re-datastore the title self.metaChange = False @@ -52,6 +59,8 @@ class Recorded: self.mediaFilename = None self.thumbFilename = None self.audioImageFilename = None + self.oldFilename = None + self.oldFilepath = 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 @@ -115,11 +124,11 @@ class Recorded: def getThumbFilepath( self ): if not self.thumbFilename: return None - return os.path.join(Instance.instancePath, self.thumbFilename) + return os.path.join(self.activity.Instance.get_path(), self.thumbFilename) def make_thumb_path(self): thumbFilename = self.mediaFilename + "_thumb.jpg" - thumbFilepath = os.path.join(Instance.instancePath, thumbFilename) + thumbFilepath = os.path.join(self.activity.Instance.get_path(), thumbFilename) thumbFilepath = utils.getUniqueFilepath(thumbFilepath, 0) self.thumbFilename = os.path.basename(thumbFilepath) return self.getThumbFilepath() @@ -139,34 +148,33 @@ class Recorded: def getAudioImageFilepath( self ): if (self.audioImageFilename != None): - audioFilepath = os.path.join(Instance.instancePath, self.audioImageFilename) + audioFilepath = os.path.join(self.activity.Instance.get_path(), 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) + mediaFilepath = os.path.join(self.activity.Instance.get_path(), 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) + mediaFilepath = os.path.join(self.activity.Instance.get_path(), 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.MEDIA_INFO[self.type]['ext'] - recdPath = os.path.join(Instance.instancePath, "recdFile_"+self.mediaMd5+"."+ext) + recdPath = os.path.join(self.activity.Instance.get_path(), "recdFile_"+self.mediaMd5+"."+ext) recdPath = utils.getUniqueFilepath(recdPath, 0) self.mediaFilename = os.path.basename(recdPath) - mediaFilepath = os.path.join(Instance.instancePath, self.mediaFilename) + mediaFilepath = os.path.join(self.activity.Instance.get_path(), self.mediaFilename) return os.path.abspath(mediaFilepath) else: - mediaFilepath = os.path.join(Instance.instancePath, self.mediaFilename) + mediaFilepath = os.path.join(self.activity.Instance.get_path(), self.mediaFilename) return os.path.abspath(mediaFilepath) else: #pulling from the datastore, regardless of who took it, cause we got it |