File extension when downloading will be determined by the extractor itself. Fixed an issue in youtube that was making VLC to receive encrypted streams only

This commit is contained in:
Manuel Cortez 2019-06-13 17:41:05 -05:00
parent daf1610054
commit a04dd9c11b
3 changed files with 10 additions and 3 deletions

View File

@ -23,6 +23,10 @@ class interface(object):
log.debug("Using quality: %s" % (quality,)) log.debug("Using quality: %s" % (quality,))
self.session = tidalapi.Session(config=_config) self.session = tidalapi.Session(config=_config)
self.session.login(username=username, password=password) self.session.login(username=username, password=password)
if config.app["services"]["tidal"]["quality"] == "lossless":
self.file_extension = "flac"
else:
self.file_extension = "mp3"
def search(self, text, page=1): def search(self, text, page=1):
if text == "" or text == None: if text == "" or text == None:

View File

@ -21,6 +21,7 @@ class interface(object):
self.results = [] self.results = []
self.needs_transcode = True self.needs_transcode = True
log.debug("started extraction service for {0}".format(self.name,)) log.debug("started extraction service for {0}".format(self.name,))
self.file_extension = "mp3"
def search(self, text, page=1): def search(self, text, page=1):
if text == "" or text == None: if text == "" or text == None:
@ -50,7 +51,7 @@ class interface(object):
log.debug("Getting download URL for {0}".format(url,)) log.debug("Getting download URL for {0}".format(url,))
if "playlist?list=" in url: if "playlist?list=" in url:
return self.search_from_playlist(url) return self.search_from_playlist(url)
ydl = youtube_dl.YoutubeDL({'quiet': True, 'no_warnings': True, 'logger': log, 'format': 'bestaudio/best', 'outtmpl': u'%(id)s%(ext)s'}) ydl = youtube_dl.YoutubeDL({'quiet': True, 'no_warnings': True, 'logger': log, 'prefer-free-formats': True, 'format': 'bestaudio', 'outtmpl': u'%(id)s%(ext)s'})
with ydl: with ydl:
result = ydl.extract_info(url, download=False) result = ydl.extract_info(url, download=False)
if 'entries' in result: if 'entries' in result:
@ -95,8 +96,9 @@ class interface(object):
video = result['entries'][0] video = result['entries'][0]
else: else:
video = result video = result
log.debug("Download URL: {0}".format(video["url"],)) # From here we should extract the first format so it will contain audio only.
return video["url"] log.debug("Download URL: {0}".format(video["formats"][0]["url"],))
return video["formats"][0]["url"]
def format_track(self, item): def format_track(self, item):
return "{0} {1}".format(item.title, item.duration) return "{0} {1}".format(item.title, item.duration)

View File

@ -17,6 +17,7 @@ class interface(object):
self.results = [] self.results = []
self.needs_transcode = False self.needs_transcode = False
log.debug("Started extraction service for zaycev.net") log.debug("Started extraction service for zaycev.net")
self.file_extension = "mp3"
def search(self, text, page=1): def search(self, text, page=1):
if text == "" or text == None: if text == "" or text == None: