[spotify] Ignore playlist updates with missing uri

This commit is contained in:
chme 2017-01-06 16:33:04 +01:00
parent 8ee3ef5b15
commit 66bbcf0576

View File

@ -2322,27 +2322,34 @@ scan_playlist(const char *uri)
if (0 == spotifywebapi_playlist_start(&request, uri, &playlist)) if (0 == spotifywebapi_playlist_start(&request, uri, &playlist))
{ {
DPRINTF(E_DBG, L_SPOTIFY, "Got playlist: '%s' (%s) \n", playlist.name, playlist.uri); if (!playlist.uri)
db_transaction_begin();
if (playlist.owner)
{ {
snprintf(virtual_path, PATH_MAX, "/spotify:/%s (%s)", playlist.name, playlist.owner); DPRINTF(E_LOG, L_SPOTIFY, "Got playlist with missing uri for path:: '%s'\n", uri);
} }
else else
{ {
snprintf(virtual_path, PATH_MAX, "/spotify:/%s", playlist.name); DPRINTF(E_DBG, L_SPOTIFY, "Got playlist: '%s' (%s) \n", playlist.name, playlist.uri);
db_transaction_begin();
if (playlist.owner)
{
snprintf(virtual_path, PATH_MAX, "/spotify:/%s (%s)", playlist.name, playlist.owner);
}
else
{
snprintf(virtual_path, PATH_MAX, "/spotify:/%s", playlist.name);
}
plid = library_add_playlist_info(playlist.uri, playlist.name, virtual_path, PL_PLAIN, spotify_base_plid, DIR_SPOTIFY);
if (plid > 0)
scan_playlisttracks(&playlist, plid);
else
DPRINTF(E_LOG, L_SPOTIFY, "Error adding playlist: '%s' (%s) \n", playlist.name, playlist.uri);
db_transaction_end();
} }
plid = library_add_playlist_info(playlist.uri, playlist.name, virtual_path, PL_PLAIN, spotify_base_plid, DIR_SPOTIFY);
if (plid > 0)
scan_playlisttracks(&playlist, plid);
else
DPRINTF(E_LOG, L_SPOTIFY, "Error adding playlist: '%s' (%s) \n", playlist.name, playlist.uri);
db_transaction_end();
} }
spotifywebapi_request_end(&request); spotifywebapi_request_end(&request);