Skip to content

Commit

Permalink
Fix possible issue with colors in error message with Youtube-dl + fal…
Browse files Browse the repository at this point in the history
…lback to always try to play the url
  • Loading branch information
Tolriq committed Mar 4, 2018
1 parent 1afcfda commit cde8eb1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions script.yatse.kodi/lib/share.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,23 @@ def run(argument):
logger.error("Url not resolved and no YoutubeDL: %s" % url)
else:
logger.info('Trying to resolve with YoutubeDL: %s' % url)
YoutubeDL_resolver = YoutubeDL({'format': 'best'})
YoutubeDL_resolver = YoutubeDL({'format': 'best', 'no_color': 'true'})
YoutubeDL_resolver.add_default_info_extractors()
result = YoutubeDL_resolver.extract_info(url, download = False)
try:
result = YoutubeDL_resolver.extract_info(url, download = False)
except Exception as e:
logger.error("Error with YoutubeDL_resolver: %s" % e)
result = []
if "url" in result:
stream_url = result["url"]
logger.info("Url resolved by YoutubeDL: %s" % result)
else:
logger.error("Url not resolved: %s" % url)
logger.error("Url not resolved by YoutubeDL: %s" % url)
else:
logger.info("Url resolved by urlResolver: %s" % stream_url)

logger.info("Url resolved by urlResolver: %s" % stream_url)
if not stream_url:
logger.info("Trying to play as basic url: %s" % url)
stream_url = url
if stream_url:
if (not 'queue' in argument) or (argument['queue'] == "false") or (not xbmc.Player().isPlaying()):
logger.info('Playing resolved url: %s' % stream_url)
Expand Down

0 comments on commit cde8eb1

Please sign in to comment.