]> git.basschouten.com Git - openhab-addons.git/commitdiff
[squeezebox] Fix for Spotify and Tidal favorites (#10244)
authorMark Hilbush <mark@hilbush.com>
Fri, 26 Feb 2021 18:51:58 +0000 (13:51 -0500)
committerGitHub <noreply@github.com>
Fri, 26 Feb 2021 18:51:58 +0000 (10:51 -0800)
Signed-off-by: Mark Hilbush <mark@hilbush.com>
bundles/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/internal/handler/SqueezeBoxServerHandler.java

index a8e8c1d92657b470292df95d2f3c5eb03ca446ea..1f7cbd6d049238052f05b821285c857dc70b8409 100644 (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;