There is now a new version of the Song Info plugin available with the
changes:
- The information are shown in context menus on artists, albums and
tracks. You can also configure for each information module which
interfaces (jive, player, web) it should appear.
- Added support for possibility to implement information providers as
separate plugin.
Philip, in your FilesViewer plugin you will need to do something like
this:
In initPlugin:
Code:
--------------------
if(UNIVERSAL::can("Plugins::SongInfo::Plugin","registerInformationModule")) {
Plugins::SongInfo::Plugin::registerInformationModule('filesviewertracktextfiles',{
'name' => 'Files Viewer',
'description' => "This module gets information from text file in the album
directory",
'developedBy' => 'Philip Meyer',
'function' => \&getSongInfoFiles,
'type' => 'text',
'context' => 'track',
'jivemenu' => 1,
'playermenu' => 1,
'webmenu' => 1,
'properties' => [
]
});
}
--------------------
And implement the getSongInfoFiles function referred to in the above
register call:
Code:
--------------------
sub getSongInfoFiles {
my $client = shift;
my $callback = shift;
my $errorCallback = shift;
my $callbackParams = shift;
my $track = shift;
my $params = shift;
my @result = ();
# TODO: Implement, read all files in a specific folder, let's just hard code
them now to show the concept
use File::Basename qw(dirname);
my $trackFolder = dirname(Slim::Utils::Misc::pathFromFileURL($track->url));
my $entry = {
'type' => 'text',
'name' => 'filename1.txt',
'text' => 'contents of file1....',
};
push @result,$entry;
$entry = {
'type' => 'text',
'name' => 'filename2.txt',
'text' => 'contents of file2....',
};
push @result,$entry;
eval {
&{$callback}($client,$callbackParams,\...@result);
};
if( $@ ) {
$log->error("Error calling callback: $@");
}
}
--------------------
The above is just a sample with two hard coded files, you will need to
implement it so it read files in the directory associated with the
current track or something similar.
--
erland
Erland Isaksson
'My homepage' (http://erland.isaksson.info) (Install my plugins through
Extension Downloader)
(Developer of 'TrackStat, SQLPlayList, DynamicPlayList, Custom Browse,
Custom Scan, Custom Skip, Multi Library, Title Switcher and Database
Query plugins'
(http://wiki.erland.isaksson.info/index.php/Category:SlimServer))
------------------------------------------------------------------------
erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
View this thread: http://forums.slimdevices.com/showthread.php?t=76688
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins