Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0>2007-12-14 04:03:14 (GMT)
committer erikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0>2007-12-14 04:03:14 (GMT)
commitf706c43145128d40f8c639059800fe7282abe063 (patch)
tree9be98c6f44599722a4469fd08349a9c03d23197d
parent24abbc6129ac8b3b24eb30aa474fe5792239c817 (diff)
46 has correct rainbow tmp directories
git-svn-id: http://mediamods.com/public-svn/camera-activity/tags/46@973 574bc980-5f2d-0410-acbc-c8f9f0eb14e0
-rw-r--r--glive.py28
-rw-r--r--instance.py22
-rw-r--r--model.py20
-rwxr-xr-xrecord.py12
-rw-r--r--recorded.py14
-rw-r--r--serialize.py4
6 files changed, 46 insertions, 54 deletions
diff --git a/glive.py b/glive.py
index ecfa57a..194c4c9 100644
--- a/glive.py
+++ b/glive.py
@@ -171,11 +171,11 @@ class Glive:
movieQueue = pipeline.get_by_name("movieQueue_"+n)
movieFilesink = pipeline.get_by_name("movieFilesink_"+n)
- movieFilepath = os.path.join(Instance.instancePath, "output.ogg" ) #ogv
+ movieFilepath = os.path.join(Instance.tmpPath, "output.ogg" ) #ogv
movieFilesink.set_property("location", movieFilepath )
audioFilesink = pipeline.get_by_name('audioFilesink_'+n)
- audioFilepath = os.path.join(Instance.instancePath, "output.wav")
+ audioFilepath = os.path.join(Instance.tmpPath, "output.wav")
audioFilesink.set_property("location", audioFilepath )
audioTee = pipeline.get_by_name('audioTee_'+n)
audioWavenc = pipeline.get_by_name('audioWavenc_'+n)
@@ -207,7 +207,7 @@ class Glive:
videoTee.unlink(picQueue)
audioFilesink = pipeline.get_by_name('audioFilesink_'+n)
- audioFilepath = os.path.join(Instance.instancePath, "output.wav")
+ audioFilepath = os.path.join(Instance.tmpPath, "output.wav")
audioFilesink.set_property("location", audioFilepath )
elif (self._PIPETYPE == self.PIPETYPE_SUGAR_JHBUILD):
@@ -243,7 +243,7 @@ class Glive:
n = str(len(self.thumbPipes)-1)
thumbline.get_by_name( "thumbFakesink_"+n ).disconnect( self.THUMB_HANDOFF )
- oggFilepath = os.path.join(Instance.instancePath, "output.ogg" ) #ogv
+ oggFilepath = os.path.join(Instance.tmpPath, "output.ogg" ) #ogv
if (not os.path.exists(oggFilepath)):
self.record = False
self.ca.m.cannotSaveVideo()
@@ -274,7 +274,7 @@ class Glive:
def stoppedRecordingAudio( self ):
record.Record.log.debug("stoppedRecordingAudio")
if (self.audioPixbuf != None):
- audioFilepath = os.path.join(Instance.instancePath, "output.wav")#self.el("audioFilesink").get_property("location")
+ audioFilepath = os.path.join(Instance.tmpPath, "output.wav")#self.el("audioFilesink").get_property("location")
if (not os.path.exists(audioFilepath)):
self.record = False
self.audio = False
@@ -302,7 +302,7 @@ class Glive:
vorbisEnc.merge_tags(taglist, gst.TAG_MERGE_KEEP)
audioFilesink = audioline.get_by_name('audioFilesink_'+n)
- audioOggFilepath = os.path.join(Instance.instancePath, "output.ogg")
+ audioOggFilepath = os.path.join(Instance.tmpPath, "output.ogg")
audioFilesink.set_property("location", audioOggFilepath )
record.Record.log.debug("post audioFilesink")
@@ -401,13 +401,13 @@ class Glive:
del pic
self.thumbEl('thumbTee').unlink(self.thumbEl('thumbQueue'))
- oggFilepath = os.path.join(Instance.instancePath, "output.ogg") #ogv
+ oggFilepath = os.path.join(Instance.tmpPath, "output.ogg") #ogv
if (self.audio):
self.ca.ui.setPostProcessPixBuf(self.thumbBuf)
- wavFilepath = os.path.join(Instance.instancePath, "output.wav")
- muxFilepath = os.path.join(Instance.instancePath, "mux.ogg") #ogv
+ wavFilepath = os.path.join(Instance.tmpPath, "output.wav")
+ muxFilepath = os.path.join(Instance.tmpPath, "mux.ogg") #ogv
n = str(len(self.muxPipes))
muxline = gst.parse_launch('filesrc location=' + str(oggFilepath) + ' name=muxVideoFilesrc_'+n+' ! oggdemux name=muxOggdemux_'+n+' ! theoradec name=muxTheoradec_'+n+' ! theoraenc name=muxTheoraenc_'+n+' ! oggmux name=muxOggmux_'+n+' ! filesink location=' + str(muxFilepath) + ' name=muxFilesink_'+n+' filesrc location=' + str(wavFilepath) + ' name=muxAudioFilesrc_'+n+' ! wavparse name=muxWavparse_'+n+' ! audioconvert name=muxAudioconvert_'+n+' ! vorbisenc name=muxVorbisenc_'+n+' ! muxOggmux_'+n+'.')
@@ -465,9 +465,9 @@ class Glive:
pipe.get_bus().disable_sync_message_emission()
pipe.get_bus().remove_signal_watch()
- wavFilepath = os.path.join(Instance.instancePath, "output.wav")
- oggFilepath = os.path.join(Instance.instancePath, "output.ogg") #ogv
- muxFilepath = os.path.join(Instance.instancePath, "mux.ogg") #ogv
+ wavFilepath = os.path.join(Instance.tmpPath, "output.wav")
+ oggFilepath = os.path.join(Instance.tmpPath, "output.ogg") #ogv
+ muxFilepath = os.path.join(Instance.tmpPath, "mux.ogg") #ogv
os.remove( wavFilepath )
os.remove( oggFilepath )
self.ca.m.saveVideo(self.thumbBuf, str(muxFilepath), self.VIDEO_WIDTH_SMALL, self.VIDEO_HEIGHT_SMALL)
@@ -492,8 +492,8 @@ class Glive:
pipe.get_bus().disable_sync_message_emission()
pipe.get_bus().remove_signal_watch()
- wavFilepath = os.path.join(Instance.instancePath, "output.wav")
- oggFilepath = os.path.join(Instance.instancePath, "output.ogg")
+ wavFilepath = os.path.join(Instance.tmpPath, "output.wav")
+ oggFilepath = os.path.join(Instance.tmpPath, "output.ogg")
os.remove( wavFilepath )
self.ca.m.saveAudio(oggFilepath, self.audioPixbuf)
return False
diff --git a/instance.py b/instance.py
index 1c9db31..729bb5e 100644
--- a/instance.py
+++ b/instance.py
@@ -21,31 +21,23 @@ class Instance:
instanceId = None
tmpPath = None
- instancePath = None
+ dataPath = None
def __init__(self, ca):
self.__class__.instanceId = ca._activity_id
- tmpPath = os.path.join( ca.get_activity_root(), "tmp" )
- self.__class__.tmpPath = os.path.join( tmpPath, str(self.__class__.instanceId))
+
+ self.__class__.tmpPath = os.path.join(ca.get_activity_root(), "tmp")
recreateTmp()
- self.__class__.instancePath = os.path.join( ca.get_activity_root(), "instance" )
+ self.__class__.dataPath = os.path.join(ca.get_activity_root(), "data")
recreateInstance()
def recreateTmp():
- #todo: figure out how to have multiple spaces for my media
- #problem is, if new instance is created, with this code, it clears the whole tmp directory!
- if (os.path.exists(Instance.tmpPath)):
- shutil.rmtree(Instance.tmpPath)
if (not os.path.exists(Instance.tmpPath)):
os.makedirs(Instance.tmpPath)
-def recreateInstance():
- #todo: figure out how to have multiple spaces for my media
- #problem is, if new instance is created, with this code, it clears the whole tmp directory!
- if (os.path.exists(Instance.instancePath)):
- shutil.rmtree(Instance.instancePath)
- if (not os.path.exists(Instance.instancePath)):
- os.makedirs(Instance.instancePath) \ No newline at end of file
+def recreateData():
+ if (not os.path.exists(Instance.dataPath)):
+ os.makedirs(Instance.dataPath) \ No newline at end of file
diff --git a/model.py b/model.py
index ba721b7..45526ec 100644
--- a/model.py
+++ b/model.py
@@ -196,12 +196,12 @@ class Model:
recd = self.createNewRecorded( Constants.TYPE_AUDIO )
os.rename( tmpPath, os.path.join(Instance.instancePath,recd.mediaFilename))
- thumbPath = os.path.join(Instance.instancePath, recd.thumbFilename)
+ thumbPath = os.path.join(Instance.tmpPath, recd.thumbFilename)
scale = float((UI.dim_THUMB_WIDTH+0.0)/(pixbuf.get_width()+0.0))
thumbImg = utils.generateThumbnail(pixbuf, scale, UI.dim_THUMB_WIDTH, UI.dim_THUMB_HEIGHT)
thumbImg.write_to_png(thumbPath)
- imagePath = os.path.join(Instance.instancePath, "audioPicture.png")
+ imagePath = os.path.join(Instance.tmpPath, "audioPicture.png")
imagePath = utils.getUniqueFilepath( imagePath, 0 )
pixbuf.save( imagePath, "png", {} )
recd.audioImageFilename = os.path.basename(imagePath)
@@ -257,9 +257,9 @@ class Model:
def saveVideo( self, pixbuf, tmpPath, wid, hit ):
recd = self.createNewRecorded( Constants.TYPE_VIDEO )
- os.rename( tmpPath, os.path.join(Instance.instancePath,recd.mediaFilename))
+ os.rename( tmpPath, os.path.join(Instance.tmpPath,recd.mediaFilename))
- thumbPath = os.path.join(Instance.instancePath, recd.thumbFilename)
+ thumbPath = os.path.join(Instance.tmpPath, recd.thumbFilename)
scale = float((UI.dim_THUMB_WIDTH+0.0)/(wid+0.0))
thumbImg = utils.generateThumbnail(pixbuf, scale, UI.dim_THUMB_WIDTH, UI.dim_THUMB_HEIGHT)
thumbImg.write_to_png(thumbPath)
@@ -318,10 +318,10 @@ class Model:
def savePhoto( self, pixbuf ):
recd = self.createNewRecorded( Constants.TYPE_PHOTO )
- imgpath = os.path.join(Instance.instancePath, recd.mediaFilename)
+ imgpath = os.path.join(Instance.tmpPath, recd.mediaFilename)
pixbuf.save( imgpath, "jpeg" )
- thumbpath = os.path.join(Instance.instancePath, recd.thumbFilename)
+ thumbpath = os.path.join(Instance.tmpPath, recd.thumbFilename)
scale = float((UI.dim_THUMB_WIDTH+0.0)/(pixbuf.get_width()+0.0))
thumbImg = utils.generateThumbnail(pixbuf, scale, UI.dim_THUMB_WIDTH, UI.dim_THUMB_HEIGHT)
thumbImg.write_to_png(thumbpath)
@@ -358,12 +358,12 @@ class Model:
mediaThumbFilename = str(recd.recorderHash) + "_" + str(recd.time)
mediaFilename = mediaThumbFilename
mediaFilename = mediaFilename + "." + Constants.mediaTypes[type][Constants.keyExt]
- mediaFilepath = os.path.join( Instance.instancePath, mediaFilename )
+ mediaFilepath = os.path.join( Instance.tmpPath, mediaFilename )
mediaFilepath = utils.getUniqueFilepath( mediaFilepath, 0 )
recd.mediaFilename = os.path.basename( mediaFilepath )
thumbFilename = mediaThumbFilename + "_thumb.jpg"
- thumbFilepath = os.path.join( Instance.instancePath, thumbFilename )
+ thumbFilepath = os.path.join( Instance.tmpPath, thumbFilename )
thumbFilepath = utils.getUniqueFilepath( thumbFilepath, 0 )
recd.thumbFilename = os.path.basename( thumbFilepath )
@@ -379,14 +379,14 @@ class Model:
def createNewRecordedMd5Sums( self, recd ):
#load the thumbfile
- thumbFile = os.path.join(Instance.instancePath, recd.thumbFilename)
+ thumbFile = os.path.join(Instance.tmpPath, recd.thumbFilename)
thumbMd5 = utils.md5File( thumbFile )
recd.thumbMd5 = thumbMd5
tBytes = os.stat(thumbFile)[6]
recd.thumbBytes = tBytes
#load the mediafile
- mediaFile = os.path.join(Instance.instancePath, recd.mediaFilename)
+ mediaFile = os.path.join(Instance.tmpPath, recd.mediaFilename)
mediaMd5 = utils.md5File( mediaFile )
recd.mediaMd5 = mediaMd5
mBytes = os.stat(mediaFile)[6]
diff --git a/record.py b/record.py
index 39038f9..903dbeb 100755
--- a/record.py
+++ b/record.py
@@ -485,7 +485,7 @@ class Record(activity.Activity):
recd.downloadedFromBuddy = True
if (recd.type == Constants.TYPE_AUDIO):
filepath = recd.getMediaFilepath()
- bundlePath = os.path.join(Instance.instancePath, "audioBundle")
+ bundlePath = os.path.join(Instance.tmpPath, "audioBundle")
bundlePath = utils.getUniqueFilepath(bundlePath, 0)
cmd = "split -a 1 -b " + str(recd.mediaBytes) + " " + str(filepath) + " " + str(bundlePath)
@@ -494,12 +494,12 @@ class Record(activity.Activity):
bundleName = os.path.basename(bundlePath)
mediaFilename = str(bundleName) + "a"
- mediaFilepath = os.path.join(Instance.instancePath, mediaFilename)
- mediaFilepathExt = os.path.join(Instance.instancePath, mediaFilename+".ogg")
+ mediaFilepath = os.path.join(Instance.tmpPath, mediaFilename)
+ mediaFilepathExt = os.path.join(Instance.tmpPath, mediaFilename+".ogg")
os.rename(mediaFilepath, mediaFilepathExt)
audioImageFilename = str(bundleName) + "b"
- audioImageFilepath = os.path.join(Instance.instancePath, audioImageFilename)
- audioImageFilepathExt = os.path.join(Instance.instancePath, audioImageFilename+".png")
+ audioImageFilepath = os.path.join(Instance.tmpPath, audioImageFilename)
+ audioImageFilepathExt = os.path.join(Instance.tmpPath, audioImageFilename+".png")
os.rename(audioImageFilepath, audioImageFilepathExt)
recd.mediaFilename = os.path.basename(mediaFilepathExt)
@@ -514,7 +514,7 @@ class Record(activity.Activity):
self.__class__.log.debug("_getAlbumArtCb:" + str(pixbuf) + "," + str(recd))
if (pixbuf != None):
- imagePath = os.path.join(Instance.instancePath, "audioPicture.png")
+ imagePath = os.path.join(Instance.tmpPath, "audioPicture.png")
imagePath = utils.getUniqueFilepath( imagePath, 0 )
pixbuf.save( imagePath, "png", {} )
recd.audioImageFilename = os.path.basename(imagePath)
diff --git a/recorded.py b/recorded.py
index 1c22973..fcdc315 100644
--- a/recorded.py
+++ b/recorded.py
@@ -108,7 +108,7 @@ class Recorded:
def getThumbFilepath( self ):
- return os.path.join(Instance.instancePath, self.thumbFilename)
+ return os.path.join(Instance.tmpPath, self.thumbFilename)
def getAudioImagePixbuf( self ):
@@ -126,7 +126,7 @@ class Recorded:
def getAudioImageFilepath( self ):
if (self.audioImageFilename != None):
- audioFilepath = os.path.join(Instance.instancePath, self.audioImageFilename)
+ audioFilepath = os.path.join(Instance.tmpPath, self.audioImageFilename)
return os.path.abspath(audioFilepath)
else:
return self.getThumbFilepath()
@@ -136,24 +136,24 @@ class Recorded:
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(Instance.tmpPath, 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(Instance.tmpPath, 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 = os.path.join(Instance.tmpPath, "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(Instance.tmpPath, self.mediaFilename)
return os.path.abspath(mediaFilepath)
else:
- mediaFilepath = os.path.join(Instance.instancePath, self.mediaFilename)
+ mediaFilepath = os.path.join(Instance.tmpPath, self.mediaFilename)
return os.path.abspath(mediaFilepath)
else: #pulling from the datastore, regardless of who took it, cause we got it
diff --git a/serialize.py b/serialize.py
index 5ab2744..0f2f717 100644
--- a/serialize.py
+++ b/serialize.py
@@ -151,7 +151,7 @@ def fillRecdFromNode( recd, el ):
bt = el.getAttributeNode(Constants.recdBase64Thumb)
if (bt != None):
try:
- thumbPath = os.path.join(Instance.instancePath, "datastoreThumb.jpg")
+ thumbPath = os.path.join(Instance.tmpPath, "datastoreThumb.jpg")
thumbPath = utils.getUniqueFilepath( thumbPath, 0 )
thumbImg = utils.getPixbufFromString( bt.nodeValue )
thumbImg.save(thumbPath, "jpeg", {"quality":"85"} )
@@ -163,7 +163,7 @@ def fillRecdFromNode( recd, el ):
ai = el.getAttributeNode(Constants.recdAudioImage)
if (not ai == None):
try:
- audioImagePath = os.path.join(Instance.instancePath, "audioImage.png")
+ audioImagePath = os.path.join(Instance.tmpPath, "audioImage.png")
audioImagePath = utils.getUniqueFilepath( audioImagePath, 0 )
audioImage = utils.getPixbufFromString( ai.nodeValue )
audioImage.save(audioImagePath, "png", {} )