michaelherger / Spotty-Plugin

A Spotify plugin for the Lyrion Music Server (fka. Logitech Media Server) and Squeezebox compatible players
104 stars 20 forks source link

Feature Request: Show "Recently played" #88

Open mr-manuel opened 1 year ago

mr-manuel commented 1 year ago

Would it be possible to also show also the "Recently played" list from Spotify in the Spotty app?

Spotify app

grafik

LMS Spotty

grafik

michaelherger commented 1 year ago

For whatever reason I've actually deliberately hidden it. See https://github.com/michaelherger/Spotty-Plugin/blob/a0d4534efc3a4b27cd66a8bb2ee211b44bedfc4f/OPML.pm#L70-L82

So feel free to change the line with -1 for recently-played to the weight you want to give it within that menu. I might want to review the choices I've done there at some point...

michaelherger commented 1 year ago

Looking at that list, and considering how overwhelmed I sometimes am by that menu, I might want to make this configurable.

michaelherger commented 1 year ago

Hmm... that's odd: the web UI would give a pretty different "Recently Played" view than the native app ("Zuletzt gehört" in German):

Bildschirmfoto 2023-07-02 um 13 17 00

Top is the browser view (which uses the API Spotty is using), bottom is the native app. I wouldn't get any recently listened tracks but only the "Weekly Mix" and some random Podcasts I can't remember ever having listened to. That won't be too helpful... maybe it's just a temporary issue on their end.

mr-manuel commented 1 year ago

Thanks for your fast answers! If you make it configurable that would be great :-)

Somehow I have no "Recently played" even, if I enable it and reboot the whole system.

grafik

I'm using MS4H and the latest version of LMS:

grafik

michaelherger commented 1 year ago

The data is cached for 15 minutes if I remember correctly. You might have to wipe the cache or try again later.

mr-manuel commented 1 year ago

I changed it 30 minutes ago, but no changes. Is this the right path /var/lib/squeezeboxserver/cache/InstalledPlugins/Plugins/Spotty/OPML.pm? I found no other location for OPML.pm.

I also tried on another installation but have the same result, that it does not appear.

mr-manuel commented 1 year ago

Maybe this was the case: https://github.com/michaelherger/Spotty-Plugin/commit/ec11198c84bb2efd1ac2bdc0e0493b1616ff98cf

But I'm more interested to find the one played on my SmartPhone.

michaelherger commented 1 year ago

Please enable debug logging for plugin.spotty (see Settings/Advanced/Logging). Then look for log entries from Plugins::Spotty::API::Web::home. It should list the structure with all items found, before the filtering is applied. Would you find something for recently-played?

mr-manuel commented 1 year ago

When I search for recently-played it displays only this:

[23-07-02 22:13:24.3640] Plugins::Spotty::API::Token::_logCommand (155) Trying to get access token: "/var/lib/squeezeboxserver/cache/InstalledPlugins/Plugins/Spotty/Bin/i386-linux/spotty-x86_64" -n "Squeezebox" -c "/var/lib/squeezeboxserver/cache/spotty/7c538783" -i "35d6b8d25b32xxxxxxxxxxxxxxxxxxxx" --disable-discovery --scope "user-read-private,user-follow-modify,user-follow-read,user-library-read,user-library-modify,user-top-read,user-read-recently-played,user-read-playback-state,user-modify-playback-state,playlist-read-private,playlist-read-collaborative,playlist-modify-public,playlist-modify-private" --save-token "/tmp/spt-cYFp8LGU"
                                href     => "https://api.spotify.com/v1/views/recently-played?content_limit=20&locale=en_us&country=IT×tamp=2023-07-02T22:10:00&types=album%2Cplaylist%2Cartist%2Cshow%2Cstation&limit=20&offset=0",
                          href => "https://api.spotify.com/v1/views/recently-played",
                          id => "recently-played",
                          name => "Recently played",
[23-07-02 22:13:28.0741] Plugins::Spotty::API::Web::__ANON__ (287) do {
  my $a = {
    content => {
          href     => "https://api.spotify.com/v1/views/desktop-home?content_limit=20&locale=en_us&country=IT&timestamp=2023-07-02T22:10:00&types=album%2Cplaylist%2Cartist%2Cshow%2Cstation&limit=20&offset=0",
          items    => [
                        {
                          content => {
                                href     => "https://api.spotify.com/v1/views/recently-played?content_limit=20&locale=en_us&country=IT&timestamp=2023-07-02T22:10:00&types=album%2Cplaylist%2Cartist%2Cshow%2Cstation&limit=20&offset=0",
                                items    => [],
                                limit    => 20,
                                "next"   => undef,
                                offset   => 0,
                                previous => undef,
                                total    => 0,
                              },
                          custom_fields => {},
                          external_urls => undef,
                          href => "https://api.spotify.com/v1/views/recently-played",
                          id => "recently-played",
                          images => [],
                          name => "Recently played",
                          rendering => "CAROUSEL",
                          tag_line => undef,
                          type => "view",
                        },
... (1.000 and more lines of this object)

But in the GUI there is no "Recently played".

michaelherger commented 1 year ago

Your issue seems to be the result of the issue I've mentioned before: the recently-played's content.items list is empty. I don't know why that would be so different from what we see in the native app.

mr-manuel commented 1 year ago

Ok, then I try to contact the Spotify support asking why the list is empty in the web GUI. Maybe this way we reach something.

Link: https://community.spotify.com/t5/Spotify-for-Developers/Recently-played-list-empty/m-p/5603927#M9841

michaelherger commented 1 year ago

Thanks! I added the above screenshot.