kaaholst / android-squeezer

Remote control for your Logitech Media Server ("Squeezeserver" etc) and players.
Apache License 2.0
75 stars 15 forks source link

Add support for `weblink` elements #799

Closed michaelherger closed 1 year ago

michaelherger commented 1 year ago

Some menus can return items with a weblink element. Such a menu item would point at some external resource which would need to be rendered in a web view or an external viewer (eg. a PDF booklet, additional images, an external web page etc.). Qobuz is an example plugin which provides such content (see eg. https://github.com/pierrepoulpe/SqueezeboxQobuz/blob/fe3c4769178144951fe1e152318f32e2fdb0a0d4/Plugin.pm#L1645).

Squeezer currently isn't supported. But you can find inspiration in the OpenSqueeze project (https://github.com/orangebikelabs/opensqueeze/blob/067a65b24eaf4dff0662bf07199331933136f360/app/src/main/java/com/orangebikelabs/orangesqueeze/menu/AbsMenuFragment.java#L165).

michaelherger commented 1 year ago

Some more information: Qobuz can be "used" without subscription. You'd only get 30s snippets. But that's good enough to test that feature. You'd have to modify $WEBLINK_SUPPORTED_UA_RE in https://github.com/pierrepoulpe/SqueezeboxQobuz/blob/fe3c4769178144951fe1e152318f32e2fdb0a0d4/Plugin.pm#L25 to add Squeezer (or whatever your user agent string might easily match). Then play eg. qobuz://201587203.flac, go to its track info menu. There you should get a "Booklet" item pointing at a PDF file.

kaaholst commented 1 year ago

@michaelherger Thanks for the suggestion, this will be a great addition to Squeezer. I will try it out, and see how it looks.

kaaholst commented 1 year ago

This works quite well. I also tested with (localfiles) for the Music and Artists Plugin.

If you have an Android device you can try this apk.

You may continue to use this apk, it will automatically be updated when an new version is released. You can also revert to the version on Google Play, if you prefer to use an official version.

I was hoping for more though!

If I open e.g Artist biography or Album review in my web browser, I will get rich content (formatting, images etc.). When I do the comet request, I get only text.

This can for for example be accomplished via the attached changes to LMS+Plugin, and is also implemented in the above apk.

The idea is to make this backwards compatible. It adds an extra field "html" to the Window block, besides the existing "textarea" field. If a plugin wants to support rich content (for non webbrowser clients), it can choose to fill in that field. If a client supports rich content, it can choose to display the html field. Of course this is just an example, any other suggestions idea to achieve rich content is welcome.

AlbumInfo.pm.patch.txt Plugin.pm.patch.txt XMLBrowser.pm.patch.txt ArtistInfo.pm.patch.txt

michaelherger commented 1 year ago

Thanks for the suggestion! I'll see whether I can somehow incorporate this. Changes to XMLBrowser always make me a little nervous 😁.

michaelherger commented 1 year ago

BTW: feel free to close this issue if this is implemented. I don't have any Android device to test this with.

kaaholst commented 1 year ago

Closing this one, thanks!

kaaholst commented 12 months ago

@michaelherger I forgot to ask. When will this be available in LMS?

michaelherger commented 12 months ago

It's in 8.4, but some plugins already have support for it built-in for older versions as well. Probably the easiest way would be to install Qobuz. No paid account required. I don't have a paid account, but got some example files in my Qobuz library, which come with "Goodies" (a PDF booklet). That's what I use for testing.

kaaholst commented 12 months ago

It's in 8.4, but some plugins already have support for it built-in for older versions as well. Probably the easiest way would be to install Qobuz. No paid account required. I don't have a paid account, but got some example files in my Qobuz library, which come with "Goodies" (a PDF booklet). That's what I use for testing.

@michaelherger It doesn't seem to work. Could it be because the v2.15.2 commit is before the commit which adds Squeezer to the list of clients which support weblink? https://github.com/pierrepoulpe/SqueezeboxQobuz/commits/master

michaelherger commented 12 months ago

Oh, you're right... I haven't released that change yet. Let me do this now. 2.15.3 should be available soon.

kaaholst commented 12 months ago

That was quick, 2.15.3 is available, and it's working. Thanks!

michaelherger commented 12 months ago

Thanks for the confirmation!