Converting plugins from 5.x to 6.x
From SqueezeboxWiki
Revision as of 07:11, 23 June 2010 by Soulkeeper (Talk | contribs)
Convert your plugin from the 5.x API to 6.x
During the development of 6.0 - a large portion of the backend was written, old APIs were removed, and new ones put in place. Where applicable, wrapper methods were kept that point the old to the new.
Here are the changes needed to convert a 5.x plugin to 6.x:
- getDisplayName() should return the string token not the result of the string() call. IE:
sub getDisplayname { return 'PLUGIN_NAME'; # not return string('PLUGIN_NAME'); }
- The string() subroutine should be changed to a method on the $client object recieved as a parameter whenever doing anything on the client display. IE:
$client->string('HELLO');# not string('HELLO');
Note: This is not required for the web interface (eg settings).
- Calls to Slim::Music::Info::artist(), album(), artists(), etc have been removed. They've been replaced with calls to the new DataStores API. Here's basic usage:
my $ds = Slim::Music::Info::getCurrentDataStore(); # To retrieve a Artist object: my $artistObj = $ds->find('contributors', { 'contributor.name' => "The Beatles" } );
- Calls into Slim::Player::openRemoteStream() should look at using the new Slim::Networking::SimpleAsyncHTTP module for non-blocking remote web requests.