"""
Provides a base for various audio processing steps
"""
- acceptable_files = ['original', 'webm_audio']
+ acceptable_files = ['original', 'best_quality', 'webm_audio']
def common_setup(self):
"""
self.entry, self.process_filename,
self.name_builder.fill('{basename}{ext}'))
+ def _keep_best(self):
+ """
+ If there is no original, keep the best file that we have
+ """
+ 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_audio'):
+ self.entry.media_files['best_quality'] = self.entry \
+ .media_files['webm_audio']
+
def transcode(self, quality=None):
if not quality:
quality = self.audio_config['quality']
self.transcoder.discover(webm_audio_tmp)
+ self._keep_best()
+
_log.debug('Saving medium...')
store_public(self.entry, 'webm_audio', webm_audio_tmp,
self.name_builder.fill('{basename}.medium.webm'))
self._set_pdf_filename()
def _set_pdf_filename(self):
- if self.name_builder.ext == 'pdf':
+ if self.name_builder.ext == '.pdf':
self.pdf_filename = self.process_filename
elif self.entry.media_files.get('pdf'):
self.pdf_filename = self.workbench.localized_file(
"""
Provides a base for various video processing steps
"""
- acceptable_files = ['original', 'webm_640']
+ acceptable_files = ['original', 'best_quality', 'webm_640']
def common_setup(self):
self.video_config = mgg \
self.entry, self.process_filename,
self.name_builder.fill('{basename}{ext}'))
+ def _keep_best(self):
+ """
+ If there is no original, keep the best file that we have
+ """
+ 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['best_quality'] = self.entry \
+ .media_files['webm_640']
+
+
def transcode(self, medium_size=None, vp8_quality=None, vp8_threads=None,
vorbis_quality=None):
progress_callback = ProgressCallback(self.entry)
dst_dimensions = self.transcoder.dst_data.videowidth,\
self.transcoder.dst_data.videoheight
+ self._keep_best()
+
# Push transcoded video to public storage
_log.debug('Saving medium...')
store_public(self.entry, 'webm_640', tmp_dst,