Add movie converter worker
This commit is contained in:
parent
42bf375491
commit
12dd4ba40a
2 changed files with 50 additions and 0 deletions
|
|
@ -14,6 +14,16 @@ class ytd(youtube_dl.YoutubeDL):
|
|||
youtube_dl.YoutubeDL.__init__(self, params)
|
||||
|
||||
|
||||
def convert_file(path, preferredcodec=None, preferredquality=u"5"):
|
||||
y = ytd()
|
||||
pp = youtube_dl.postprocessor.FFmpegExtractAudioPP(y, preferredcodec=preferredcodec, preferredquality=preferredquality)
|
||||
try:
|
||||
pp.run({'filepath': path})
|
||||
except Exception as e:
|
||||
return e.msg
|
||||
|
||||
return ""
|
||||
|
||||
def get_extractor(url):
|
||||
"""Get first matching extractor for the given URL"""
|
||||
extractors = youtube_dl.extractor.gen_extractors()
|
||||
|
|
|
|||
Reference in a new issue