Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 9 of 9
  1. #1
    Senior Member
    Join Date
    Aug 2014
    Location
    UK
    Posts
    601

    The "favourites_url" not available to controllers where "favourites_type" is 'link'

    Now that LMS 8.2.0 supports providing OPML instead of just an array in "explodeplayist", I can provide a 'favorites_url" on a dynamic menu with a "favorites_type" of 'link'.
    That all works beautifully, I've taken advantage of this in the BBC Sounds plugin so that a user can 'favorite' the entire "My Sounds" menu (which is the BBC's subscribing and bookmarking menu) and the entire menu can appear under 'favorites' along with the users other favourites.

    However, the ability to mark a menu of type 'link' as a 'favorite' is only available in the default skin.
    Name:  Screenshot 2021-08-20 10.09.47.png
Views: 183
Size:  8.4 KB

    The favorite_url is just simply not provided at all to the JSON controllers (e.g. Material Skin) for these menu types, so they can't support this. Is this a deliberate design choice?
    Stuart McLean

    ExpectingToFly Plugins :
    BBC Sounds, Global Player (UK), Times Radio, UK Radio Player, Virgin Radio (UK) and the Radio Favourites Plugin

    For BBC Sounds help see the BBC Sounds Wiki.

  2. #2
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,755
    Quote Originally Posted by expectingtofly View Post
    Now that LMS 8.2.0 supports providing OPML instead of just an array in "explodeplayist", I can provide a 'favorites_url" on a dynamic menu with a "favorites_type" of 'link'.
    That all works beautifully, I've taken advantage of this in the BBC Sounds plugin so that a user can 'favorite' the entire "My Sounds" menu (which is the BBC's subscribing and bookmarking menu) and the entire menu can appear under 'favorites' along with the users other favourites.

    However, the ability to mark a menu of type 'link' as a 'favorite' is only available in the default skin.
    Name:  Screenshot 2021-08-20 10.09.47.png
Views: 183
Size:  8.4 KB

    The favorite_url is just simply not provided at all to the JSON controllers (e.g. Material Skin) for these menu types, so they can't support this. Is this a deliberate design choice?
    Shouldn't the "favorite_type" be "playlist"? This is what I do for YT.
    LMS 8.2 on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

  3. #3
    Senior Member
    Join Date
    Aug 2014
    Location
    UK
    Posts
    601
    Quote Originally Posted by philippe_44 View Post
    Shouldn't the "favorite_type" be "playlist"? This is what I do for YT.
    I think the 'favorites_type' is what the menu type of the item in the favorites menu will be. So making it 'link' is what I want it to be in favorites and that works fine.

    The problem seems to be the type of the original menu item if it is 'playlist' (or audio) as in the YT plugin that works fine and the can be 'favorited' in Material. But if it is 'link' then the favorites_url is not served up in the JSON. I guess that used to be correct in the old way that favorites could be used. I'll dig around in the LMS code to see if I can see where the problem is.
    Stuart McLean

    ExpectingToFly Plugins :
    BBC Sounds, Global Player (UK), Times Radio, UK Radio Player, Virgin Radio (UK) and the Radio Favourites Plugin

    For BBC Sounds help see the BBC Sounds Wiki.

  4. #4
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,755
    Quote Originally Posted by expectingtofly View Post
    I think the 'favorites_type' is what the menu type of the item in the favorites menu will be. So making it 'link' is what I want it to be in favorites and that works fine.

    The problem seems to be the type of the original menu item if it is 'playlist' (or audio) as in the YT plugin that works fine and the can be 'favorited' in Material. But if it is 'link' then the favorites_url is not served up in the JSON. I guess that used to be correct in the old way that favorites could be used. I'll dig around in the LMS code to see if I can see where the problem is.
    The different XMLBrowser.pm code are pretty hairy with crazy long function. It caused me more than a few headaches, especially when you want to make sure that all versions work properly. Good luck, let me know if I can help at some point
    LMS 8.2 on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

  5. #5
    Senior Member
    Join Date
    Aug 2014
    Location
    UK
    Posts
    601
    Quote Originally Posted by philippe_44 View Post
    The different XMLBrowser.pm code are pretty hairy with crazy long function. It caused me more than a few headaches, especially when you want to make sure that all versions work properly. Good luck, let me know if I can help at some point
    I've now had a dig through this. I see what you mean, it's not the easiest of code to follow. Anyway, Ive got to the bottom of it.

    In Slim::Control::XMLBrowser the follow code means that the favorites_url will only propagate through if the the item is playable (audio or playlist)

    Code:
     if ($isPlayable) {
        my $presetParams = _favoritesParams($item);
        if ($presetParams && !$xmlBrowseInterimCM) {
    	  $hash{'presetParams'} = $presetParams;
    	  $presetFavSet = 1;
        }
    }
    This code is here : https://github.com/Logitech/slimserv...owser.pm#L1122

    I don't believe this still needs to be the case in 8.2.0 with the new ability for a favorites_url to resolve to any opml not necessarily something that is playable, so if it is changed to always propagate favorite_urls like so :

    Code:
     if (my $presetParams = _favoritesParams($item)) {
        if ($presetParams && !$xmlBrowseInterimCM) {
    	  $hash{'presetParams'} = $presetParams;
    	  $presetFavSet = 1;
        }
    }
    That works fine, and material skin will display the favorites menu as expected :
    Name:  Screenshot 2021-08-23 15.57.10.png
