Remove YouTube files after upload.
[audio.git] / src / youtube / tasks.py
1 import os
2 from archive.tasks import AudioFormatTask
3 from .models import YouTube
4
5
6 class YouTubeTask(AudioFormatTask):
7     ext = 'mkv'
8     prefix = 'youtube'
9
10     def encode(self, in_path, out_path):
11         YouTube.objects.first().prepare_file(in_path, out_path)
12
13     def set_tags(self, audiobook, filename):
14         pass
15
16     @classmethod
17     def save(cls, audiobook, file_name):
18         """We do not save the video files."""
19         os.unlink(file_name)
20
21     def put(self, user, audiobook, filename):
22         YouTube.objects.first().publish(audiobook, filename)