[spotify] Fix empty spotify playlists

This commit is contained in:
chme 2017-03-26 09:44:05 +02:00 committed by ejurgensen
parent cc29c617b0
commit 626c77046c

View File

@ -2166,38 +2166,36 @@ scan_playlisttracks(struct spotify_playlist *playlist, int plid)
if (stamp) if (stamp)
{ {
db_file_ping(id); db_file_ping(id);
continue;
} }
else
memset(&mfi, 0, sizeof(struct media_file_info));
mfi.id = id;
dir_id = prepare_directories(track.album_artist, track.album);
map_track_to_mfi(&track, &mfi);
mfi.compilation = (track.is_compilation || artist_override);
if (album_override)
{ {
free(mfi.album); memset(&mfi, 0, sizeof(struct media_file_info));
mfi.album = strdup(playlist->name);
mfi.id = id;
dir_id = prepare_directories(track.album_artist, track.album);
map_track_to_mfi(&track, &mfi);
mfi.compilation = (track.is_compilation || artist_override);
if (album_override)
{
free(mfi.album);
mfi.album = strdup(playlist->name);
}
mfi.time_modified = time(NULL);
mfi.data_kind = DATA_KIND_SPOTIFY;
snprintf(virtual_path, PATH_MAX, "/spotify:/%s/%s/%s", mfi.album_artist, mfi.album, mfi.title);
mfi.virtual_path = strdup(virtual_path);
mfi.directory_id = dir_id;
library_add_media(&mfi);
free_mfi(&mfi, 1);
} }
mfi.time_modified = time(NULL);
mfi.data_kind = DATA_KIND_SPOTIFY;
snprintf(virtual_path, PATH_MAX, "/spotify:/%s/%s/%s", mfi.album_artist, mfi.album, mfi.title);
mfi.virtual_path = strdup(virtual_path);
mfi.directory_id = dir_id;
library_add_media(&mfi);
spotify_uri_register(track.uri); spotify_uri_register(track.uri);
cache_artwork_ping(track.uri, 1, 0); cache_artwork_ping(track.uri, 1, 0);
free_mfi(&mfi, 1);
db_pl_add_item_bypath(plid, track.uri); db_pl_add_item_bypath(plid, track.uri);
} }
} }