Skip to content
Snippets Groups Projects
Commit 231a7e61 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

redirect url should be adjustable

parent 7826bed1
Branches
Tags
No related merge requests found
...@@ -11,17 +11,18 @@ LOGGER = DefaultLogger().create_logger_if_not_exists('SpotifyAutoPlaylistCreator ...@@ -11,17 +11,18 @@ LOGGER = DefaultLogger().create_logger_if_not_exists('SpotifyAutoPlaylistCreator
class SpotifyAutoPlaylistCreator: class SpotifyAutoPlaylistCreator:
def __init__(self, clientID: str, clientSecret: str, playlistInfo: List[Dict[str, str]], def __init__(self, clientID: str, clientSecret: str, playlistInfo: List[Dict[str, str]],
destinationPlaylistInfo: Dict[str, str], numberOfTracks: int): destinationPlaylistInfo: Dict[str, str], numberOfTracks: int, redirectUrl: str):
self._clientID = clientID self._clientID = clientID
self._clientSecret = clientSecret self._clientSecret = clientSecret
self._playlistInfo = playlistInfo self._playlistInfo = playlistInfo
self._destinationPlaylistInfo = destinationPlaylistInfo self._destinationPlaylistInfo = destinationPlaylistInfo
self._numberOfTracks = numberOfTracks self._numberOfTracks = numberOfTracks
self._redirectUrl = redirectUrl
self._spotify = self.login() self._spotify = self.login()
def login(self) -> spotipy.Spotify: def login(self) -> spotipy.Spotify:
client_credentials_manager = SpotifyPKCE(client_id=self._clientID, redirect_uri='http://localhost:8080', client_credentials_manager = SpotifyPKCE(client_id=self._clientID, redirect_uri=self._redirectUrl,
scope='playlist-modify-private,playlist-modify-public') scope='playlist-modify-private,playlist-modify-public')
return spotipy.Spotify(client_credentials_manager=client_credentials_manager) return spotipy.Spotify(client_credentials_manager=client_credentials_manager)
...@@ -99,7 +100,8 @@ if __name__ == '__main__': ...@@ -99,7 +100,8 @@ if __name__ == '__main__':
SETTINGS['spotifyAPI']['clientSecret'], SETTINGS['spotifyAPI']['clientSecret'],
SETTINGS['playlists'], SETTINGS['playlists'],
SETTINGS['destinationPlaylist'], SETTINGS['destinationPlaylist'],
SETTINGS['numberOfTracks']) SETTINGS['numberOfTracks'],
SETTINGS['redirectUrl'])
spotifyBackup.run() spotifyBackup.run()
......
...@@ -14,5 +14,6 @@ ...@@ -14,5 +14,6 @@
"user": "", "user": "",
"id": "" "id": ""
}, },
"numberOfTracks": 10 "numberOfTracks": 10,
"redirectUrl": "http://localhost:8080"
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment