drop_table_field(database, 'users', 'bio_html')
drop_table_field(database, 'media_entries', 'description_html')
drop_table_field(database, 'media_comments', 'content_html')
+
+@RegisterMigration(10)
+def convert_video_media_data(database):
+ """
+ Move media_data["video"] directly into media_data
+ """
+ collection = database['media_entries']
+ target = collection.find(
+ {'media_data.video': {'$exists': True}})
+
+ for document in target:
+ assert len(document['media_data']) == 1
+ document['media_data'] = document['media_data']['video']
+ collection.save(document)
id = MongoPK()
+ def media_data_init(self, **kwargs):
+ self.media_data.update(kwargs)
+
def get_comments(self, ascending=False):
if ascending:
order = ASCENDING
entry.media_files['webm_640'] = medium_filepath
# Save the width and height of the transcoded video
- entry.media_data['video'] = {
- u'width': transcoder.dst_data.videowidth,
- u'height': transcoder.dst_data.videoheight}
+ entry.media_data_init(
+ width=transcoder.dst_data.videowidth,
+ height=transcoder.dst_data.videoheight)
# Create a temporary file for the video thumbnail
tmp_thumb = tempfile.NamedTemporaryFile()
{% block mediagoblin_media %}
<div class="video-player" style="position: relative;">
<video class="video-js vjs-default-skin"
- width="{{ media.media_data.video.width }}"
- height="{{ media.media_data.video.height }}"
+ width="{{ media.media_data.width }}"
+ height="{{ media.media_data.height }}"
controls="controls"
preload="auto"
data-setup="">