Commit 40d56a7a authored by fred's avatar fred

add option to keep original soundfile for podcast

parent 9dfc1f4c
import base64
import mutagen
import mutagen.mp3
import shutil
import os
import subprocess
......@@ -34,10 +35,16 @@ class Command(BaseCommand):
metavar='EPISODE',
default=None,
help='Process files belonging to episode only'),
make_option('--copy',
action='store_true',
dest='copy',
default=False,
help='Copy initial file (ogg only)'),
)
def handle(self, force, reset_metadata, emission, episode, verbosity, **kwargs):
def handle(self, force, reset_metadata, copy, emission, episode, verbosity, **kwargs):
self.verbose = (verbosity > 1)
self.copy = copy
for soundfile in SoundFile.objects.select_related().exclude(podcastable=False):
if emission and soundfile.episode.emission.slug != emission:
......@@ -71,6 +78,9 @@ class Command(BaseCommand):
cmd = ['ffmpeg', '-y', '-i', soundfile.file.path]
if format == 'ogg':
if self.copy:
shutil.copy(soundfile.file.path, file_path)
return
cmd.extend(['-q:a', '5'])
elif format == 'mp3':
cmd.extend(['-q:a', '4'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment