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
class SpotifyAutoPlaylistCreator:
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._clientSecret = clientSecret
self._playlistInfo = playlistInfo
self._destinationPlaylistInfo = destinationPlaylistInfo
self._numberOfTracks = numberOfTracks
self._redirectUrl = redirectUrl
self._spotify = self.login()
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')
return spotipy.Spotify(client_credentials_manager=client_credentials_manager)
......@@ -99,7 +100,8 @@ if __name__ == '__main__':
SETTINGS['spotifyAPI']['clientSecret'],
SETTINGS['playlists'],
SETTINGS['destinationPlaylist'],
SETTINGS['numberOfTracks'])
SETTINGS['numberOfTracks'],
SETTINGS['redirectUrl'])
spotifyBackup.run()
......
......@@ -14,5 +14,6 @@
"user": "",
"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