X-Git-Url: https://git.mdrn.pl/audio.git/blobdiff_plain/5420ae6bee0c35cfab499555054e350507c21fe1..69fe4abd2389432ba3f9b017b55d4b8d500c92a0:/src/youtube/tasks.py?ds=inline diff --git a/src/youtube/tasks.py b/src/youtube/tasks.py index 32e41b7..63051c9 100644 --- a/src/youtube/tasks.py +++ b/src/youtube/tasks.py @@ -7,8 +7,8 @@ class YouTubeTask(AudioFormatTask): ext = 'mkv' prefix = 'youtube' - def encode(self, in_path, out_path): - YouTube.objects.first().prepare_file(in_path, out_path) + def encode(self, in_paths, out_path): + YouTube.objects.first().prepare_file(in_paths, out_path) def set_tags(self, audiobook, filename): pass @@ -20,3 +20,15 @@ class YouTubeTask(AudioFormatTask): def put(self, user, audiobook, filename): YouTube.objects.first().publish(audiobook, filename) + + def get_source_file_paths(self, audiobook): + if not audiobook.youtube_volume: + return [audiobook.source_file.path] + return [ + a.source_file.path + for a in type(audiobook) + .objects.filter( + slug=audiobook.slug, youtube_volume=audiobook.youtube_volume + ) + .order_by("index") + ]