Re: scanUrl not being called
philippe_44 <philippe_44.a1urnz-NUepA2SMhDQqspMVqqL2D+4xXEVPTSb/[email protected]>
| Newsgroups | gmane.music.equipment.slimdevices.devel |
|---|---|
| Organization | Logitech Squeezebox Forums |
| Message-ID | <[email protected]> |
Paul Webster wrote:
> Still having problems after removing explodePlaylist and having a
> getNextTrack
> My code that takes the given protocol:// string to find the real stream
> URL is working - and returning the right value.
>
> getNextTrack is called by LMS soon after scanUrl returns.
> The code looks (to me) to be essentially the same as in
> Slim::Plugin::RemoteLibrary::ProtocolHandler
>
> Edited log
> >
Code:
--------------------
> >
> [21-05-18 15:37:49.6711] Plugins::myplugin::ProtocolHandler::scanUrl (70) scanurl myplugin://test
> [21-05-18 15:37:49.6719] Plugins::myplugin::Plugin::_matchId (5586) _matchId: test exists
> [21-05-18 15:37:49.6725] Plugins::myplugin::ProtocolHandler::scanUrl (83) scanurl myplugin://test actual stream https://somewhere.com/stream.aac
> [21-05-18 15:37:52.4808] Plugins::myplugin::ProtocolHandler::getNextTrack (97) getNextTrack myplugin://test
> [21-05-18 15:37:52.4821] Plugins::myplugin::Plugin::_matchId (5586) _matchId: test exists
> [21-05-18 15:37:52.4832] Plugins::myplugin::ProtocolHandler::getNextTrack (109) Setting Live Stream https://somewhere.com/stream.aac
> [21-05-18 15:37:52.4874] Slim::Player::Song::open (415) Error: Couldn't create command line for unk playback for [myplugin://test]
>
--------------------
> >
>
> If I play the same final stream url in LMS then it works fine.
> It looks to me like the line
> >
Code:
--------------------
> > $song->streamUrl($streamUrl);
--------------------
> >
> did not change the song data so LMS tried to create a command line to
> handle myplugin: which failed.
>
> Sorry for the trouble.
> I don't want to share the exact stream URL in public for reasons that
> I am happy to explain via PM or email.
> I can share the current code if an expert is willing to take a look
> offline.
AFAIR, the handler is not changed if you just change the
$song->streamUrl. If you want LMS to re-evaluate the handler to use
because of URL change, you need to set track's url. If you look at the
LMS code, in Slim::Player::Song.pm
Code:
--------------------
sub getNextSong {
my ($self, $successCb, $failCb) = @_;
my $handler = $self->currentTrackHandler();
main::INFOLOG && $log->info($self->currentTrack()->url);
# if (playlist and no-track and (scanned or not scannable)) {
if (!$self->_currentTrack()
&& $self->isPlaylist()
&& ($self->_scanDone() || !$handler->can('scanUrl')))
{
if (!$self->_getNextPlaylistTrack()) {
&$failCb('PLAYLIST_NO_ITEMS_FOUND', $self->_track()->url);
return;
}
$handler = $self->currentTrackHandler();
}
my $track = $self->currentTrack();
my $url = $track->url;
my $client = $self->master();
# If we have (a) a scannable playlist track,
# or (b) a scannable track that is not yet scanned and could be a playlist ...
if ($handler->can('scanUrl') && !$self->_scanDone()) {
$self->_scanDone(1);
main::INFOLOG && $log->info("scanning URL $url");
$handler->scanUrl($url, {
client => $client,
song => $self,
cb => sub {
my ( $newTrack, $error ) = @_;
if ($newTrack) {
if ($track != $newTrack) {
if ($self->_track() == $track) {
# Update of original track, by playlist or redirection
$self->_track($newTrack);
* $self->_currentTrackHandler(Slim::Player::ProtocolHandlers->handlerForURL($newTrack->url));*
main::INFOLOG && $log->info("Track updated by scan: $url -> " . $newTrack->url);
--------------------
So that should be done in the cb call in result of scanUrl. Here, if the
url moves from myplugin:// to http:// then LMS will change the handler
of the $song object to be a http:// handler and then it will not call
anymore the functions of your PH
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