Haven't noticed any issues with 1.3.1. Thanks for being so responsive.
In my playlist, I've got hyperlinks that will create/replace the current playlist with a new search based on what you clicked on. I.e. you click on the artists name and the playlist just shows all songs by that artist. It bugged me that if I was playing a song by Tool for instance, and clicked on the artist name, calling plman.ClearPlaylist(pl) would also lose the playing status of the current playing song (i.e. it wouldn't show as being played anymore even though it's metadb was in the contents of the playlist).
So I devised this workaround to remove everything from the playlist except what was being played, then add the contents of the search back in:
const pl = plman.FindOrCreatePlaylist('Search', true);
if (pl === plman.PlayingPlaylist && plman.GetPlayingItemLocation().PlaylistIndex === pl) {
plman.ClearPlaylistSelection(pl);
plman.SetPlaylistSelection(pl, [plman.GetPlayingItemLocation().PlaylistItemIndex], true);
plman.RemovePlaylistSelection(pl, true);
const playing = new FbMetadbHandleList(fb.GetNowPlaying());
handle_list.Sort();
const handle_copy = new FbMetadbHandleList(handle_list);
handle_copy.MakeIntersection(playing);
if (handle_copy.Count === 0) {
plman.ClearPlaylist(pl);
} else {
handle_list.MakeDifference(playing);
}
plman.InsertPlaylistItems(pl, 0, handle_list);
} else {
// nothing playing or Search playlist is not active
plman.ClearPlaylist(pl);
plman.InsertPlaylistItems(pl, 0, handle_list);
}
This works, but it seems incredibly hacky to me, and is hard to read. Is there a better/another way to remove items from a playlist than using RemovePlaylistSelection, or otherwise do this?