MIGRATIONS = {}
+
@RegisterMigration(1, MIGRATIONS)
def add_orig_metadata_column(db_conn):
metadata = MetaData(bind=db_conn.bind)
default=None, nullable=True)
col.create(vid_data)
db_conn.commit()
+
+
+@RegisterMigration(2, MIGRATIONS)
+def webm_640_to_wemb_video(db):
+ metadata = MetaData(bind=db.bind)
+
+ file_keynames = inspect_table(metadata, 'core__file_keynames')
+
+ for row in db.execute(file_keynames.select()):
+ if row.name == 'webm_640':
+ db.execute(
+ file_keynames.update(). \
+ where(file_keynames.c.id==row.id).\
+ values(name='webm_video'))
+
+ db.commit()
- orig_metadata: A loose json structure containing metadata gstreamer
pulled from the original video.
This field is NOT GUARANTEED to exist!
-
+
Likely metadata extracted:
"videoheight", "videolength", "videowidth",
"audiorate", "audiolength", "audiochannels", "audiowidth",
"mimetype", "tags"
-
+
TODO: document the above better.
"""
__tablename__ = "video__mediadata"
"""
orig_metadata = self.orig_metadata or {}
- if "webm_640" not in self.get_media_entry.media_files \
+ if "webm_video" not in self.get_media_entry.media_files \
and "mimetype" in orig_metadata \
and "tags" in orig_metadata \
and "audio-codec" in orig_metadata["tags"] \
"""
Provides a base for various video processing steps
"""
- acceptable_files = ['original', 'best_quality', 'webm_640']
+ acceptable_files = ['original', 'best_quality', 'webm_video']
def common_setup(self):
self.video_config = mgg \
if not self.entry.media_files.get('best_quality'):
# Save the best quality file if no original?
if not self.entry.media_files.get('original') and \
- self.entry.media_files.get('webm_640'):
+ self.entry.media_files.get('webm_video'):
self.entry.media_files['best_quality'] = self.entry \
- .media_files['webm_640']
+ .media_files['webm_video']
def transcode(self, medium_size=None, vp8_quality=None, vp8_threads=None,
vorbis_quality=None):
progress_callback = ProgressCallback(self.entry)
tmp_dst = os.path.join(self.workbench.dir,
- self.name_builder.fill('{basename}-640p.webm'))
+ self.name_builder.fill('{basename}.medium.webm'))
if not medium_size:
medium_size = (
# If there is an original and transcoded, delete the transcoded
# since it must be of lower quality then the original
if self.entry.media_files.get('original') and \
- self.entry.media_files.get('webm_640'):
- self.entry.media_files['webm_640'].delete()
+ self.entry.media_files.get('webm_video'):
+ self.entry.media_files['webm_video'].delete()
else:
self.transcoder.transcode(self.process_filename, tmp_dst,
# Push transcoded video to public storage
_log.debug('Saving medium...')
- store_public(self.entry, 'webm_640', tmp_dst,
- self.name_builder.fill('{basename}-640p.webm'))
+ store_public(self.entry, 'webm_video', tmp_dst,
+ self.name_builder.fill('{basename}.medium.webm'))
_log.debug('Saved medium')
self.did_transcode = True