X-Git-Url: https://git.mdrn.pl/audio.git/blobdiff_plain/ff4fa4a4ae20cfb529d495f335cce477ada7f6a1..refs/heads/master:/src/youtube/tasks.py?ds=inline diff --git a/src/youtube/tasks.py b/src/youtube/tasks.py index 63051c9..7cf5eac 100644 --- a/src/youtube/tasks.py +++ b/src/youtube/tasks.py @@ -8,9 +8,9 @@ class YouTubeTask(AudioFormatTask): prefix = 'youtube' def encode(self, in_paths, out_path): - YouTube.objects.first().prepare_file(in_paths, out_path) + self.audiobook.project.youtube.prepare_file(in_paths, out_path) - def set_tags(self, audiobook, filename): + def set_tags(self, tags, filename): pass @classmethod @@ -19,16 +19,20 @@ class YouTubeTask(AudioFormatTask): os.unlink(file_name) def put(self, user, audiobook, filename): - YouTube.objects.first().publish(audiobook, filename) + audiobook.project.youtube.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") - ] + paths = [audiobook.source_file.path] + else: + paths = [ + a.source_file.path + for a in type(audiobook) + .objects.filter( + slug=audiobook.slug, youtube_volume=audiobook.youtube_volume + ) + .order_by("index") + ] + if audiobook.project.info_flac: + paths.append(audiobook.project.info_flac.path) + return paths