def beautify_info(info): ranks = { DiscovererVideoInfo: 0, DiscovererAudioInfo: 1, DiscovererStreamInfo: 2 } def stream_sort_key(stream): try: return ranks[type(stream)] except KeyError: return len(ranks) info.get_stream_list().sort(key=stream_sort_key) nice_streams_txts = [] for stream in info.get_stream_list(): try: beautified_string = beautify_stream(stream) except NotImplementedError: doLog(ERROR, "Beautify", "None", "Cannot beautify %s", stream) else: if beautified_string is not None: nice_streams_txts.append(beautified_string) return ("<b>" + info_name(info) + "</b>\n" + "\n".join((nice for nice in nice_streams_txts)))
def beautify_info(info): """ Formats the specified info for display. @type info: L{DiscovererInfo} """ ranks = { DiscovererVideoInfo: 0, DiscovererAudioInfo: 1, DiscovererStreamInfo: 2 } def stream_sort_key(stream): try: return ranks[type(stream)] except KeyError: return len(ranks) info.get_stream_list().sort(key=stream_sort_key) nice_streams_txts = [] for stream in info.get_stream_list(): try: beautified_string = beautify_stream(stream) except NotImplementedError: doLog(ERROR, "Beautify", "None", "Cannot beautify %s", stream) continue if beautified_string: nice_streams_txts.append(beautified_string) return ("<b>" + path_from_uri(info.get_uri()) + "</b>\n" + "\n".join(nice_streams_txts))
def beautify_info(info): """ Formats the specified info for display. @type info: L{DiscovererInfo} """ ranks = {DiscovererVideoInfo: 0, DiscovererAudioInfo: 1, DiscovererStreamInfo: 2} def stream_sort_key(stream): try: return ranks[type(stream)] except KeyError: return len(ranks) info.get_stream_list().sort(key=stream_sort_key) nice_streams_txts = [] for stream in info.get_stream_list(): try: beautified_string = beautify_stream(stream) except NotImplementedError: doLog(ERROR, "Beautify", "None", "Cannot beautify %s", stream) continue if beautified_string: nice_streams_txts.append(beautified_string) return "<b>" + path_from_uri(info.get_uri()) + "</b>\n" + "\n".join(nice_streams_txts)
def beautify_info(info): ranks = { DiscovererVideoInfo: 0, DiscovererAudioInfo: 1, DiscovererStreamInfo: 2 } def stream_sort_key(stream): try: return ranks[type(stream)] except KeyError: return len(ranks) info.get_stream_list().sort(key=stream_sort_key) nice_streams_txts = [] for stream in info.get_stream_list(): try: beautified_string = beautify_stream(stream) except NotImplementedError: doLog(ERROR, "Beautify", "None", "Cannot beautify %s", stream) else: if beautified_string is not None: nice_streams_txts.append(beautified_string) return ("<b>" + info_name(info) + "</b>\n" + "\n".join( (nice for nice in nice_streams_txts)))
def beautify_asset(asset): """Formats the specified asset for display. Args: asset (GES.Asset): The asset to display. """ uri = get_proxy_target(asset).props.id path = path_from_uri(uri) res = ["<b>" + GLib.markup_escape_text(path) + "</b>"] ranks = { DiscovererVideoInfo: 0, DiscovererAudioInfo: 1, DiscovererStreamInfo: 2 } def stream_sort_key(stream): try: return ranks[type(stream)] except KeyError: return len(ranks) info = asset.get_info() streams = info.get_stream_list() streams.sort(key=stream_sort_key) for stream in streams: try: beautified_string = beautify_stream(stream) except NotImplementedError: doLog(ERROR, "Beautify", "None", "Cannot beautify %s", stream) continue if beautified_string: res.append(beautified_string) duration = beautify_length(asset.get_duration()) if duration: res.append(_("<b>Duration:</b> %s") % duration) if asset.creation_progress < 100: res.append( _("<b>Proxy creation progress:</b> %d%%") % asset.creation_progress) return "\n".join(res)
def set_combo_value(combo, value): def select_specific_row(model, unused_path, iter_, found): model_value = model.get_value(iter_, 1) if value == model_value: combo.set_active_iter(iter_) found.append(1) return True return False found = [] combo.props.model.foreach(select_specific_row, found) if len(found) != 1: doLog(INFO, None, "utils", "Could not set value %s, possible values: %s", (value, [v[0] for v in combo.props.model])) return False return True
def beautify_asset(asset): """Formats the specified asset for display. Args: asset (GES.Asset): The asset to display. """ uri = get_proxy_target(asset).props.id path = path_from_uri(uri) res = ["<b>" + GLib.markup_escape_text(path) + "</b>"] ranks = { DiscovererVideoInfo: 0, DiscovererAudioInfo: 1, DiscovererStreamInfo: 2 } def stream_sort_key(stream): try: return ranks[type(stream)] except KeyError: return len(ranks) info = asset.get_info() streams = info.get_stream_list() streams.sort(key=stream_sort_key) for stream in streams: try: beautified_string = beautify_stream(stream) except NotImplementedError: doLog(ERROR, "Beautify", "None", "Cannot beautify %s", stream) continue if beautified_string: res.append(beautified_string) duration = beautify_length(asset.get_duration()) if duration: res.append(_("<b>Duration:</b> %s") % duration) if asset.creation_progress < 100: res.append(_("<b>Proxy creation progress:</b> %d%%") % asset.creation_progress) return "\n".join(res)
def beautify_info(info): ranks = { gst.pbutils.DiscovererVideoInfo: 0, gst.pbutils.DiscovererAudioInfo: 1, gst.pbutils.DiscovererStreamInfo: 2 } def stream_sort_key(stream): return ranks[type(stream)] info.get_stream_list().sort(key=stream_sort_key) nice_streams_txts = [] for stream in info.get_stream_list(): try: beautifull = beautify_stream(stream) nice_streams_txts.append(beautifull) except NotImplementedError: doLog(ERROR, "Beautify", "None", "Cannot beautify %s", stream) return ("<b>" + info_name(info) + "</b>\n" + "\n".join((nice for nice in nice_streams_txts)))
def beautify_asset(asset): """Formats the specified asset for display. Args: asset (GES.Asset): The asset to display. """ ranks = { DiscovererVideoInfo: 0, DiscovererAudioInfo: 1, DiscovererStreamInfo: 2 } def stream_sort_key(stream): try: return ranks[type(stream)] except KeyError: return len(ranks) info = asset.get_info() uri = get_proxy_target(asset).props.id info.get_stream_list().sort(key=stream_sort_key) nice_streams_txts = [] for stream in info.get_stream_list(): try: beautified_string = beautify_stream(stream) except NotImplementedError: doLog(ERROR, "Beautify", "None", "Cannot beautify %s", stream) continue if beautified_string: nice_streams_txts.append(beautified_string) res = "<b>" + path_from_uri(uri) + "</b>\n" + "\n".join(nice_streams_txts) if asset.creation_progress < 100: res += _("\n<b>Proxy creation progress: ") + \ "</b>%d%%" % asset.creation_progress return res