Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More precise remaining time calculation, ui.py split #42

Draft
wants to merge 11 commits into
base: py3k
Choose a base branch
from
1 change: 1 addition & 0 deletions soundconverter/gstreamer/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ def run(self):
logger.info('output file already exists, skipping \'{}\''.format(
beautify_uri(self.newname)
))
self.done = True
self._conversion_done()
return

Expand Down
9 changes: 9 additions & 0 deletions soundconverter/gstreamer/discoverer.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ def run(self):
msg = Gst.Message.new_custom(msg_type, None, None)
self.bus.post(msg)

def _get_type(self, info):
"""Figure out the type of the audio stream."""
caps = info.get_audio_streams()[0].get_caps()
stream_type = caps.get_structure(0).get_name()
return stream_type

def _analyse_file(self, sound_file):
"""Figure out readable, tags and duration properties."""
denylisted_pattern = is_denylisted(sound_file)
Expand All @@ -123,6 +129,9 @@ def _analyse_file(self, sound_file):
# whatever anybody might ever need from it, here it is:
sound_file.info = info

# type of the stream
sound_file.type = self._get_type(info)

taglist = info.get_tags()
taglist.foreach(lambda *args: self._add_tag(*args, sound_file))

Expand Down
Loading