Wait with this until it becomes necessary or we can achieve same performance as libspotify
This reverts commit 997b4da4ad8edf299f2437f49f0a8e7337cfa658 and 2da993cc7b49dba28ae7e5db461aee973919e6c9
The web api might be accessed from different threads (library, worker,
dacp), therefor protect from concurrently running refresh-token requests
(accessing the globals in spotify_webapi.c)
The logged_in callback is called during relogin in the initscan.
Additionally initscan explicitly starts the scan leading to a duplicate
scan run.
To prevent this from happening removed the scan call in the logged_in
callback and split the spotify_login_user function into a private
function (without scan) and a public function (with scan).
Scanning saved albums/playlists over the webapi requires a logged in
libspotify session. To ensure, that the login process finished before
starting the webapi scan, the login needs to be synchronous.
and libspotify login succeeded
Each saved track needs to be registered with libspotify otherwise
playback of this track will fail. This makes sure we only add saved
tracks to the library that are playable.
Also attempt a rescan if libspotify login succeeded. With this change it
does not matter if a user first logs into libspotify and then authorizes
the webapi access or the other way around.
Align with other scanners to use 1-query db_file_ping_bypath(). Also refactor to
reduce indent level and fix memleak of mfi->album + mfi->album_artist.
This avoids adding unplayable items to the library and due to the active
track relinking should make additional tracks playable by linking to a
playable version of the track.
Added various macros to check return values and log any errors and abort
if the call fails.
Updated logging to handle early errors before logging initialized.
when scanning spotify through the web api
The goal is to reduce the artist/album cluttering that happens because
of the users spotify playlists. If 'artist_override' is true, all tracks
not in a saved album are treated as part of a compilation giving them
the configured album-artist (e. g. "Various artists"). I
'album_override' is true, tracks not in a saved album will use the
playlistname as albumname.