@@ -18,6 +18,8 @@ import argparse
|
||||
import logging
|
||||
import os
|
||||
|
||||
import six
|
||||
|
||||
from mediagoblin import mg_globals as mgg
|
||||
from mediagoblin.processing import (
|
||||
BadMediaFail, FilenameBuilder,
|
||||
@@ -39,7 +41,7 @@ def sniff_handler(media_file, filename):
|
||||
try:
|
||||
data = discover(media_file.name)
|
||||
except Exception as e:
|
||||
_log.info(unicode(e))
|
||||
_log.info(six.text_type(e))
|
||||
return None
|
||||
if data and data.get_audio_streams() and not data.get_video_streams():
|
||||
return MEDIA_TYPE
|
||||
|
||||
@@ -19,6 +19,8 @@ import os.path
|
||||
import logging
|
||||
import datetime
|
||||
|
||||
import six
|
||||
|
||||
from mediagoblin import mg_globals as mgg
|
||||
from mediagoblin.processing import (
|
||||
FilenameBuilder, BaseProcessingFail,
|
||||
@@ -52,8 +54,8 @@ 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.warning(u'GStreamer: {0}'.format(unicode(e)))
|
||||
raise MissingComponents(u'GStreamer: {0}'.format(unicode(e)))
|
||||
_log.warning(u'GStreamer: {0}'.format(six.text_type(e)))
|
||||
raise MissingComponents(u'GStreamer: {0}'.format(six.text_type(e)))
|
||||
_log.debug('Discovered: {0}'.format(data))
|
||||
|
||||
if not data.get_video_streams():
|
||||
@@ -110,7 +112,7 @@ def get_tags(stream_info):
|
||||
dt.get_microsecond()).isoformat()
|
||||
for k, v in tags.items():
|
||||
# types below are accepted by json; others must not present
|
||||
if not isinstance(v, (dict, list, basestring, int, float, bool,
|
||||
if not isinstance(v, (dict, list, six.string_types, int, float, bool,
|
||||
type(None))):
|
||||
del tags[k]
|
||||
return dict(tags)
|
||||
|
||||
Reference in New Issue
Block a user