diff options
author | Boris Bobrov <breton@cynicmansion.ru> | 2015-02-18 02:05:57 +0300 |
---|---|---|
committer | Boris Bobrov <breton@cynicmansion.ru> | 2015-02-18 02:05:57 +0300 |
commit | 6e4eccb1d4da539015237cfce0306ac52da04f5f (patch) | |
tree | 960d5998bc5a73eeee1696e3f5a5f96c1ba80f04 | |
parent | 9834c876b736614a8e1be835e6b21ea04b77bd03 (diff) | |
download | mediagoblin-6e4eccb1d4da539015237cfce0306ac52da04f5f.tar.lz mediagoblin-6e4eccb1d4da539015237cfce0306ac52da04f5f.tar.xz mediagoblin-6e4eccb1d4da539015237cfce0306ac52da04f5f.zip |
Missing codecs processing with gst 1.4
Gst 1.4 deprecated DiscovererInfo.get_misc in favour of
DiscovererInfo.get_missing_elements_installer_details. Something in
Python bindings seems to be broken and get_misc seems to be not
deprecated but broken.
The change makes sniffer use the method if get_misc fails.
-rw-r--r-- | mediagoblin/media_types/video/processing.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/mediagoblin/media_types/video/processing.py b/mediagoblin/media_types/video/processing.py index 0c897495..bf195222 100644 --- a/mediagoblin/media_types/video/processing.py +++ b/mediagoblin/media_types/video/processing.py @@ -52,7 +52,7 @@ def sniffer(media_file): data = transcoders.discover(media_file.name) except Exception as e: # this is usually GLib.GError, but we don't really care which one - _log.debug(u'GStreamer: {0}'.format(unicode(e))) + _log.warning(u'GStreamer: {0}'.format(unicode(e))) raise MissingComponents(u'GStreamer: {0}'.format(unicode(e))) _log.debug('Discovered: {0}'.format(data)) @@ -60,8 +60,19 @@ def sniffer(media_file): raise MissingComponents('No video streams found in this video') if data.get_result() != 0: # it's 0 if success - name = data.get_misc().get_string('name') # XXX: is there always name? - raise MissingComponents(u'{0} is missing'.format(name)) + try: + missing = data.get_misc().get_string('name') + _log.warning('GStreamer: missing {0}'.format(missing)) + except AttributeError as e: + # AttributeError happens here on gstreamer >1.4, when get_misc + # returns None. There is a special function to get info about + # missing plugin. This info should be printed to logs for admin and + # showed to the user in a short and nice version + details = data.get_missing_elements_installer_details() + _log.warning('GStreamer: missing: {0}'.format(', '.join(details))) + missing = u', '.join([u'{0} ({1})'.format(*d.split('|')[3:]) + for d in details]) + raise MissingComponents(u'{0} is missing'.format(missing)) return MEDIA_TYPE |