Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 6 123 ... LastLast
Results 1 to 10 of 52
  1. #1
    Senior Member
    Join Date
    Jul 2006
    Location
    France
    Posts
    112

    how to add a custom item to "more infos"

    Hi there,

    I'm posting this in "3rd party" because since I'm using Material Skin, this is where I'd like to add something, but maybe it should be added "deeper" in LMS and so be skin independant.

    I'd like to add a custom link somewhere in the "more" screen, or even in the next one "more infos", f.i. just below the line with the file path.
    What I need is a [clickable] link to a custom URI, composed of a static part (that I should be able to set somewhere, even if only in a variable in the code) and an URL parameter with the track.id from library.db

    I'm actually building a "sidecar" DB system that grabs all relevant tables from library.db and persistant.db, that I can use to run custom and advanced processes, like (batch) change mp3 tag, open in another app, export all >3 stars tracks to an USB key for my car, and what not.
    This system registers a specific url protocol in the OS, that can be used to open the application and call a script finding a specific row (with the given id)

    Could anyone be kind enough as to direct me to where I should start ?

  2. #2
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    18,574
    The relevant API is called Slim::Menu::TrackInfo->registerInfoProvider at Plugin.pm usually from initPlugin

    Search through other plugin to see how it is used. Basically it tells LMS where to put your new menu within More and then routine address to be called. The first lines to get called routine parameters and playing song is typically:
    Code:
     my ( $client, $url, $track, $param ) = @_;
     my $song = Slim::Player::Source::playingSong($client);

  3. #3
    Senior Member
    Join Date
    Jul 2006
    Location
    France
    Posts
    112
    OK, great thanks, will try it this way.

    I'll actually try to build this as a really tiny plugin that does just that.

    2 questions :

    - can I just add a new subfolder to C:\ProgramData\Squeezebox\Cache\InstalledPlugins\P lugins ? (and maybe restart LMS)
    will it be detected and enabled, or should I add an entry somewhere ?

    - I see all of the plugin subfolders (in path above) have a "HTML" subfolder. Is this mandatory, or can I just not include one ? (not sure what it's used for)

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

    how to add a custom item to "more infos"

    > - can I just add a new subfolder to
    > C:\ProgramData\Squeezebox\Cache\InstalledPlugins\P lugins ? (and maybe
    > restart LMS)


    No. Don't touch the InstalledPlugins folder. Never. Check
    Settings/Information for the real Plugins folder you're looking for.

    > - I see all of the plugin subfolders (in path above) have a "HTML"
    > subfolder. Is this mandatory, or can I just -not- include one ? (not
    > sure what it's used for)


    HTML is only required if you want to provide a web UI for some aspect of
    your plugin. The web template would go in there, icons, images etc.

    --

    Michael

  5. #5
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    18,574
    Quote Originally Posted by Stan Pulsar View Post
    - can I just add a new subfolder to C:\ProgramData\Squeezebox\Cache\InstalledPlugins\P lugins ? (and maybe restart LMS)
    No. "Cache" is for plugins that are installed by plugin extension manager. Cache can be deleted and plugin extensions manager will restore them.
    Manually installed users plugin are put in a non "Cache" Plugins directory (note NOT the "Slim/Plugin" which is for LMS included plugins) . Location depends on OS - so check WebUI Settings/Information at "Plugin Folders"
    Plugin in this folder will be detected at LMS startup. Plugin changes only happen after LMS restart. When developing, beware of the LMS and Browser caches which retain info between restarts

    I see all of the plugin subfolders (in path above) have a "HTML" subfolder. Is this mandatory, or can I just not include one ? (not sure what it's used for)
    HTML directories (& sub directories) can be a simple as just the icon for the plugin menu. Usually own web pages such as for plugin own Settings are there. Best to keep standard folder structure complete even if all subdirectories are empty.

  6. #6
    Senior Member
    Join Date
    Jul 2006
    Location
    France
    Posts
    112
    thanks both of you for your valuable advice.

    duly noted about the cache folder, but of course I wouldn't have messed with it, it's just that I copy-pasted the path I was browsing to illustrate my question, without thinking further about it. The point of the question was : is it just a matter of adding a subfolder where other plugin subfolders are stored.

    Now, at work !

  7. #7
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    18,574
    Quote Originally Posted by Stan Pulsar View Post
    thanks both of you for your valuable advice.

    duly noted about the cache folder, but of course I wouldn't have messed with it, it's just that I copy-pasted the path I was browsing to illustrate my question, without thinking further about it. The point of the question was : is it just a matter of adding a subfolder where other plugin subfolders are stored.

    Now, at work !
    One issue with Cache folder is that it may work but if you develop from it, make code changes, the folder may disappear with all your updates.

    Depending on your OS the "Plugins" directory may be part of the LMS tree and so could disappear if you did a complete LMS update (e.g. to test if plugin works in 7.7.*, 7.9.* and 8.0.*) . So if you make code changes in the Plugins directory , take backup copies regularly.

  8. #8
    Senior Member
    Join Date
    Jul 2006
    Location
    France
    Posts
    112
    OK, now I've got my entry in track info, but if I call my custom protocol url directly, I get the error : "Cannot request non-HTTP URL ..."

    Is there a way around this ?

    PS : BTW, I realise this thread probably belongs to the "Developers" sub-forum, feel free to move it if needed.

  9. #9
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    18,574
    Quote Originally Posted by Stan Pulsar View Post
    OK, now I've got my entry in track info, but if I call my custom protocol url directly, I get the error : "Cannot request non-HTTP URL ..."

    Is there a way around this ?

    PS : BTW, I realise this thread probably belongs to the "Developers" sub-forum, feel free to move it if needed.
    Not enough information.

    How are you calling a custom protocol directly ?

    If you have created your own protocol identifier (custom URI) - it has to be in a custom-types.conf and also rules in custom-convert.conf but that is transcoding or playing a remote site but I think that is not what you are doing ?
    I wonder if you want to add functionality to existing code - in which case you may need to do sub-classing / super classing - this is stuff I don't use much.

    Is a custom URI approach right for your project ?
    Have you checked whether any other plugin has behaviour similar to what you want (e.g. add a new More menu to an existing playing track).

  10. #10
    Senior Member
    Join Date
    Jul 2006
    Location
    France
    Posts
    112
    Sorry about not being clear.

    The goal is to call an external application that responds to a specific URL scheme, a bit like you would call your default email client using "mailto:"

    What I meant by "call directly" was that I put my URL in the url key on line 31 of the plugin.pm code : url => FM_BASEURL.'test',
    (this is of course a proof of concept for the moment, I'll have to append the track ID instead of 'test')

    Code:
    package Slim::Plugin::LMS2FM::Plugin;
    
    use strict;
    use base qw(Slim::Plugin::OPMLBased);
    use Slim::Schema;
    use Slim::Schema::Track;
    
    use constant FM_BASEURL => 'fmp18://192.168.0.151/Music.fmp12?script=findtrack&param=';
    
    sub initPlugin {
    	my $class = shift;
    
    	$class->SUPER::initPlugin(
    		tag    => 'lms2fm',
    	);
    	
    	# Track Info item
    	Slim::Menu::TrackInfo->registerInfoProvider( lms2fm => (
    		after => 'top',
    		func  => \&trackInfoHandler,
    	) );
    }
    
    sub getDisplayName { 'PLUGIN_LMS2FM_ACTION' }
    
    sub trackInfoHandler {
    	
    	return {
    		name => 'Open in FileMaker',
    		type => 'link',
    		url  => FM_BASEURL.'test',
    		favorites => 0,
    	};
    }
    
    # Don't add this item to any menu
    # sub playerMenu { }
    
    1;

Posting Permissions

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