dest='copy',
default=False,
help='Copy initial file')
+ parser.add_argument('--link',
+ action='store_true',
+ dest='link',
+ default=False,
+ help='Link initial file')
- def handle(self, force, reset_metadata, copy, emission, episode, verbosity, formats, **kwargs):
+ def handle(self, force, reset_metadata, copy, link, emission, episode, verbosity, formats, **kwargs):
self.verbose = (verbosity > 1)
self.copy = copy
+ self.link = link
for soundfile in SoundFile.objects.select_related().exclude(podcastable=False):
if emission and soundfile.episode.emission.slug != emission:
if not os.path.exists(os.path.dirname(file_path)):
os.mkdir(os.path.dirname(file_path))
- cmd = ['ffmpeg', '-y', '-i', soundfile.file.path]
-
if self.copy and os.path.splitext(soundfile.file.path)[-1].strip('.') == format:
shutil.copy(soundfile.file.path, file_path)
return
+ if self.link and os.path.splitext(soundfile.file.path)[-1].strip('.') == format:
+ os.symlink(soundfile.file.path, file_path)
+ return
+
+ cmd = ['ffmpeg', '-y', '-i', soundfile.file.path]
if format == 'ogg':
cmd.extend(['-q:a', '5'])
elif format == 'mp3':