aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Browning <ayleph@thisshitistemp.com>2018-04-08 19:40:02 -0400
committerAndrew Browning <ayleph@thisshitistemp.com>2018-04-08 19:40:02 -0400
commita35007cc2dfb93a032a3a6fcc891e87c96e5a634 (patch)
tree6f530a67cf81518b0ee8acffcf81023948075f11
parent9a23a81671929212e535ae8171b0cba27c3a2067 (diff)
downloadmediagoblin-a35007cc2dfb93a032a3a6fcc891e87c96e5a634.tar.lz
mediagoblin-a35007cc2dfb93a032a3a6fcc891e87c96e5a634.tar.xz
mediagoblin-a35007cc2dfb93a032a3a6fcc891e87c96e5a634.zip
Process videos with incorrect date tags [#5409]
Video processing expects datetime tags in a specific format. This commit allows videos with missing or incorrect datetime tags to be processed with no datetime tags instead of failing.
-rw-r--r--mediagoblin/media_types/video/processing.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/mediagoblin/media_types/video/processing.py b/mediagoblin/media_types/video/processing.py
index 3168c054..71204fc7 100644
--- a/mediagoblin/media_types/video/processing.py
+++ b/mediagoblin/media_types/video/processing.py
@@ -116,10 +116,13 @@ def get_tags(stream_info):
# TODO: handle timezone info; gst.get_time_zone_offset +
# python's tzinfo should help
dt = tags['datetime']
- tags['datetime'] = datetime.datetime(
- dt.get_year(), dt.get_month(), dt.get_day(), dt.get_hour(),
- dt.get_minute(), dt.get_second(),
- dt.get_microsecond()).isoformat()
+ try:
+ tags['datetime'] = datetime.datetime(
+ dt.get_year(), dt.get_month(), dt.get_day(), dt.get_hour(),
+ dt.get_minute(), dt.get_second(),
+ dt.get_microsecond()).isoformat()
+ except:
+ tags['datetime'] = None
for k, v in tags.copy().items():
# types below are accepted by json; others must not present
if not isinstance(v, (dict, list, six.string_types, int, float, bool,