Ok, here's a snippet from my MAI plugin, which would provide links to
PDF files etc.:


Code:
--------------------
        # XMLBrowser for Jive can't handle weblinks - need custom handling 
there to show files in the browser.
        if ( Plugins::MusicArtistInfo::Plugin->canWeblink($client) )  {
                return {
                        name => cstring($client, 
'PLUGIN_MUSICARTISTINFO_LOCAL_FILES'),
                        itemActions => {
                                items => {
                                        command  => [ CLICOMMAND, 'localfiles' 
],
                                        fixedParams => {
                                                folder => 
Slim::Utils::Unicode::utf8decode_locale($path)
                                        },
                                },
                        },
                }
        }
  
--------------------


As the comment says, the generic menu handler ("XMLBrowser for Jive")
would skip weblink items (I should try to change this in LMS8...). I
therefore create a menu item which would send a raw CLI command to the
server. That CLI command in turn could return a menu with a weblink, as
it won't rely on XMLBrowser. But as I said this would a) add another
menu, and b) is a bit more involved. You'd have to register a CLI
command:


Code:
--------------------
    
  #                                                                    
|requires Client
  #                                                                    |  |is a 
Query
  #                                                                    |  |  
|has Tags
  #                                                                    |  |  |  
|Function to call
  #                                                                    C  Q  T  
F
  Slim::Control::Request::addDispatch([CLICOMMAND, 'localfiles'], [0, 1, 1, 
\&getLocalFileWeblinksCLI]);
  
--------------------


Which would run this code:

Code:
--------------------
    sub getLocalFileWeblinksCLI {
        my $request = shift;
  
        my $client = $request->client;
  
        if ($request->isNotQuery([[CLICOMMAND], ['localfiles']])) {
                $request->setStatusBadDispatch();
                return;
        }
  
        $request->setStatusProcessing();
  
        my $web_root = 'http://' . Slim::Utils::IPDetect::IP() . ':' . 
preferences('server')->get('httpport');
  
        foreach my $file (getAllFiles()) {
                $request->addResultLoop('item_loop', $i, 'text', $file->{name} 
);
                $request->addResultLoop('item_loop', $i, 'weblink', $web_root . 
_proxiedUrl($file));
                $i++;
        }
  
        $request->addResult('count', $i);
        $request->addResult('offset', 0);
  
        $request->setStatusDone();
  }
  
--------------------


You in this case would create your links to your system (my code is
incomplete and simplified).



Michael

http://www.herger.net/slim-plugins - Spotty, MusicArtistInfo
------------------------------------------------------------------------
mherger's Profile: http://forums.slimdevices.com/member.php?userid=50
View this thread: http://forums.slimdevices.com/showthread.php?t=111851

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to