Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 59

Hybrid View

  1. #1
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    4,952

    scanUrl not being called

    In a plugin, I am trying to replace the display of a stream URL with a local protocol handler version.
    I have seen that @expectingtofly VirginRadio plugin does this.

    e.g.
    myplugin:StationA
    translated by my explodePlaylist to
    h t t p: // radiostation.com/stream.mp3

    but I want LMS / players to show the URL as
    myplugin:StationA
    not
    h t t p: // radiostation.com/stream.mp3

    I think that scanUrl is the place to do this.

    My explodePlaylist is being called but my scanUrl is not.

    I have a
    use base qw(Slim::Player::Protocols::HTTPS);

    I also have:
    sub isAudio { 1 }
    sub isRemote { 1 }
    sub canDirectStream { 0 }


    Any ideas why my scanUrl is not being called then the stream is set to start?
    Paul Webster
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

  2. #2
    Senior Member
    Join Date
    Aug 2014
    Location
    UK
    Posts
    559
    Quote Originally Posted by Paul Webster View Post
    In a plugin, I am trying to replace the display of a stream URL with a local protocol handler version.
    I have seen that @expectingtofly VirginRadio plugin does this.

    e.g.
    myplugin:StationA
    translated by my explodePlaylist to
    h t t p: // radiostation.com/stream.mp3

    but I want LMS / players to show the URL as
    myplugin:StationA
    not
    h t t p: // radiostation.com/stream.mp3


    Any ideas why my scanUrl is not being called then the stream is set to start?
    I don't think my virgin radio plugin uses the explodeplaylist??
    In fact virginradio protocol handler is probably a good example as it uses scan url : https://github.com/expectingtofly/LM...andler.pm#L638

    I can't remember that exact order of doing things, I did make a note of it somewhere. But getNextTrack is where you work out the real stream url. So you can probably follow it through on the virgin radio or times radio plugins. (I think I had to do some jiggery pokery in the scanUrl override to make sure it used the real stream url.)

    Meanwhile, I'll try and find my notes.....

  3. #3
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,865
    I had problem with scanning with PlayHLS and I know I had to add an importer (either addImporter or in install.xml) for some reason.

    edit:
    Importer is not what you need - To replace the displayed URL - expectingtofly is on the right idea - similar what TRiode did in BBCiPlayer when it hid "iplayer://"
    Last edited by bpa; 2021-05-18 at 04:29.

  4. #4
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,628

    scanUrl not being called

    > I had problem with scanning with PlayHLS and I know I had to add an
    > importer (either addImporter or in install.xml) for some reason.

    I'm very much confused by this... And you mention this for the second
    time this week... scanUrl in the protocol handler has been around for
    years before the importer feature was implemented. I don't really know
    what they would have to do with each other. In particular would
    addImporter have nothing to do with a radio station? It's used to import
    tracks into your library.

    --

  5. #5
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,865
    Quote Originally Posted by mherger View Post
    > I had problem with scanning with PlayHLS and I know I had to add an
    > importer (either addImporter or in install.xml) for some reason.

    I'm very much confused by this... And you mention this for the second
    time this week... scanUrl in the protocol handler has been around for
    years before the importer feature was implemented. I don't really know
    what they would have to do with each other. In particular would
    addImporter have nothing to do with a radio station? It's used to import
    tracks into your library.

    --
    Ignore me, I got into my head Paul was trying to hide multiple formats under one. I was too lazy to look at the code as why importer was needed.

    PlayHLS is an oddity - the suffix m3u8 playlist &MIME is ambiguous, the content needs ot be examined before determining whether the playlist can either be m3u playlist or HLS ones. So PlayHLS had to do a scan of m3u8 playlist and decide whether they are to be handled by LMS or PlayHLS. There may be a better solution but part of the problem was learning how the real world has implemented HLS and where the rules have not been followed.

  6. #6
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    4,952
    ok - will try with getNextTrack.

    I think I went with explodePlaylist initially because I saw it being used in BBCSounds plugin when converting sounds:// protocol for live streams.
    It worked (in that I provided the real URL back to LMS and it played) but I did not want the real URL to appear in UI or on devices so was then hunting for a way to hide it again.
    Paul Webster
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

  7. #7
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,628

    scanUrl not being called

    > In a plugin, I am trying to replace the display of a stream URL with a
    > local protocol handler version.


    What do you mean by "the display of a stream URL"? A protocol handler
    (PH) would deal with a URL of a specific protocol. Eg. your protocol
    would be "myplugin". So myplugin:someStation would be handled by your
    PH. A PH is not there to customize behaviour of http://mystation/stream,
    but to "mask" it. Eg. radioparadise://1.flac would be the Mellow
    station. Only once the PH is called to getNextTrack() it would return
    the real http URL. But in LMS you'd almost always see
    radioparadise://1.flac, and not the http URL.

    I probably don't understand what you're trying to do.

  8. #8
    Senior Member
    Join Date
    Aug 2014
    Location
    UK
    Posts
    559
    Quote Originally Posted by mherger View Post
    > In a plugin, I am trying to replace the display of a stream URL with a
    > local protocol handler version.


    What do you mean by "the display of a stream URL"? A protocol handler
    (PH) would deal with a URL of a specific protocol. Eg. your protocol
    would be "myplugin". So myplugin:someStation would be handled by your
    PH. A PH is not there to customize behaviour of http://mystation/stream,
    but to "mask" it. Eg. radioparadise://1.flac would be the Mellow
    station. Only once the PH is called to getNextTrack() it would return
    the real http URL. But in LMS you'd almost always see
    radioparadise://1.flac, and not the http URL.

    I probably don't understand what you're trying to do.
    I think paul added an "explodeplaylist" to treate the customized url as a playlist, which would convert it to the real https:// playlist item. That means that the real https would then be used and his protocol handler would not be used from that point onwards.
    As you say, he needs to remove that explodeplaylist and use getNextTrack to resolve the real url (he should be able to follow my example in the virgin radio plugin).

  9. #9
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    4,952

    scanUrl not being called

    I have no issue with the myplugin:// URLs being shown.
    It is what they hide that I wanted to be hidden.

    They are "relatively" stable and I could make them even more stable.
    A change in the underlying stream URL would (broadly at least) be hidden from the user and would allow Favourites to be set and used (which I have done).

    Edit: My intention is to use URL-encoded station name for the PH name but that can come later. It does not make a difference to getting the thing to play.
    Last edited by Paul Webster; 2021-05-28 at 11:55.
    Paul Webster
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

  10. #10
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,865
    Quote Originally Posted by Paul Webster View Post
    I have no issue with the myplugin:// URLs being shown.
    It is what they hide that I wanted to be hidden.

    They are "relatively" stable and I could make them even more stable.
    A change in the underlying stream URL would (broadly at least) be hidden from the user and would allow Favourites to be set and used (which I have done).

    Edit: My intention is to use URL-encoded station name for the PH name but that can come later. It does not make a difference to getting the thing to play.
    Looking at the problem - the subclassing of https by plugin means your plugin is given the m3u8 https back after it has asked LMS to play it and PlayHLS has scanned it (via callbacks).
    If your plugin does not subclass https - then LMS can't seem to find the PlayHLS handler - so there is some underlying issue in the way the HLS URL is being asked to play that is different form say Tune-in.

    The solution may require a LMS change but I'll continue to look to find the problem.

    As a backup, I thought there could be a different LMS way to hide the info under control of plugin.

    As a proof of concept - I change the xmlbrowser_details.html file (I couldn't remember template syntax fully so it is crude) - I added a test for '#HIDEME' at end of URL.
    so any URL with '#HIDEME' at end will not be displayed. The "#" at end of an URL is an anchor and ignored in URL processing.

    The plugin can add '#HIDEME' to any URL it wants to suppress.

    Code:
    		[% IF streaminfo.item.url %]
    			[% IF !streaminfo.item.url.search('#HIDEME$') %]
    				[% item = BLOCK %]<a href="[% streaminfo.item.url | html %]" target="_blank">[% streaminfo.item.url | html %]</a>[% END %]
    				[% PROCESS songInfoItem title = "URL" %]
    			[% END %]
    		[% END %]
    Material would need a change.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •