Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 6 of 6
  1. #1
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    4,427

    Adding a new protocol handler

    I am now looking at adding a protocol handler for one of my plugins - so that I can have something like
    radiogroup://station%20name
    to play one

    I have been reading
    https://wiki.slimdevices.com/index.p...tocol_Handlers
    and looked at some code in other plugins.

    I can see that I need to call Slim::Player::ProtocolHandlers->registerHandler with the protocol name (radiogroup in this fake example) and the Perl package name as parameters.

    Some have done this by having a file
    ProtocolHandler.pm and then having something like this in the code of that module
    Slim::Player::ProtocolHandlers->registerHandler('radiogroup', __PACKAGE__);

    I am trying something similar but not seeing my code get called.

    So ... does LMS automatically look for
    ProtocolHandler.pm
    to load in on plugin startup or is there something else that I have to do to get my ProtocolHandler.pm to be invoked?
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

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

    Adding a new protocol handler

    > Some have done this by having a file
    > ProtocolHandler.pm and then having something like this in the code of
    > that module
    > Slim::Player::ProtocolHandlers->registerHandler('radiogroup',
    > __PACKAGE__);
    >
    > I am trying something similar but not seeing my code get called.
    >
    > So ... does LMS automatically look for
    > ProtocolHandler.pm
    > to load in on plugin startup or is there something else that I have to
    > do to get my ProtocolHandler.pm to be invoked?


    No, you'll have to do it in your Plugin.pm. I'd register there, and LMS
    will then load the protocol handler if needed.

  3. #3
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,634
    Some of this is a case of doing what other plugins have done.
    Depending on functionality & how it is used, you may need to add an importer either by addImporter or in install.xml file.

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

    Adding a new protocol handler

    > Some of this is a case of doing what other plugins have done.
    > Depending on functionality & how it is used, you may need to add an
    > importer either by addImporter or in install.xml file.


    This is about the protocol handler, not the importer.

  5. #5
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    4,427
    Thanks ... that made me look harder at other plugins.

    They do their own call to get it loaded by putting a Use in Plugin.pm - like this

    use Plugins::myPluginName::ProtocolHandler;

    I'll experiment with this way as well.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  6. #6
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    4,427
    As expected, that worked (calling it from Plugin.pm).
    I quite like __PACKAGE__ as it makes it one less thing to remember when sharing code between plugins.
    However, since I now have to remember to call the ProtocolHandler.pm from Plugin.pm then that is cancelled out
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

Posting Permissions

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