Skip to content

Commit

Permalink
Update the authentication according to library update
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcdo29 committed Apr 15, 2023
1 parent b1e6cb8 commit 5a2839e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions mopidy_ytmusic/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
TITLE_TEXT,
nav,
)
from ytmusicapi.ytmusic import YTMusic
from ytmusicapi import setup

from mopidy_ytmusic import logger

Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions mopidy_ytmusic/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]: "
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 5a2839e

Please sign in to comment.