forked from michaelherger/MusicArtistInfo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Settings.pm
51 lines (37 loc) · 1.38 KB
/
Settings.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package Plugins::MusicArtistInfo::Settings;
use strict;
use base qw(Slim::Web::Settings);
use Slim::Utils::Prefs;
use Plugins::MusicArtistInfo::Common qw(CAN_IMAGEPROXY CAN_ONLINE_LIBRARY);
my $prefs = preferences('plugin.musicartistinfo');
my $serverprefs = preferences('server');
sub name {
return 'PLUGIN_MUSICARTISTINFO';
}
sub prefs {
return ($prefs, qw(browseArtistPictures runImporter lookupArtistPictures lookupCoverArt reviewFolder artistImageFolder lyricsFolder bioFolder
lookupAlbumArtistPicturesOnly saveMissingArtistPicturePlaceholder replaceOnlineGenres fallBackToEnglish hidextramenusitems));
}
sub page {
return 'plugins/MusicArtistInfo/settings.html';
}
sub handler {
my ($class, $client, $paramRef, $pageSetup) = @_;
# artfolder is a server setting - need to handle it manually
if ($paramRef->{'saveSettings'}) {
$serverprefs->set('artfolder', $paramRef->{artfolder});
# XXX - what's wrong here? We should not need to do this!
my (undef, @prefs) = $class->prefs();
foreach (@prefs) {
$paramRef->{"pref_$_"} ||= '';
}
}
$paramRef->{noImageProxy} = !CAN_IMAGEPROXY;
$paramRef->{canOnlineLibrary} = CAN_ONLINE_LIBRARY;
$paramRef->{artfolder} = $serverprefs->get('artfolder');
if ( $paramRef->{artfolder} && !(-d $paramRef->{artfolder} && -w _) ) {
$paramRef->{saveAlbumCoversDisabled} = 1;
}
$class->SUPER::handler($client, $paramRef, $pageSetup)
}
1;