[squeezebox] Fix for Spotify and Tidal favorites (#10244)

Signed-off-by: Mark Hilbush <mark@hilbush.com>
This commit is contained in:
Mark Hilbush 2021-02-26 13:51:58 -05:00 committed by GitHub
parent 8fde1c3988
commit dc9c2f3fe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -961,12 +961,14 @@ public class SqueezeBoxServerHandler extends BaseBridgeHandler {
List<Favorite> favorites = new ArrayList<>();
Favorite f = null;
boolean isTypePlaylist = false;
for (String part : messageParts) {
// Favorite ID (in form xxxxxxxxx.n)
if (part.startsWith("id%3A")) {
String id = part.substring("id%3A".length());
f = new Favorite(id);
favorites.add(f);
isTypePlaylist = false;
}
// Favorite name
else if (part.startsWith("name%3A")) {
@ -974,12 +976,15 @@ public class SqueezeBoxServerHandler extends BaseBridgeHandler {
if (f != null) {
f.name = name;
}
} else if (part.equals("type%3Aplaylist")) {
isTypePlaylist = true;
}
// When "1", favorite is a submenu with additional favorites
else if (part.startsWith("hasitems%3A")) {
boolean hasitems = "1".matches(part.substring("hasitems%3A".length()));
if (f != null) {
if (hasitems) {
// Except for some favorites (e.g. Spotify) use hasitems:1 and type:playlist
if (hasitems && isTypePlaylist == false) {
// Skip subfolders
favorites.remove(f);
f = null;