<?sphp $this->text('pagetitle') ?>
 
Home of the Squeezebox™ & Transporter® network music players.

Converting plugins from 6.x to 6.5

From SqueezeboxWiki

Revision as of 07:14, 23 June 2010 by Soulkeeper (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Upgrading SlimServerPlugins to SlimServer 6.5

Database Access

Slim::Music::Info::getCurrentDataStore() is replaced by Slim::Schema; e.g. To get a track from a URL:

$track = Slim::Schema->resultset('Track')->objectForUrl($url);

To get a list of genre names from a track:

map {my $gen = $_; $gen->name()} ($track->genres())

Command Subscriptions

Slim::Control::Command::setExecuteCallback() is replaced by Slim::Control::Request::subscribe(); e.g.

Slim::Control::Request::subscribe(\&commandCallback,[['playlist'],['newsong']');

Slim::Control::Command::clearExecuteCallback() is replaced by Slim::Control::Request::unsubscribe().

Command Callbacks

To get the params from a command callback:

sub commandCallback($) {  
    my $request = shift;  
    my $client = $request->client();  
    # Parameter - filename of track being played  
    my $filename = $request->getParam('_path');  
    #or  
    my @params = $request->renderAsArray();
}

Client Methods

Many functions are now client methods; e.g. Slim::Display::Animation::showBriefly() is now $client->showBriefly()

Setup

Validation functions have moved; e.g. Slim::Web::Setup::validateTrueFalse() is now Slim::Utils::Validate::trueFalse()

Others

Slim::Player::Playlist::song($client) returns an object rather than the url. Call ->url on the function to get the URL.