Convert media_data for video

This creates fresh VideoData rows for all the videos in the
mongodb.
This commit is contained in:
Elrond 2012-03-13 23:03:03 +01:00
parent 19e67f5955
commit ef7de98ad5

View File

@ -106,6 +106,19 @@ def convert_media_entries(mk_db):
session.close()
def convert_video(mk_db):
session = Session()
for media in mk_db.MediaEntry.find(
{'media_type': 'mediagoblin.media_types.video'}).sort('created'):
media_data_row = VideoData(*media.media_data)
media_data_row.media_entry = obj_id_table[media._id]
session.add(media_data_row)
session.commit()
session.close()
def convert_media_tags(mk_db):
session = Session()
session.autoflush = False
@ -167,6 +180,8 @@ def run_conversion(config_name):
Session.remove()
convert_media_entries(mk_db)
Session.remove()
convert_video(mk_db)
Session.remove()
convert_media_tags(mk_db)
Session.remove()
convert_media_comments(mk_db)