Converting plugins from 6.x to 6.5
From SqueezeboxWiki
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.