Skip to content

Commit

Permalink
Don't lose video if we don't have permission or the destination goes …
Browse files Browse the repository at this point in the history
…missing.

hzbd#70
  • Loading branch information
niknah committed Dec 28, 2021
1 parent 26625c4 commit ea97421
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions kazam/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,19 @@ def stop_request(self):
return True
return False

def AskSaveRecording(self):
self.done_recording = DoneRecording(self.icons,
self.tempfile,
prefs.codec,
self.old_vid_path)
logger.debug("Done Recording initialized.")
self.done_recording.connect("save-done", self.cb_save_done)
self.done_recording.connect("save-cancel", self.cb_save_cancel)
self.done_recording.connect("edit-request", self.cb_edit_request)
logger.debug("Done recording signals connected.")
self.done_recording.show_all()
self.window.set_sensitive(False)

def cb_flush_done(self, widget):
if self.main_mode == MODE_SCREENCAST and prefs.autosave_video:
logger.debug("Autosaving enabled.")
Expand All @@ -796,7 +809,11 @@ def cb_flush_done(self, widget):
CODEC_LIST[prefs.codec][3])

if os.path.isfile(self.tempfile):
shutil.move(self.tempfile, fname)
try:
shutil.move(self.tempfile, fname)
except Exception as e:
logger.error("Could not autosave, ask for save location instead: {}".format(e))
self.AskSaveRecording()
else:
logger.error("Cannot find autosave file: {}".format(self.tempfile))

Expand All @@ -818,17 +835,7 @@ def cb_flush_done(self, widget):
self.window.show()
self.window.present()
elif self.main_mode == MODE_SCREENCAST or self.main_mode == MODE_WEBCAM:
self.done_recording = DoneRecording(self.icons,
self.tempfile,
prefs.codec,
self.old_vid_path)
logger.debug("Done Recording initialized.")
self.done_recording.connect("save-done", self.cb_save_done)
self.done_recording.connect("save-cancel", self.cb_save_cancel)
self.done_recording.connect("edit-request", self.cb_edit_request)
logger.debug("Done recording signals connected.")
self.done_recording.show_all()
self.window.set_sensitive(False)
self.AskSaveRecording()

elif self.main_mode == MODE_BROADCAST:
self.window.set_sensitive(True)
Expand Down

0 comments on commit ea97421

Please sign in to comment.