Views: 58
Size:  16.6 KB


    For info the other XMLBrowser.pm : Slim::Web::XMLBrowser doesn't impose any restriction of propagating favorites_url, so that works fine in the default skin anyway and does not need changing.

    I guess I could raise a pull request, as I can't see why this needs to remain as it is anymore?
    Stuart McLean

    ExpectingToFly Plugins :
    BBC Sounds, Global Player (UK), Times Radio, UK Radio Player, Virgin Radio (UK) and the Radio Favourites Plugin

    For BBC Sounds help see the BBC Sounds Wiki.

  6. #6
    Senior Member
    Join Date
    Mar 2017
    Posts
    3,225
    Quote Originally Posted by expectingtofly View Post
    That works fine, and material skin will display the favorites menu as expected
    If you favourite this in Material, what icon is shown in favourites? I'm thinking it'll probably be the non-svg version as the favourite listing code is not doing icon mapping, but just wanted to check.
    Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

  7. #7
    Senior Member
    Join Date
    Aug 2014
    Location
    UK
    Posts
    601
    Quote Originally Posted by cpd73 View Post
    If you favourite this in Material, what icon is shown in favourites? I'm thinking it'll probably be the non-svg version as the favourite listing code is not doing icon mapping, but just wanted to check.
    Good point, yes, it's the non-svg version.
    Stuart McLean

    ExpectingToFly Plugins :
    BBC Sounds, Global Player (UK), Times Radio, UK Radio Player, Virgin Radio (UK) and the Radio Favourites Plugin

    For BBC Sounds help see the BBC Sounds Wiki.

  8. #8
    Senior Member
    Join Date
    Mar 2017
    Posts
    3,225
    Quote Originally Posted by expectingtofly View Post
    Good point, yes, it's the non-svg version.
    Thanks for the confirmation, will fix.
    Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

  9. #9
    Senior Member
    Join Date
    Aug 2014
    Location
    UK
    Posts
    601
    Just to close this thread off, in case anyone finds it through a search.

    The solution (as provided by @philippe_44 , thank you) is to add a key of '{playlist}' to the menu item containing the url that can be favourite. This can be added to any menu type including non-playable ones .
    e.g.
    Code:
     {             name        => $title,
    		type        => 'link',
    		image        => $image,
    		url         => \&someOperationOrOther,
    		favorites_url => $favouritesUrl,
    		favorites_type	=> 'link',
    		playlist => $favouritesUrl,
    }
    This ensures that 1. LMS will expose the favourite url information even when the menu is not playable item (ie not type 'audio' or 'playlist'), this enables Material to offer the favourite option. and 2. Jive type controllers will also offer the option to favourite on long press.
    Stuart McLean

    ExpectingToFly Plugins :
    BBC Sounds, Global Player (UK), Times Radio, UK Radio Player, Virgin Radio (UK) and the Radio Favourites Plugin

    For BBC Sounds help see the BBC Sounds Wiki.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •