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