Check if credentials exists for displaying this module in the services list

This commit is contained in:
Manuel Cortez 2019-06-20 10:18:49 -05:00
parent 2e67a1ae63
commit 22b3b31895

View File

@ -10,11 +10,15 @@ log = logging.getLogger("extractors.tidal.com")
class interface(object): class interface(object):
name = "tidal" name = "tidal"
enabled = config.app["services"]["tidal"].get("enabled") enabled = config.app["services"]["tidal"].get("enabled")
# This should not be enabled if credentials are not in config.
if config.app["services"]["tidal"]["username"] == "" or config.app["services"]["tidal"]["password"] == "":
enabled = False
def __init__(self): def __init__(self):
self.results = [] self.results = []
self.needs_transcode = False self.needs_transcode = False
log.debug("started extraction service for {0}".format(self.name,)) log.debug("started extraction service for {0}".format(self.name,))
# Assign quality or switch to high if not specified/not found.
if hasattr(tidalapi.Quality, config.app["services"]["tidal"]["quality"]): if hasattr(tidalapi.Quality, config.app["services"]["tidal"]["quality"]):
quality = getattr(tidalapi.Quality, config.app["services"]["tidal"]["quality"]) quality = getattr(tidalapi.Quality, config.app["services"]["tidal"]["quality"])
else: else: