Skip to content

Commit

Permalink
Fix traceback on slower/faster before file is opened (closes #14)
Browse files Browse the repository at this point in the history
  • Loading branch information
innir committed Aug 27, 2020
1 parent 7f02800 commit 1fe77d0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bin/gtranscribe
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ class gTranscribeWindow:

def on_scale_speed_value_changed(self, speed):
value = speed.get_value()
if (value != self.player.rate) and hasattr(self, 'md5'):
if (value != self.player.rate) and (self.md5 is not None):
self.player.rate = value
fileinfo = MetaData(self.player.filename, self.md5)
fileinfo.speed = value
Expand Down Expand Up @@ -456,7 +456,7 @@ class gTranscribeWindow:
text = fin.read()
fin.close()
# Only do this if an audio file is already loaded
if hasattr(self, 'md5'):
if self.md5 is not None:
# Try to get the last position
pos = text[-15:]
logger.debug('Try to get the last position from %s', pos)
Expand Down
1 change: 0 additions & 1 deletion gtranscribe/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def _set_rate(self, rate):
# Position query was not successful
if pos[0] == 0:
seek_type = Gst.SeekType.NONE
pos[1] = -1
self.pipeline.seek(rate,
Gst.Format.TIME,
Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE,
Expand Down

0 comments on commit 1fe77d0

Please sign in to comment.