Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 10 of 10

Hybrid View

  1. #1
    Senior Member
    Join Date
    Mar 2017
    Posts
    3,069

    Plugin URL prefix mapping?

    For Material 2.4.2 I'm using a track's URL to map to its source. e.g. URL starting with "youtube:" maps to "YouTube". Currently I have a JSON file that maps these prefixes (URL schemes) to a displayable name. Is there a way for material to determine the URL prefixes used for all installed plugins? This way I can remove the JSON file and provide this mapping for a JSONRPC call - and when new plugins are created I don't have to manually update this mapping.

    e.g. I'd like Material's Perl plugin code to be able to query for all active prefixes/schemes and create a mapping from these to the plugin name.
    Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

  2. #2
    Senior Member
    Join Date
    Aug 2014
    Location
    UK
    Posts
    540
    Quote Originally Posted by cpd73 View Post
    For Material 2.4.2 I'm using a track's URL to map to its source. e.g. URL starting with "youtube:" maps to "YouTube". Currently I have a JSON file that maps these prefixes (URL schemes) to a displayable name. Is there a way for material to determine the URL prefixes used for all installed plugins? This way I can remove the JSON file and provide this mapping for a JSONRPC call - and when new plugins are created I don't have to manually update this mapping.

    e.g. I'd like Material's Perl plugin code to be able to query for all active prefixes/schemes and create a mapping from these to the plugin name.

    From a plugin I believe, you would be able to get the list of registered handlers from Slim::Player::ProtocolHandlers->registeredHandlers : https://github.com/Logitech/slimserv...andlers.pm#L68

    But that might not give you want you want as the the key, I think, will be a regex, not necessarily a prefix.
    [EDIT : Actually, having looked again, that looks fine, as the url handlers are different]
    Last edited by expectingtofly; 2021-05-09 at 02:19.

  3. #3
    Senior Member
    Join Date
    Mar 2017
    Posts
    3,069
    Quote Originally Posted by expectingtofly View Post
    From a plugin I believe, you would be able to get the list of registered handlers from Slim::Player::ProtocolHandlers->registeredHandlers : https://github.com/Logitech/slimserv...andlers.pm#L68
    Thanks. That gives me half - the prefixes - but not which plugin is for which prefix.

    [Edit] e.g. I want to know that "sounds:" maps to "BBC Sounds"
    Last edited by cpd73; 2021-05-09 at 02:59.
    Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

  4. #4
    Senior Member
    Join Date
    Aug 2014
    Location
    UK
    Posts
    540
    Quote Originally Posted by cpd73 View Post
    Thanks. That gives me half - the prefixes - but not which plugin is for which prefix.

    [Edit] e.g. I want to know that "sounds:" maps to "BBC Sounds"
    Ah, yes, I see what you mean. That's going to be tricky. You will probably be able to extract the package name of the protocol handler from the %protocolHandlers hash (e.g. Plugins::BBCSounds::ProtocolHandler ) and try and make something meaningful from that. But that looks a bit problematic.

  5. #5
    Senior Member
    Join Date
    Mar 2017
    Posts
    3,069
    Quote Originally Posted by expectingtofly View Post
    Ah, yes, I see what you mean. That's going to be tricky. You will probably be able to extract the package name of the protocol handler from the %protocolHandlers hash (e.g. Plugins::BBCSounds::ProtocolHandler ) and try and make something meaningful from that. But that looks a bit problematic.
    Yeah, I've just seen that. It might be better than nothing - after all this is only to be shown in the MAI track info section.
    Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

  6. #6
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,801
    How about
    Code:
    my $urlhandler = Slim::Player::ProtocolHandlers->handlerForURL('sounds://');
    It'll return Plugins::BBCSounds::ProtocolHandler

    You then use use the Protocol Handler to return plugin data on full name.

    edit:

    I think routine _pluginDataFor provides access into install.xml

Posting Permissions

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