From 0c509b1b7e6f7c8ba52aec4860dc0cae1dc0de80 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Tue, 13 Aug 2013 11:42:42 -0700 Subject: [PATCH] added audio reprocessing transcoder --- mediagoblin/media_types/audio/processing.py | 38 ++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/mediagoblin/media_types/audio/processing.py b/mediagoblin/media_types/audio/processing.py index 2f965e45..7d8fd2d2 100644 --- a/mediagoblin/media_types/audio/processing.py +++ b/mediagoblin/media_types/audio/processing.py @@ -274,7 +274,7 @@ class Resizer(CommonAudioProcessor): return request_from_args( args, ['thumb_size', 'file', 'fft_size', 'medium_width']) - def process(self, thumb_size=None, file=None, fft_size=None, + def process(self, file, thumb_size=None, fft_size=None, medium_width=None): self.common_setup() @@ -284,8 +284,44 @@ class Resizer(CommonAudioProcessor): self.create_spectrogram(max_width=medium_width, fft_size=fft_size) +class Transcoder(CommonAudioProcessor): + """ + Transcoding processing steps for processed audio + """ + name = 'transcode' + description = 'Re-transcode audio' + + @classmethod + def media_is_eligible(cls, entry=None, state=None): + if not state: + state = entry.state + return state in 'processed' + + @classmethod + def generate_parser(cls): + parser = argparse.ArgumentParser( + description=cls.description, + prog=cls.name) + + parser.add_argument( + '--quality', + help='vorbisenc quality. Range: -0.1..1') + + return parser + + @classmethod + def args_to_request(cls, args): + return request_from_args( + args, ['quality']) + + def process(self, quality=None): + self.common_setup() + self.transcode(quality=quality) + + class AudioProcessingManager(ProcessingManager): def __init__(self): super(self.__class__, self).__init__() self.add_processor(InitialProcessor) self.add_processor(Resizer) + self.add_processor(Transcoder) -- 2.25.1