diff options
-rw-r--r-- | NEWS | 8 | ||||
-rwxr-xr-x | RecordActivity.py | 23 | ||||
-rw-r--r-- | glive.py | 34 | ||||
-rw-r--r-- | model.py | 36 | ||||
-rw-r--r-- | ui.py | 10 |
5 files changed, 71 insertions, 40 deletions
@@ -1,3 +1,11 @@ +24 +* fix for saving audio files' image counterparts (prevents blank screen and spinning cursor) (jedierikb) +* correctly handle bug in notify::active callbacks, and opened #2026 (jedierikb) +* disable the disappearing record buttons until more work can be done on them (jedierikb) +* correct mime and filetypes for audio recordings (addresses #2909) (jedierikb) +* fix for hitherto unknown bug regarding multiple saves to the datastore (jedierikb) +* new icon (simon@schampijer.de) + 23 * journal integration (closes #1758) (jedierikb): ** media saved to the the journal diff --git a/RecordActivity.py b/RecordActivity.py index bc88d54..100318f 100755 --- a/RecordActivity.py +++ b/RecordActivity.py @@ -127,22 +127,33 @@ class RecordActivity(activity.Activity): atLeastOne = False + #flag everything for saving... for type,value in self.m.mediaTypes.items(): typeName = value["name"] hash = self.m.mediaHashs[type] - for i in range (0, len(hash)): recd = hash[i] - mediaEl = album.createElement( typeName ) - root.appendChild( mediaEl ) recd.savedXml = False recd.savedMedia = False atLeastOne = True - self.saveIt( xmlFile, mediaEl, recd ) + #and if there is anything to save, save it + if (atLeastOne): + for type,value in self.m.mediaTypes.items(): + typeName = value["name"] + hash = self.m.mediaHashs[type] + + for i in range (0, len(hash)): + recd = hash[i] + mediaEl = album.createElement( typeName ) + root.appendChild( mediaEl ) + self.saveIt( xmlFile, mediaEl, recd ) + + #otherwise, clear it out if (not atLeastOne): self.checkDestroy( album, xmlFile ) + def saveIt( self, xmlFile, el, recd ): print("save 1") @@ -413,11 +424,7 @@ class RecordActivity(activity.Activity): if self.I_AM_SAVED: print("total Destruction 1") - self.recreateTemp() - #if (os.path.exists(self.journalPath)): - # shutil.rmtree( self.journalPath ) - print("total Destruction 2") activity.Activity.destroy( self ) print("total Destruction 3")
\ No newline at end of file @@ -43,7 +43,7 @@ class Glive: self.PIPETYPE_XV_VIDEO_DISPLAY_RECORD = 1 self.PIPETYPE_X_VIDEO_DISPLAY = 2 self.PIPETYPE_AUDIO_RECORD = 3 - self._PIPETYPE = self.PIPETYPE_SUGAR_JHBUILD + self._PIPETYPE = self.PIPETYPE_XV_VIDEO_DISPLAY_RECORD self._LAST_PIPETYPE = self._PIPETYPE self._NEXT_PIPETYPE = -1 #todo: create a dictionary here of what pipetypes have, e.g., "v4l2", "video", etc. @@ -216,13 +216,11 @@ class Glive: self.stop() self.record = False self.audio = False - #todo: walter noted bug of the audioPixbuf being None here - self.ca.m.saveAudio(audioFile, self.audioPixbuf) + if (self.audioPixbuf != None): + self.ca.m.saveAudio(audioFile, self.audioPixbuf) def takePhoto(self): - self.takePhotoBufferBuffer = 0 - if not(self.picExposureOpen): self.picExposureOpen = True self.el("videoTee").link(self.el("picQueue")) @@ -231,21 +229,15 @@ class Glive: def copyPic(self, fsink, buffer, pad, user_data=None): if (self.picExposureOpen): - self.takePhotoBufferBuffer = self.takePhotoBufferBuffer + 1 - takePhotoBuffered = 0 - if (self._PIPETYPE == self.PIPETYPE_AUDIO_RECORD): - takePhotoBuffered = 10 - - if (self.takePhotoBufferBuffer >= takePhotoBuffered): - self.picExposureOpen = False - pic = gtk.gdk.pixbuf_loader_new_with_mime_type("image/jpeg") - pic.write( buffer ) - pic.close() - pixBuf = pic.get_pixbuf() - del pic + self.picExposureOpen = False + pic = gtk.gdk.pixbuf_loader_new_with_mime_type("image/jpeg") + pic.write( buffer ) + pic.close() + pixBuf = pic.get_pixbuf() + del pic - self.el("videoTee").unlink(self.el("picQueue")) - gobject.idle_add(self.savePhoto, pixBuf) + self.el("videoTee").unlink(self.el("picQueue")) + self.savePhoto( pixBuf ) def savePhoto(self, pixbuf): @@ -431,9 +423,9 @@ class Glive: return self._PIPETYPE == self.PIPETYPE_XV_VIDEO_DISPLAY_RECORD -class LiveVideoWindow(gtk.DrawingArea): +class LiveVideoWindow(gtk.Window): def __init__(self): - gtk.DrawingArea.__init__(self) + gtk.Window.__init__(self) self.imagesink = None self.glive = None @@ -183,8 +183,8 @@ class Model: def selectLatestThumbs( self, type ): p_mx = len(self.mediaHashs[type]) p_mn = max(p_mx-self.ca.ui.numThumbs, 0) - #gobject.idle_add(self.setupThumbs, type, p_mn, p_mx) - self.setupThumbs( type, p_mn, p_mx ) + gobject.idle_add(self.setupThumbs, type, p_mn, p_mx) + #self.setupThumbs( type, p_mn, p_mx ) def isVideoMode( self ): @@ -303,6 +303,20 @@ class Model: audioHash.append( recd ) self.thumbAdded( self.TYPE_AUDIO ) + #SJ KLEIN AUDIO SAVE TO DISK BEGIN +# audioPath = os.path.join(os.path.expanduser("~"), "Journal", "Audio") +# if (not os.path.exists(audioPath)): +# os.makedirs(audioPath) + +# whoWhen = self.ca.nickName + "_" + str(strftime( "%a_%b_%d__%I:%M:%S_%p", time.localtime(recd.time) )) +# audioFilepath = os.path.join( audioPath, whoWhen + ".wav" ) +# audioFilepath = self.getUniqueFilepath(audioFilepath, 0) +# shutil.copy( os.path.join(self.ca.tempPath,recd.mediaFilename), audioFilepath ) +# audioImageFilepath = os.path.join( audioPath, whoWhen + ".png" ) +# audioImageFilepath = self.getUniqueFilepath(audioImageFilepath, 0) +# shutil.copy( imagePath, audioImageFilepath ) + #SJ KLEIN AUDIO SAVE TO DISK END + self.doPostSaveVideo() self.meshShareRecd( recd ) @@ -396,9 +410,11 @@ class Model: def savePhoto( self, pixbuf ): + print( "0 savePhoto", pixbuf.get_height() ) recd = self.createNewRecorded( self.TYPE_PHOTO ) imgpath = os.path.join(self.ca.tempPath, recd.mediaFilename) + print( "1 savePhoto", imgpath ) pixbuf.save( imgpath, "jpeg" ) thumbpath = os.path.join(self.ca.tempPath, recd.thumbFilename) @@ -410,8 +426,11 @@ class Model: #thumb.save( thumbpath, "jpeg", {"quality":"85"} ) #now that we've saved both the image and its pixbuf, we get their md5s + print( "2 savePhoto", imgpath ) self.createNewRecordedMd5Sums( recd ) + print( "3 savePhoto", imgpath ) self.addRecd( recd ) + print( "4 savePhoto", imgpath ) self.meshShareRecd( recd ) @@ -466,11 +485,15 @@ class Model: #todo: sort on time-taken, not on their arrival time over the mesh (?) self.mediaHashs[recd.type].append( recd ) + print( "2 adding recd... ", recd.type, recd ) + #updateUi + #todo: gobject idle? self.thumbAdded( recd.type ) + print( "3 adding recd... ", recd.type, recd ) self.setUpdating( False ) - print( "2 adding recd... ", self.mediaHashs[recd.type] ) + print( "4 adding recd... ", self.mediaHashs[recd.type] ) @@ -494,7 +517,7 @@ class Model: mediaFilename = mediaFilename + ".ogv" titleStarter = "Video" if (type == self.TYPE_AUDIO): - mediaFilename = mediaFilename + ".ogg" + mediaFilename = mediaFilename + ".wav" titleStarter = "Audio" mediaFilepath = os.path.join( self.ca.tempPath, mediaFilename ) @@ -522,7 +545,7 @@ class Model: newPath = os.path.join( os.path.dirname(pathOb), str( str(i) + os.path.basename(pathOb) ) ) return self.getUniqueFilepath( str(newPath), i ) else: - return path + return os.path.abspath( path ) def createNewRecordedMd5Sums( self, recd ): @@ -591,7 +614,8 @@ class Model: def thumbAdded( self, type ): mx = len(self.mediaHashs[type]) mn = max(mx-self.ca.ui.numThumbs, 0) - self.setupThumbs(type, mn, mx) + #to avoid Xlib: unexpected async reply error when taking a picture on a gst callback + gobject.idle_add(self.setupThumbs, type, mn, mx ) def doVideoMode( self ): @@ -456,9 +456,9 @@ class UI: return None
#todo: truly unique filenames for temp... #and check they're not taken..
- tempImgPath = os.path.join("tmp", recd.mediaFilename)
- tempImgPath = os.path.abspath(tempImgPath)
- print( "LOOK FOR JPE HERE--->" + imgPath_s, " -- ", tempImgPath )
+ tempImgPath = os.path.join( self.ca.tempPath, recd.mediaFilename)
+ tempImgPath = self.ca.m.getUniqueFilepath(tempImgPath,0)
+ print( imgPath_s, " -- ", tempImgPath )
shutil.copyfile( imgPath_s, tempImgPath )
return tempImgPath
@@ -1369,7 +1369,7 @@ class ThumbnailButton(gtk.Button): elif ( self.tc.recd.type == self.ui.ca.m.TYPE_VIDEO ):
targets = [('video/ogg', 0, 0)]
elif ( self.tc.recd.type == self.ui.ca.m.TYPE_AUDIO ):
- targets = [('audio/ogg', 0, 0)]
+ targets = [('audio/wav', 0, 0)]
if ( len(targets) > 0 ):
self.drag_source_set( gtk.gdk.BUTTON1_MASK, targets, gtk.gdk.ACTION_COPY)
@@ -1423,7 +1423,7 @@ class ThumbnailButton(gtk.Button): def _dragDataGetCb(self, widget, drag_context, selection_data, info, timestamp):
if ( (selection_data.target == 'image/jpeg') or
(selection_data.target == 'video/ogg' ) or
- (selection_data.target == 'audio/ogg') ):
+ (selection_data.target == 'audio/wav') ):
self.tempImgPath = self.ui.doClipboardCopyStart( self.tc.recd )
self.ui.doClipboardCopyCopy( self.tempImgPath, selection_data )
|