Move check that metadata exists earlier

Because of gstreamer-1.0 we need to migrate from old format of storing
metadata to new one. It seems that there are cases when original
metadata is empty for some reason.

The patch adds an earlier check that original metadata exists, skipping
everything is it doesn't.

Closes bug 5071
This commit is contained in:
Boris Bobrov 2015-03-20 02:43:16 +03:00 committed by Christopher Allan Webber
parent a1bde56fd2
commit 3510f94811

View File

@ -59,11 +59,11 @@ def change_metadata_format(db):
vid_data = inspect_table(db_metadata, "video__mediadata")
for row in db.execute(vid_data.select()):
metadata = json.loads(row.orig_metadata)
if not metadata:
if not row.orig_metadata:
continue
metadata = json.loads(row.orig_metadata)
# before this migration there was info about only one video or audio
# stream. So, we store existing info as the first item in the list
new_metadata = {'audio': [], 'video': [], 'common': {}}