Re: scanUrl not being called

philippe_44 <philippe_44.a1vz3b-NUepA2SMhDQqspMVqqL2D+4xXEVPTSb/[email protected]>
Newsgroups gmane.music.equipment.slimdevices.devel
Organization Logitech Squeezebox Forums
Message-ID <[email protected]>
Paul Webster wrote: 
> I know have it working ... but will have to go back through the steps to
> see if this really was the solution ....
> 
> I added
> 
> > 
Code:
--------------------
  >   > sub getFormatForURL { 'aac' }
--------------------
> > 
> 
> Daft thing is that the 
> Slim::Utils::Scanner::Remote::readRemoteHeaders
> had already worked out that it was aac from its connection to the
> remote server
> 
> and it knew it later as well ...
> > 
Code:
--------------------
  >   > Slim::Utils::Scanner::Remote::parseAACHeader (714) AAC samplerate: 44100
--------------------
> > 
> 
> but then it goes on to call Song::open ... and seems to have forgotten
> all that it knew
> > 
Code:
--------------------
  >   > Slim::Player::Song::getNextSong (223) myplugin://test
--------------------
> > 
> I then pass it back the new URL ... and it goes on to
> 
> > 
Code:
--------------------
  >   > Slim::Player::Song::open (360) myplugin://test
--------------------
> > 
> 
> and then
> > 
Code:
--------------------
  >   > Slim::Player::TranscodingHelper::getConvertCommand2 (490) Error: Didn't find any command matches for type: unk
  > Slim::Player::Song::open (415) Error: Couldn't create command line for unk playback for [myplugin://test]
  > 
--------------------
> > 
> 
> So ... given that it determined that the type was "unk" I saw that I
> could return a type via getFormatForURL ...
> and it works ... including the PH being shown rather than the real
> remote stream URL.
> 
> Seems not to remember what it had already discovered - but anyway ...
> it works.
> 
> Now I need to change my sub getFormatForURL to return the real format
> since I know it can also be mp3.

It's not that it is not 'remembering' but scanURL builds a $remoteTrack
object and fills the track's 'statics' characteristics. The $song
relates to that track being played on a given player, to it contains
transcoding matches and all sort of "dynamic" information. The $track is
scanned during getNextTrack/getNetxSong (using scanURL) and is re-used
when seeking in that $song. Once the $track is scanned, then LMS creates
and opens() the $song object (that's where transcoding options are
decided).

The PH is based on the URL of the $track inside the $song's object,
before calling scanURL and if scanURL changes the $track inside the
$song, then the PH is re-evaluated and that's the way you can use a
stock PH and not your anymore if, at the end of the day, all you wanted
to do was setting a classical http:// url (e.g.)

But it's a new track, so all this effort of the default scanURL (which
call readRemoteHeaders) are "lost", hence you feel things has been
forgotten. In reality, if you look at some plugins, they don't let
scanURL do anything, instead, in their getNextTrack they call
explicitely the right header parser to set all these tracks's "static"
information (look at WIMP/Tidal). Getting the right header parser called
is necessary for some format (mp4) for seeking and aac extraction.

The last set of details is that Squeezebox2.pm use the PH that has been
set above for some cases, but also uses the PH of $song->streamUrl(),
depending what it does. Most of PH are the same, but as some plugins, as
the result of the above, change their Url as result of scanURL, then you
can benefit from the stock PH (for example HTTP) but still have method
overloaded by you PH if you have set something different again between
the result of scanURL and $song->streamURL. I think most plugin ignore
all that, but that can an important detail to keep control of what
method you want to overload when.



When a $song is created, it does a scanURL



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
------------------------------------------------------------------------
philippe_44's Profile: http://forums.slimdevices.com/member.php?userid=17261
View this thread: http://forums.slimdevices.com/showthread.php?t=114599
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.