[pitivi/ges: 150/287] common: Handle unhandled discoverered stream types gracefully
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/ges: 150/287] common: Handle unhandled discoverered stream types gracefully
- Date: Thu, 15 Mar 2012 16:38:26 +0000 (UTC)
commit 7864598b303987d99c9e867a17bad169c7685912
Author: Thibault Saunier <thibault saunier collabora com>
Date: Sat Jan 7 14:29:20 2012 -0300
common: Handle unhandled discoverered stream types gracefully
Some code cleanup on the way
pitivi/ui/common.py | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/ui/common.py b/pitivi/ui/common.py
index a8af122..40628f2 100644
--- a/pitivi/ui/common.py
+++ b/pitivi/ui/common.py
@@ -1,13 +1,17 @@
# -*- coding: utf-8 -*-
-from pitivi.settings import GlobalSettings
+import gst
+import gtk
+import os
import cairo
+
from xml.sax.saxutils import escape
from urllib import unquote
-from gettext import gettext as _
from gettext import ngettext
-import gst
-import gtk
-import os
+
+from gettext import gettext as _
+
+from pitivi.settings import GlobalSettings
+from pitivi.log.log import doLog, ERROR
GlobalSettings.addConfigSection("user-interface")
LAYER_HEIGHT_EXPANDED = 50
@@ -103,8 +107,16 @@ def beautify_info(info):
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((beautify_stream(stream) for stream in info.get_stream_list())))
+ "\n".join((nice for nice in nice_streams_txts)))
def info_name(info):
@@ -136,6 +148,7 @@ def beautify_stream(stream):
elif type(stream) == gst.pbutils.DiscovererStreamInfo and\
"text" in stream.get_caps().to_string():
return _("Subtitles")
+
raise NotImplementedError
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]