diff --git a/mopidy_ytmusic/backend.py b/mopidy_ytmusic/backend.py index 0da4e84..fe60f74 100644 --- a/mopidy_ytmusic/backend.py +++ b/mopidy_ytmusic/backend.py @@ -16,7 +16,7 @@ TITLE_TEXT, nav, ) -from ytmusicapi.ytmusic import YTMusic +from ytmusicapi import setup from mopidy_ytmusic import logger @@ -62,9 +62,9 @@ def __init__(self, config, audio): self.auth = True if self.auth: - self.api = YTMusic(self._ytmusicapi_auth_json) + self.api = setup(self._ytmusicapi_auth_json) else: - self.api = YTMusic() + self.api = setup() self.playback = YTMusicPlaybackProvider(audio=audio, backend=self) self.library = YTMusicLibraryProvider(backend=self) diff --git a/mopidy_ytmusic/command.py b/mopidy_ytmusic/command.py index 932e52e..7c0944a 100644 --- a/mopidy_ytmusic/command.py +++ b/mopidy_ytmusic/command.py @@ -17,7 +17,7 @@ class SetupCommand(commands.Command): help = "Generate auth.json" def run(self, args, config): - from ytmusicapi.ytmusic import YTMusic + from ytmusicapi import setup filepath = input( "Enter the path where you want to save auth.json [default=current dir]: " @@ -37,7 +37,7 @@ def run(self, args, config): ) print("Then paste (CTRL+SHIFT+V) them here and press CTRL+D.") try: - print(YTMusic.setup(filepath=str(path))) + print(setup(filepath=str(path))) except Exception: logger.exception("YTMusic setup failed") return 1 @@ -54,7 +54,7 @@ class ReSetupCommand(commands.Command): help = "Regenerate auth.json" def run(self, args, config): - from ytmusicapi.ytmusic import YTMusic + from ytmusicapi import setup path = config["ytmusic"]["auth_json"] if not path: @@ -69,7 +69,7 @@ def run(self, args, config): ) print("Then paste (CTRL+SHIFT+V) them here and press CTRL+D.") try: - print(YTMusic.setup(filepath=str(path))) + print(setup(filepath=str(path))) except Exception: logger.exception("YTMusic setup failed") return 1