Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SpotifyBackup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robert Goldmann
SpotifyBackup
Commits
231a7e61
Commit
231a7e61
authored
3 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
redirect url should be adjustable
parent
7826bed1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
SpotifyAutoPlaylistCreator.py
+5
-3
5 additions, 3 deletions
SpotifyAutoPlaylistCreator.py
config/settings-creator-example.json
+2
-1
2 additions, 1 deletion
config/settings-creator-example.json
with
7 additions
and
4 deletions
SpotifyAutoPlaylistCreator.py
+
5
−
3
View file @
231a7e61
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
config/settings-creator-example.json
+
2
−
1
View file @
231a7e61
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment