slimserver icon indicating copy to clipboard operation
slimserver copied to clipboard

online library track (parsing?) problem with (client) playlist

Open AF-1 opened this issue 4 years ago • 1 comments

Online library tracks are under certain circumstances not recognized as such (Slim::Schema::Track) but treated as default remote tracks (Slim::Schema::RemoteTrack) that are not part of the LMS library.

Among other things that means for me:

  • you can't call methods tied to Slim::Schema::Track on them, esp. you can't get the $tracks->extid to tell them apart from normal remote tracks that are not part of the LMS library.
  • Custom title formats can't be used properly.

Here are 2 ways to reproduce the problem (using an online album that has been added to the LMS library):

    • add a track from an online LMS library album (Spotify in this case) to a client playlist
    • click on the track in the client playlist to show the song details or dump the track object -> it's a LMS library track
    • restart LMS
    • click on the track in the client playlist to show the song details or dump the track object -> it's a remote track (not a library track) with all the consequences
       bless( [
               '-140422923078936',
               1,
               undef,
               undef,
               'spotify:track:6jy9yJfgCsMHdu2Oz4BGKX',
               undef,
               undef,
               undef,
               178,
               undef,
               undef,
               undef,
               undef,
               undef,
               "Papi\x{2019}s Home",
               'PAPI S HOME',
               'PAPI S HOME',
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               0,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               undef,
               'dbfed58785cb9ca3a79fb279cc5ec690',
               undef,
               undef,
               undef,
               undef,
               {},
               undef,
               {}
             ], 'Slim::Schema::RemoteTrack' );
      

    • add a track from an online LMS library album (Spotify in this example) to a client playlist
    • click on the track in the client playlist to show the song details or dump the track object -> it's a LMS library track
    • create a title format and dump the track object that's passed into the titleformat sub.
    • start playback
    • at first everything's ok, a normal Slim::Schema::Track object is passed
    • after a while all you get is an unblessed hash like
        {
          'originalType' => 'Ogg Vorbis (Spotify)',
          'type' => 'Ogg Vorbis (Spotify) (Converted to Spotty)',
          'bitrate' => '320k VBR',
          'duration' => '178.623',
          'title' => "Papi\x{2019}s Home",
          'cover' => 'https://i.scdn.co/image/ab67616d0000b2736627f8a4e961a92a2fe0d461',
          'url' => 'spotify:track:6jy9yJfgCsMHdu2Oz4BGKX',
          'artist' => 'Drake',
          'album' => 'Certified Lover Boy',
          'originaltype' => 'Ogg Vorbis (Spotify)',
          'icon' => '/html/images/cover.png'
        };
    

I don't know if this is related: according to the LMS CLI docs the playlist tracks command supports the x tag (like songinfo) to return a track's extid. But it doesn't return extids for online LMS library tracks.

So if you can save a local playlist with a remote LMS library track in it and the LMS docs says this command should return extid (for tag x) I guess this should be possible.

AF-1 avatar Sep 14 '21 13:09 AF-1

When a playlist is stored, we only save a playlist with URLs. Whereas when we start playback of an "integrate" track, it's using a Track object internally.

I believe the underlying issue is here:

https://github.com/Logitech/slimserver/blob/56f640797b227fe58bbd5199d799dee8a8179ccb/Slim/Schema.pm#L2300-L2302

The code parsing the playlists doesn't set the $integrateRemote flag, as at that point it doesn't know whether this is part of our library.

To be continued...

michaelherger avatar Sep 16 '21 04:09 michaelherger