[Slim-Checkins] r11770 - in /trunk/server/Slim: ./ Buttons/ Buttons/Input/ Control/ Display/ Display/Lib/ Formats/ Music/ Networking/ Networking/Async/ Networking/SliMP3/ Player/ Player/Protocols/ Plugin/CLI/ Plugin/Favorites/ Plugin/Rhapsody/ Plugin/SavePlaylist/ Plugin/iTunes/ Schema/ Schema/ResultSet/ Utils/ Utils/Prefs/ Web/ Web/Pages/ Web/Settings/Server/
adrian at svn.slimdevices.com
adrian at svn.slimdevices.com
Mon Apr 16 15:26:59 PDT 2007
Author: adrian
Date: Mon Apr 16 15:26:59 2007
New Revision: 11770
URL: http://svn.slimdevices.com?rev=11770&view=rev
Log:
Bug: N/A
Description: migrate server global prefs to namespace prefs
server globals prefs should now be accessed as:
my $prefs = preferences('server');
$prefs->get('prefname') or $prefs->set('prefname');
Modified:
trunk/server/Slim/Buttons/BrowseDB.pm
trunk/server/Slim/Buttons/BrowseTree.pm
trunk/server/Slim/Buttons/Common.pm
trunk/server/Slim/Buttons/Home.pm
trunk/server/Slim/Buttons/Information.pm
trunk/server/Slim/Buttons/Input/Text.pm
trunk/server/Slim/Buttons/Input/Time.pm
trunk/server/Slim/Buttons/Playlist.pm
trunk/server/Slim/Buttons/Search.pm
trunk/server/Slim/Control/Commands.pm
trunk/server/Slim/Control/Queries.pm
trunk/server/Slim/Display/Lib/Fonts.pm
trunk/server/Slim/Display/Squeezebox2.pm
trunk/server/Slim/Display/SqueezeboxG.pm
trunk/server/Slim/Display/Text.pm
trunk/server/Slim/Formats/HTTP.pm
trunk/server/Slim/Formats/MMS.pm
trunk/server/Slim/Formats/RemoteStream.pm
trunk/server/Slim/Formats/XML.pm
trunk/server/Slim/Music/Artwork.pm
trunk/server/Slim/Music/Import.pm
trunk/server/Slim/Music/Info.pm
trunk/server/Slim/Music/MusicFolderScan.pm
trunk/server/Slim/Music/PlaylistFolderScan.pm
trunk/server/Slim/Networking/Async.pm
trunk/server/Slim/Networking/Async/HTTP.pm
trunk/server/Slim/Networking/SimpleAsyncHTTP.pm
trunk/server/Slim/Networking/SliMP3/Stream.pm
trunk/server/Slim/Networking/Slimproto.pm
trunk/server/Slim/Networking/mDNS.pm
trunk/server/Slim/Player/Client.pm
trunk/server/Slim/Player/Playlist.pm
trunk/server/Slim/Player/Protocols/MMS.pm
trunk/server/Slim/Player/Source.pm
trunk/server/Slim/Player/Squeezebox.pm
trunk/server/Slim/Player/TranscodingHelper.pm
trunk/server/Slim/Plugin/CLI/Plugin.pm
trunk/server/Slim/Plugin/Favorites/Opml.pm
trunk/server/Slim/Plugin/Favorites/OpmlFavorites.pm
trunk/server/Slim/Plugin/Favorites/Playlist.pm
trunk/server/Slim/Plugin/Rhapsody/ProtocolHandler.pm
trunk/server/Slim/Plugin/SavePlaylist/Plugin.pm
trunk/server/Slim/Plugin/iTunes/Common.pm
trunk/server/Slim/Plugin/iTunes/Settings.pm
trunk/server/Slim/Schema.pm
trunk/server/Slim/Schema/Album.pm
trunk/server/Slim/Schema/ResultSet/Age.pm
trunk/server/Slim/Schema/ResultSet/Album.pm
trunk/server/Slim/Schema/ResultSet/Contributor.pm
trunk/server/Slim/Schema/ResultSet/Genre.pm
trunk/server/Slim/Schema/ResultSet/Playlist.pm
trunk/server/Slim/Schema/Storage.pm
trunk/server/Slim/Schema/Track.pm
trunk/server/Slim/Utils/Cache.pm
trunk/server/Slim/Utils/DateTime.pm
trunk/server/Slim/Utils/Misc.pm
trunk/server/Slim/Utils/MySQLHelper.pm
trunk/server/Slim/Utils/Network.pm
trunk/server/Slim/Utils/PluginManager.pm
trunk/server/Slim/Utils/Prefs.pm
trunk/server/Slim/Utils/Prefs/Namespace.pm
trunk/server/Slim/Utils/Prefs/OldPrefs.pm
trunk/server/Slim/Utils/Scanner.pm
trunk/server/Slim/Utils/Strings.pm
trunk/server/Slim/Utils/Text.pm
trunk/server/Slim/Utils/Validate.pm
trunk/server/Slim/Web/Graphics.pm
trunk/server/Slim/Web/HTTP.pm
trunk/server/Slim/Web/Pages.pm
trunk/server/Slim/Web/Pages/BrowseDB.pm
trunk/server/Slim/Web/Pages/BrowseTree.pm
trunk/server/Slim/Web/Pages/Home.pm
trunk/server/Slim/Web/Pages/LiveSearch.pm
trunk/server/Slim/Web/Pages/Playlist.pm
trunk/server/Slim/Web/Pages/Search.pm
trunk/server/Slim/Web/Pages/Status.pm
trunk/server/Slim/Web/Settings/Server/Basic.pm
trunk/server/Slim/Web/Settings/Server/Behavior.pm
trunk/server/Slim/Web/Settings/Server/FileTypes.pm
trunk/server/Slim/Web/Settings/Server/Network.pm
trunk/server/Slim/Web/Settings/Server/Performance.pm
trunk/server/Slim/Web/Settings/Server/Security.pm
trunk/server/Slim/Web/Settings/Server/TextFormatting.pm
trunk/server/Slim/Web/Settings/Server/UserInterface.pm
trunk/server/Slim/Web/Setup.pm
trunk/server/Slim/Web/UPnPMediaServer.pm
Modified: trunk/server/Slim/Buttons/BrowseDB.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Buttons/BrowseDB.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Buttons/BrowseDB.pm (original)
+++ trunk/server/Slim/Buttons/BrowseDB.pm Mon Apr 16 15:26:59 2007
@@ -29,6 +29,9 @@
use Slim::Music::Info;
use Slim::Utils::Log;
use Slim::Utils::Misc;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
our %functions = ();
our $mixer;
@@ -218,7 +221,7 @@
}
# In some cases just deal with the song individually
- if ($addorinsert || !$container || !Slim::Utils::Prefs::get('playtrackalbum')) {
+ if ($addorinsert || !$container || !$prefs->get('playtrackalbum')) {
$command = 'playtracks';
$command = 'addtracks' if $addorinsert == 1;
@@ -441,7 +444,7 @@
if ($field eq 'contributor' &&
$currentItem->id eq Slim::Schema->variousArtistsObject->id &&
- Slim::Utils::Prefs::get('variousArtistAutoIdentification')) {
+ $prefs->get('variousArtistAutoIdentification')) {
$findCriteria->{'album.compilation'} = 1;
}
@@ -560,7 +563,7 @@
my @name = $item->name;
my $findCriteria = $client->modeParam('findCriteria') || {};
- if (Slim::Utils::Prefs::get('showYear') && !$findCriteria->{'year.id'}) {
+ if ($prefs->get('showYear') && !$findCriteria->{'year.id'}) {
if (my $year = $item->year) {
@@ -568,7 +571,7 @@
}
}
- if (Slim::Utils::Prefs::get('showArtist') && !$findCriteria->{'contributor.id'}) {
+ if ($prefs->get('showArtist') && !$findCriteria->{'contributor.id'}) {
my @artists = ();
my $noArtist = $client->string('NO_ARTIST');
@@ -731,7 +734,7 @@
if ($levels[$level] eq 'age') {
- @items = $topRS->slice(0, (Slim::Utils::Prefs::get('browseagelimit') - 1));
+ @items = $topRS->slice(0, ($prefs->get('browseagelimit') - 1));
} else {
@@ -782,7 +785,7 @@
}
# Dynamically create a VA/Compilation item under artists, like iTunes does.
- if ($levels[$level] eq 'contributor' && !$search && Slim::Utils::Prefs::get('variousArtistAutoIdentification')) {
+ if ($levels[$level] eq 'contributor' && !$search && $prefs->get('variousArtistAutoIdentification')) {
# Only show VA if there exists valid data below this level.
if (Slim::Schema->variousArtistsAlbumCount($filters)) {
Modified: trunk/server/Slim/Buttons/BrowseTree.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Buttons/BrowseTree.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Buttons/BrowseTree.pm (original)
+++ trunk/server/Slim/Buttons/BrowseTree.pm Mon Apr 16 15:26:59 2007
@@ -28,6 +28,9 @@
use Slim::Music::Info;
use Slim::Utils::Log;
use Slim::Utils::Misc;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
our %functions = ();
our $mixer;
@@ -50,7 +53,7 @@
'hierarchy' => '',
};
- if (Slim::Utils::Prefs::get('audiodir')) {
+ if ($prefs->get('audiodir')) {
Slim::Buttons::Common::addMode($mode, Slim::Buttons::BrowseTree::getFunctions(), \&Slim::Buttons::BrowseTree::setMode);
Slim::Buttons::Home::addSubMenu('BROWSE_MUSIC', $name, $menu);
@@ -112,7 +115,7 @@
'overlay' => [ undef, $client->symbols('notesymbol') ]
});
- if ($descend || !Slim::Utils::Prefs::get('playtrackalbum') || $addorinsert || !Slim::Music::Info::isSong($currentItem)) {
+ if ($descend || !$prefs->get('playtrackalbum') || $addorinsert || !Slim::Music::Info::isSong($currentItem)) {
$client->execute(['playlist', $command, $currentItem]);
Modified: trunk/server/Slim/Buttons/Common.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Buttons/Common.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Buttons/Common.pm (original)
+++ trunk/server/Slim/Buttons/Common.pm Mon Apr 16 15:26:59 2007
@@ -50,6 +50,7 @@
use Slim::Buttons::SqueezeNetwork;
use Slim::Buttons::XMLBrowser;
use Slim::Buttons::Volume;
+use Slim::Utils::Prefs;
# hash of references to functions to call when we leave a mode
our %leaveMode = ();
@@ -93,6 +94,8 @@
our $scrollClientHash = {};
my $log = logger('player.ui');
+
+my $prefs = preferences('server');
=head1 METHODS
@@ -1475,7 +1478,7 @@
my $now = Time::HiRes::time();
# if the user has hit new button or hasn't hit anything for 1.0 seconds, use the first letter
if (($digit ne $client->lastLetterDigit) ||
- ($client->lastLetterTime + Slim::Utils::Prefs::get("displaytexttimeout") < $now)) {
+ ($client->lastLetterTime + $prefs->get('displaytexttimeout') < $now)) {
$index = 0;
} else {
$index = $client->lastLetterIndex + 1;
@@ -1492,7 +1495,7 @@
sub testSkipNextNumberLetter {
my $client = shift;
my $digit = shift;
- return (($digit ne $client->lastLetterDigit) && (($client->lastLetterTime + Slim::Utils::Prefs::get("displaytexttimeout")) > Time::HiRes::time()));
+ return (($digit ne $client->lastLetterDigit) && (($client->lastLetterTime + $prefs->get('displaytexttimeout')) > Time::HiRes::time()));
}
sub numberScroll {
@@ -1520,7 +1523,7 @@
}else{
my $now = Time::HiRes::time();
# If the user hasn't pressed a button for the last 1.0 seconds then jump straight to the requested item
- if ($client->lastDigitTime + Slim::Utils::Prefs::get("displaytexttimeout") < $now) {
+ if ($client->lastDigitTime + $prefs->get('displaytexttimeout') < $now) {
$i = ($digit - 1) % 10;
}else{
$i = $client->lastDigitIndex * 10 + $digit - 1;
Modified: trunk/server/Slim/Buttons/Home.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Buttons/Home.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Buttons/Home.pm (original)
+++ trunk/server/Slim/Buttons/Home.pm Mon Apr 16 15:26:59 2007
@@ -38,8 +38,11 @@
use Slim::Buttons::RemoteTrackInfo;
use Slim::Utils::Log;
use Slim::Utils::Misc;
+use Slim::Utils::Prefs;
my $log = logger('player.menu');
+
+my $prefs = preferences('server');
our %home = ();
our %defaultParams = ();
@@ -510,16 +513,10 @@
my @list = ();
- my %disabledplugins = map { $_ => 1 } Slim::Utils::Prefs::getArray('disabledplugins');
-
- for my $sub (sort {((Slim::Utils::Prefs::get("rank-$b") || 0) <=>
- (Slim::Utils::Prefs::get("rank-$a") || 0)) ||
+ for my $sub (sort {(($prefs->get("rank-$b") || 0) <=>
+ ($prefs->get("rank-$a") || 0)) ||
(lc(cmpString($client, $a)) cmp lc(cmpString($client, $b)))}
keys %{$params->{'submenus'}}) {
-
- if (exists $disabledplugins{$sub}) {
- next;
- }
# Leakage of the DigitalInput plugin..
if ($sub eq 'PLUGIN_DIGITAL_INPUT' && !$client->hasDigitalIn) {
@@ -642,11 +639,11 @@
for my $menuOption (sort keys %home) {
- if ($menuOption eq 'BROWSE_MUSIC_FOLDER' && !Slim::Utils::Prefs::get('audiodir')) {
+ if ($menuOption eq 'BROWSE_MUSIC_FOLDER' && !$prefs->get('audiodir')) {
next;
}
- if ($menuOption eq 'SAVED_PLAYLISTS' && !Slim::Utils::Prefs::get('playlistdir')) {
+ if ($menuOption eq 'SAVED_PLAYLISTS' && !$prefs->get('playlistdir')) {
next;
}
Modified: trunk/server/Slim/Buttons/Information.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Buttons/Information.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Buttons/Information.pm (original)
+++ trunk/server/Slim/Buttons/Information.pm Mon Apr 16 15:26:59 2007
@@ -49,6 +49,7 @@
use Slim::Music::Info;
use Slim::Utils::Misc;
use Slim::Utils::Network;
+use Slim::Utils::Prefs;
our $modules = ();
our %enabled = ();
@@ -164,7 +165,7 @@
sub { $::VERSION },
\&Slim::Utils::Misc::settingsDiagString,
sub { 3483 },
- sub { Slim::Utils::Prefs::get('httpport') },
+ sub { preferences('server')->get('httpport') },
\&Slim::Utils::Network::hostName,
\&Slim::Utils::Network::serverAddr,
\&Slim::Player::Client::clientCount,
Modified: trunk/server/Slim/Buttons/Input/Text.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Buttons/Input/Text.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Buttons/Input/Text.pm (original)
+++ trunk/server/Slim/Buttons/Input/Text.pm Mon Apr 16 15:26:59 2007
@@ -65,6 +65,7 @@
use Slim::Buttons::Common;
use Slim::Utils::Misc;
+use Slim::Utils::Prefs;
# default arrays for numberLetterRef
@@ -208,7 +209,7 @@
$client->modeParam('listIndex', $index);
# set up a timer to automatically skip ahead
- Slim::Utils::Timers::setTimer($client, Time::HiRes::time() + Slim::Utils::Prefs::get("displaytexttimeout"), \&nextChar);
+ Slim::Utils::Timers::setTimer($client, Time::HiRes::time() + preferences('server')->get('displaytexttimeout'), \&nextChar);
#update the display
$client->update();
Modified: trunk/server/Slim/Buttons/Input/Time.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Buttons/Input/Time.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Buttons/Input/Time.pm (original)
+++ trunk/server/Slim/Buttons/Input/Time.pm Mon Apr 16 15:26:59 2007
@@ -43,6 +43,9 @@
use Slim::Buttons::Common;
use Slim::Utils::DateTime;
use Slim::Utils::Misc;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
Slim::Buttons::Common::addMode('INPUT.Time',getFunctions(),\&setMode);
@@ -128,7 +131,7 @@
my $c = $client->modeParam('cursorPos');
- my $ampm = (Slim::Utils::Prefs::get('timeFormat') =~ /%p/);
+ my $ampm = ($prefs->get('timeFormat') =~ /%p/);
my $max = 9;
if ($c == 0) {
@@ -193,7 +196,7 @@
$$valueRef = Slim::Utils::DateTime::timeDigitsToTime($h0, $h1, $m0, $m1, $p);
- Slim::Utils::Timers::setTimer($client, Time::HiRes::time() + Slim::Utils::Prefs::get("displaytexttimeout"), \&nextChar);
+ Slim::Utils::Timers::setTimer($client, Time::HiRes::time() + $prefs->get('displaytexttimeout'), \&nextChar);
#update the display
my $onChange = $client->modeParam('onChange');
@@ -402,7 +405,7 @@
my $charIndex;
- if ($cursorPos > ((Slim::Utils::Prefs::get('timeFormat') =~ /%p/) ? 4 : 3)) {
+ if ($cursorPos > (($prefs->get('timeFormat') =~ /%p/) ? 4 : 3)) {
exitInput($client,'right');
return;
}
@@ -448,7 +451,7 @@
sub prepKnob {
my ($client, $digits) = @_;
- my $ampm = (Slim::Utils::Prefs::get('timeFormat') =~ /%p/);
+ my $ampm = ($prefs->get('timeFormat') =~ /%p/);
my $c = $client->modeParam('cursorPos');
if ($c == 0) {
@@ -504,7 +507,7 @@
my ($h0, $h1, $m0, $m1, $p) = Slim::Utils::DateTime::timeDigits($valueRef);
- my $ampm = (Slim::Utils::Prefs::get('timeFormat') =~ /%p/);
+ my $ampm = ($prefs->get('timeFormat') =~ /%p/);
$p = ($p && $p eq 'PM') ? 1 : 0;
Modified: trunk/server/Slim/Buttons/Playlist.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Buttons/Playlist.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Buttons/Playlist.pm (original)
+++ trunk/server/Slim/Buttons/Playlist.pm Mon Apr 16 15:26:59 2007
@@ -29,6 +29,9 @@
use Slim::Control::Request;
use Slim::Utils::Log;
use Slim::Utils::Misc;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
our %functions = ();
my %playlistParams = ();
@@ -265,7 +268,7 @@
'zap' => sub {
my $client = shift;
- my $zapped = catfile(Slim::Utils::Prefs::get('playlistdir'), $client->string('ZAPPED_SONGS') . '.m3u');
+ my $zapped = catfile($prefs->get('playlistdir'), $client->string('ZAPPED_SONGS') . '.m3u');
if (Slim::Player::Playlist::count($client) > 0) {
Modified: trunk/server/Slim/Buttons/Search.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Buttons/Search.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Buttons/Search.pm (original)
+++ trunk/server/Slim/Buttons/Search.pm Mon Apr 16 15:26:59 2007
@@ -24,6 +24,7 @@
use File::Spec::Functions qw(:ALL);
use File::Spec::Functions qw(updir);
use Slim::Buttons::Common;
+use Slim::Utils::Prefs;
# button functions for search directory
my @defaultSearchChoices = qw(ARTISTS ALBUMS SONGS);
@@ -201,9 +202,11 @@
my $term = '';
+ my $prefs = preferences('server');
+
# Bug #738
# Which should be the default? Old - which is substring always?
- if (Slim::Utils::Prefs::get('searchSubString')) {
+ if ($prefs->get('searchSubString')) {
$term = '%';
}
@@ -219,7 +222,7 @@
# If we're searching in substrings, return - otherwise append another
# search which is effectively \b for the query. We might (should?)
# deal with alternate separator characters other than space.
- if (Slim::Utils::Prefs::get('searchSubString')) {
+ if ($prefs->get('searchSubString')) {
return [ $term ];
}
Modified: trunk/server/Slim/Control/Commands.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Control/Commands.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Control/Commands.pm (original)
+++ trunk/server/Slim/Control/Commands.pm Mon Apr 16 15:26:59 2007
@@ -39,8 +39,11 @@
use Slim::Utils::Log;
use Slim::Utils::Misc;
use Slim::Utils::Scanner;
+use Slim::Utils::Prefs;
my $log = logger('control.command');
+
+my $prefs = preferences('server');
sub alarmCommand {
# functions designed to execute requests have a single parameter, the
@@ -689,7 +692,7 @@
my $playlistObj = Slim::Schema->rs('Playlist')->updateOrCreate({
'url' => Slim::Utils::Misc::fileURLFromPath(
- catfile( Slim::Utils::Prefs::get('playlistdir'), $title . '.m3u')
+ catfile( $prefs->get('playlistdir'), $title . '.m3u')
),
'attributes' => {
@@ -700,7 +703,7 @@
my $annotatedList = [];
- if (Slim::Utils::Prefs::get('saveShuffled')) {
+ if ($prefs->get('saveShuffled')) {
for my $shuffleitem (@{Slim::Player::Playlist::shuffleList($client)}) {
push @$annotatedList, @{Slim::Player::Playlist::playList($client)}[$shuffleitem];
@@ -885,7 +888,7 @@
# this only seems to be useful for playlists?
if (!Slim::Music::Info::isRemoteURL($path) && !-e $path && !(Slim::Music::Info::isPlaylistURL($path))) {
- my $easypath = catfile(Slim::Utils::Prefs::get('playlistdir'), basename($url) . ".m3u");
+ my $easypath = catfile($prefs->get('playlistdir'), basename($url) . ".m3u");
if (-e $easypath) {
@@ -893,7 +896,7 @@
} else {
- $easypath = catfile(Slim::Utils::Prefs::get('playlistdir'), basename($url) . ".pls");
+ $easypath = catfile($prefs->get('playlistdir'), basename($url) . ".pls");
if (-e $easypath) {
$path = $easypath;
@@ -993,7 +996,7 @@
$line2 = $client->string('CHECKING_STREAM');
}
- my $timeout = Slim::Utils::Prefs::get('remotestreamtimeout') || 10;
+ my $timeout = $prefs->get('remotestreamtimeout') || 10;
$client->showBriefly( $line1, $line2, $timeout + 5 );
}
@@ -1200,7 +1203,7 @@
my $playlistObj = Slim::Schema->rs('Playlist')->updateOrCreate({
'url' => Slim::Utils::Misc::fileURLFromPath(
- catfile( Slim::Utils::Prefs::get('playlistdir'), $zapped . '.m3u')
+ catfile( $prefs->get('playlistdir'), $zapped . '.m3u')
),
'attributes' => {
@@ -1587,7 +1590,7 @@
$newName =~ tr|.:\x00-\x1f\/\\| |s;
my $newUrl = Slim::Utils::Misc::fileURLFromPath(
- catfile(Slim::Utils::Prefs::get('playlistdir'), $newName . '.m3u')
+ catfile($prefs->get('playlistdir'), $newName . '.m3u')
);
my $existingPlaylist = Slim::Schema->rs('Playlist')->objectForUrl({
Modified: trunk/server/Slim/Control/Queries.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Control/Queries.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Control/Queries.pm (original)
+++ trunk/server/Slim/Control/Queries.pm Mon Apr 16 15:26:59 2007
@@ -38,9 +38,11 @@
use Slim::Utils::Alarms;
use Slim::Utils::Log;
use Slim::Utils::Unicode;
+use Slim::Utils::Prefs;
my $log = logger('control.queries');
+my $prefs = preferences('server');
sub alarmsQuery {
my $request = shift;
@@ -338,7 +340,7 @@
# searching, or if we have a track
my $count_va = 0;
- if (Slim::Utils::Prefs::get('variousArtistAutoIdentification') &&
+ if ($prefs->get('variousArtistAutoIdentification') &&
!defined $search && !defined $trackID) {
# Only show VA item if there are any
@@ -1165,7 +1167,7 @@
return;
}
- $request->addResult('_p2', Slim::Utils::Prefs::get($prefName));
+ $request->addResult('_p2', $prefs->get($prefName));
$request->setStatusDone();
}
@@ -1308,7 +1310,7 @@
$savePrefs{'server'} = \@prefs;
for my $pref (@{$savePrefs{'server'}}) {
- if (defined(my $value = Slim::Utils::Prefs::get($pref))) {
+ if (defined(my $value = $prefs->get($pref))) {
$request->addResult($pref, $value);
}
}
@@ -1633,7 +1635,7 @@
::idleStreams() ;
}
- my $repShuffle = Slim::Utils::Prefs::get('reshuffleOnRepeat');
+ my $repShuffle = $prefs->get('reshuffleOnRepeat');
my $canPredictFuture = ($repeat == 2) # we're repeating all
&& # and
( ($shuffle == 0) # either we're not shuffling
Modified: trunk/server/Slim/Display/Lib/Fonts.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Display/Lib/Fonts.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Display/Lib/Fonts.pm (original)
+++ trunk/server/Slim/Display/Lib/Fonts.pm Mon Apr 16 15:26:59 2007
@@ -43,6 +43,9 @@
use Slim::Utils::Log;
use Slim::Utils::Misc;
use Slim::Utils::OSDetect;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
our $fonts;
our $fonthash;
@@ -428,7 +431,7 @@
}
sub fontCacheFile {
- return catdir( Slim::Utils::Prefs::get('cachedir'),
+ return catdir( $prefs->get('cachedir'),
Slim::Utils::OSDetect::OS() eq 'unix' ? 'fontcache' : 'fonts.bin');
}
@@ -538,8 +541,8 @@
# store height and then skip font if never seen a player requiring it
$fonts->{'height'}->{$font} = $height - 1;
- next if ($height == 17 && !Slim::Utils::Prefs::get('loadFontsSqueezeboxG'));
- next if ($height == 33 && !Slim::Utils::Prefs::get('loadFontsSqueezeboxII'));
+ next if ($height == 17 && !$prefs->get('loadFontsSqueezeboxG'));
+ next if ($height == 33 && !$prefs->get('loadFontsSqueezebox2'));
$log->debug("loading...");
Modified: trunk/server/Slim/Display/Squeezebox2.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Display/Squeezebox2.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Display/Squeezebox2.pm (original)
+++ trunk/server/Slim/Display/Squeezebox2.pm Mon Apr 16 15:26:59 2007
@@ -23,6 +23,10 @@
use strict;
use base qw(Slim::Display::Graphics);
+
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
# constants
my $display_maxLine = 2; # render up to 3 lines [0..$display_maxLine]
@@ -133,8 +137,8 @@
my $display = shift;
# load fonts for this display if not already loaded and remember to load at startup in future
- if (!Slim::Utils::Prefs::get('loadFontsSqueezeboxII')) {
- Slim::Utils::Prefs::set('loadFontsSqueezeboxII', 1); # 'II' as set prefs can't take numbers!
+ if (!$prefs->get('loadFontsSqueezebox2')) {
+ $prefs->set('loadFontsSqueezebox2', 1);
Slim::Display::Lib::Fonts::loadFonts(1);
}
Modified: trunk/server/Slim/Display/SqueezeboxG.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Display/SqueezeboxG.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Display/SqueezeboxG.pm (original)
+++ trunk/server/Slim/Display/SqueezeboxG.pm Mon Apr 16 15:26:59 2007
@@ -23,6 +23,10 @@
use strict;
use base qw(Slim::Display::Graphics);
+
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
# constants
my $display_maxLine = 1; # render up to 2 lines [0..$display_maxLine]
@@ -74,8 +78,8 @@
my $display = shift;
# load fonts for this display if not already loaded and remember to load at startup in future
- if (!Slim::Utils::Prefs::get('loadFontsSqueezeboxG')) {
- Slim::Utils::Prefs::set('loadFontsSqueezeboxG', 1);
+ if (!$prefs->get('loadFontsSqueezeboxG')) {
+ $prefs->set('loadFontsSqueezeboxG', 1);
Slim::Display::Lib::Fonts::loadFonts(1);
}
Modified: trunk/server/Slim/Display/Text.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Display/Text.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Display/Text.pm (original)
+++ trunk/server/Slim/Display/Text.pm Mon Apr 16 15:26:59 2007
@@ -25,6 +25,9 @@
use base qw(Slim::Display::Display);
use Slim::Display::Lib::TextVFD;
+use Slim::Utils::Prefs;
+
+my $prefs = preference('server');
my $scroll_pad_scroll = 6; # chars of padding between scrolling text
my $scroll_pad_ticker = 8; # chars of padding in ticker mode
@@ -66,8 +69,8 @@
sub init {
my $display = shift;
- if (!Slim::Utils::Prefs::get('loadFontsText')) {
- Slim::Utils::Prefs::set('loadFontsText', 1);
+ if (!$prefs->get('loadFontsText')) {
+ $prefs->set('loadFontsText', 1);
}
Slim::Utils::Prefs::initClientPrefs($display->client, $defaultPrefs);
Modified: trunk/server/Slim/Formats/HTTP.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Formats/HTTP.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Formats/HTTP.pm (original)
+++ trunk/server/Slim/Formats/HTTP.pm Mon Apr 16 15:26:59 2007
@@ -27,6 +27,7 @@
use Slim::Utils::Log;
use Slim::Utils::Unicode;
+use Slim::Utils::Prefs;
use constant DEFAULT_TYPE => 'mp3';
@@ -78,7 +79,7 @@
my ($server, $port, $path, $user, $password) = Slim::Utils::Misc::crackURL($url);
# Use full path for proxy servers
- my $proxy = Slim::Utils::Prefs::get('webproxy');
+ my $proxy = preferences('server')->get('webproxy');
if ( $proxy && $server !~ /(?:localhost|127.0.0.1)/ ) {
$path = "http://$server:$port$path";
}
Modified: trunk/server/Slim/Formats/MMS.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Formats/MMS.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Formats/MMS.pm (original)
+++ trunk/server/Slim/Formats/MMS.pm Mon Apr 16 15:26:59 2007
@@ -123,7 +123,7 @@
my ($server, $port, $path, $user, $password) = Slim::Utils::Misc::crackURL($url);
# Use full path for proxy servers
- my $proxy = Slim::Utils::Prefs::get('webproxy');
+ my $proxy = preferences('server')->get('webproxy');
if ( $proxy && $server !~ /(?:localhost|127.0.0.1)/ ) {
$path = "http://$server:$port$path";
}
Modified: trunk/server/Slim/Formats/RemoteStream.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Formats/RemoteStream.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Formats/RemoteStream.pm (original)
+++ trunk/server/Slim/Formats/RemoteStream.pm Mon Apr 16 15:26:59 2007
@@ -27,6 +27,8 @@
my $log = logger('player.streaming.remote');
+my $prefs = preferences('server');
+
sub open {
my $class = shift;
my $args = shift;
@@ -41,8 +43,8 @@
return;
}
- my $timeout = $args->{'timeout'} || Slim::Utils::Prefs::get('remotestreamtimeout');
- my $proxy = Slim::Utils::Prefs::get('webproxy');
+ my $timeout = $args->{'timeout'} || $prefs->get('remotestreamtimeout');
+ my $proxy = $prefs->get('webproxy');
my $peeraddr = "$server:$port";
Modified: trunk/server/Slim/Formats/XML.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Formats/XML.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Formats/XML.pm (original)
+++ trunk/server/Slim/Formats/XML.pm Mon Apr 16 15:26:59 2007
@@ -22,6 +22,7 @@
use Slim::Utils::Cache;
use Slim::Utils::Misc;
use Slim::Utils::Log;
+use Slim::Utils::Prefs;
# How long to cache parsed XML data
our $XML_CACHE_TIME = 300;
@@ -532,7 +533,7 @@
$$content =~ s/encoding="windows-1252"/encoding="iso-8859-1"/i;
my $xml = undef;
- my $timeout = (Slim::Utils::Prefs::get('remotestreamtimeout') || 5) * 2;
+ my $timeout = (preferences('server')->get('remotestreamtimeout') || 5) * 2;
# Bug 3510 - check for bogus content.
if ($$content !~ /<\??(?:xml|rss)/) {
Modified: trunk/server/Slim/Music/Artwork.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Music/Artwork.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Music/Artwork.pm (original)
+++ trunk/server/Slim/Music/Artwork.pm Mon Apr 16 15:26:59 2007
@@ -40,6 +40,8 @@
my $artworkDir = '';
my $log = logger('artwork');
+my $prefs = preferences('server');
+
tie my %lastFile, 'Tie::Cache::LRU', 32;
# Public class methods
@@ -238,7 +240,7 @@
# these seem to be in a particular order - not sure if that means anything.
my @filestotry = map { @{$nameslist{$_}} } @names;
- my $artwork = Slim::Utils::Prefs::get('coverArt');
+ my $artwork = $prefs->get('coverArt');
# If the user has specified a pattern to match the artwork on, we need
# to generate that pattern. This is nasty.
@@ -261,7 +263,7 @@
my ($body, $contentType) = $class->getImageContentAndType($artPath);
- my $artDir = dir(Slim::Utils::Prefs::get('artfolder'));
+ my $artDir = dir($prefs->get('artfolder'));
if (!$body && defined $artDir) {
Modified: trunk/server/Slim/Music/Import.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Music/Import.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Music/Import.pm (original)
+++ trunk/server/Slim/Music/Import.pm Mon Apr 16 15:26:59 2007
@@ -17,7 +17,7 @@
Slim::Music::Import->addImporter($class);
# Turn the importer on or off
- Slim::Music::Import->useImporter($class, Slim::Utils::Prefs::get('itunes'));
+ Slim::Music::Import->useImporter($class, $prefs->get('itunes'));
# Start a serial scan of all importers.
Slim::Music::Import->runScan;
@@ -49,6 +49,7 @@
use Slim::Utils::Log;
use Slim::Utils::Misc;
use Slim::Utils::OSDetect;
+use Slim::Utils::Prefs;
{
my $class = __PACKAGE__;
@@ -65,6 +66,7 @@
my $folderScanClass = 'Slim::Music::MusicFolderScan';
my $log = logger('scan.import');
+my $prefs = preferences('server');
=head2 launchScan( \%args )
@@ -82,6 +84,8 @@
$args->{"prefsfile=$::prefsfile"} = 1;
}
+ Slim::Utils::Prefs->writeAll;
+
$args->{ "prefsdir=" . Slim::Utils::Prefs->dir } = 1;
if (Slim::Utils::Log->writeConfig) {
@@ -96,7 +100,7 @@
# Add in the various importer flags
for my $importer (qw(itunes musicmagic)) {
- if (Slim::Utils::Prefs::get($importer)) {
+ if ($prefs->get($importer)) {
$args->{$importer} = 1;
}
@@ -105,7 +109,7 @@
# Set scanner priority. Use the current server priority unless
# scannerPriority has been specified.
- my $scannerPriority = Slim::Utils::Prefs::get("scannerPriority");
+ my $scannerPriority = $prefs->get('scannerPriority');
unless (defined $scannerPriority && $scannerPriority ne "") {
$scannerPriority = Slim::Utils::Misc::getPriority();
Modified: trunk/server/Slim/Music/Info.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Music/Info.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Music/Info.pm (original)
+++ trunk/server/Slim/Music/Info.pm Mon Apr 16 15:26:59 2007
@@ -34,6 +34,7 @@
use Slim::Utils::Strings qw(string);
use Slim::Utils::Text;
use Slim::Utils::Unicode;
+use Slim::Utils::Prefs;
# three hashes containing the types we know about, populated by the loadTypesConfig routine below
# hash of default mime type index by three letter content type e.g. 'mp3' => audio/mpeg
@@ -64,6 +65,8 @@
tie our %urlToTypeCache, 'Tie::Cache::LRU', 16;
my $log = logger('database.info');
+
+my $prefs = preferences('server');
sub init {
@@ -508,18 +511,18 @@
# $titleFormat[$clientTitleFormat[$clientTitleFormatCurr]] get
# the title format
- return Slim::Utils::Prefs::getInd("titleFormat",
+ return $prefs->get('titleFormat')->[
# at the array index of the client titleformat array
$client->prefGet("titleFormat",
# which is currently selected
$client->prefGet('titleFormatCurr')
)
- );
+ ];
} else {
# in array syntax this would be $titleFormat[$titleFormatWeb]
- return Slim::Utils::Prefs::getInd("titleFormat", Slim::Utils::Prefs::get("titleFormatWeb"));
+ return $prefs->get('titleFormat')->[ $prefs->get('titleFormatWeb') ];
}
}
@@ -599,7 +602,7 @@
$file =~ s/\\/\//g;
# Get the candidate file name formats
- my @guessformats = Slim::Utils::Prefs::getArray("guessFileFormats");
+ my @guessformats = @{ $prefs->('guessFileFormats') };
# Check each format
foreach my $guess ( @guessformats ) {
@@ -755,7 +758,7 @@
}
my @splitTags = ();
- my $splitList = Slim::Utils::Prefs::get('splitList');
+ my $splitList = $prefs->get('splitList');
# only bother if there are some characters in the pref
if ($splitList) {
@@ -1107,8 +1110,8 @@
my $findTypes = shift || '';
my @disabled = ();
- my @audio = split(/\s*,\s*/, Slim::Utils::Prefs::get('disabledextensionsaudio'));
- my @playlist = split(/\s*,\s*/, Slim::Utils::Prefs::get('disabledextensionsplaylist'));
+ my @audio = split(/\s*,\s*/, $prefs->get('disabledextensionsaudio'));
+ my @playlist = split(/\s*,\s*/, $prefs->get('disabledextensionsplaylist'));
if ($findTypes eq 'audio') {
@@ -1273,7 +1276,7 @@
sub variousArtistString {
- return (Slim::Utils::Prefs::get('variousArtistsString') || string('VARIOUSARTISTS'));
+ return ($prefs->get('variousArtistsString') || string('VARIOUSARTISTS'));
}
Modified: trunk/server/Slim/Music/MusicFolderScan.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Music/MusicFolderScan.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Music/MusicFolderScan.pm (original)
+++ trunk/server/Slim/Music/MusicFolderScan.pm Mon Apr 16 15:26:59 2007
@@ -21,6 +21,7 @@
use Slim::Music::Info;
use Slim::Utils::Log;
use Slim::Utils::Scanner;
+use Slim::Utils::Prefs;
{
@@ -29,12 +30,14 @@
my $log = logger('scan.import');
+my $prefs = preferences('server');
+
sub init {
my $class = shift;
# Enable Folder scan only if audiodir is set and is a valid directory
my $enabled = 0;
- my $audioDir = Slim::Utils::Prefs::get('audiodir');
+ my $audioDir = $prefs->get('audiodir');
if (defined $audioDir && -d $audioDir) {
@@ -47,7 +50,7 @@
sub startScan {
my $class = shift;
- my $dir = shift || Slim::Utils::Prefs::get('audiodir');
+ my $dir = shift || $prefs->get('audiodir');
my $recurse = shift;
if (!defined $dir || !-d $dir) {
Modified: trunk/server/Slim/Music/PlaylistFolderScan.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Music/PlaylistFolderScan.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Music/PlaylistFolderScan.pm (original)
+++ trunk/server/Slim/Music/PlaylistFolderScan.pm Mon Apr 16 15:26:59 2007
@@ -32,6 +32,8 @@
my $log = logger('scan.import');
+my $prefs = preferences('server');
+
sub init {
my $class = shift;
@@ -41,7 +43,7 @@
# Enable Folder scan only if playlistdir is set and is a valid directory
my $enabled = 0;
- my $playlistDir = Slim::Utils::Prefs::get('playlistdir');
+ my $playlistDir = $prefs->get('playlistdir');
if (defined $playlistDir && -d $playlistDir) {
@@ -53,7 +55,7 @@
sub startScan {
my $class = shift;
- my $dir = shift || Slim::Utils::Prefs::get('playlistdir');
+ my $dir = shift || $prefs->get('playlistdir');
my $recurse = shift;
if (!defined $dir || !-d $dir) {
Modified: trunk/server/Slim/Networking/Async.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Networking/Async.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Networking/Async.pm (original)
+++ trunk/server/Slim/Networking/Async.pm Mon Apr 16 15:26:59 2007
@@ -24,6 +24,7 @@
use Slim::Networking::Select;
use Slim::Utils::Log;
use Slim::Utils::Misc;
+use Slim::Utils::Prefs;
__PACKAGE__->mk_classaccessors( qw(
nameserver socket
@@ -94,7 +95,7 @@
}
# Timeout defaults to the Radio Station Timeout pref
- $args->{Timeout} ||= Slim::Utils::Prefs::get('remotestreamtimeout') || 10;
+ $args->{Timeout} ||= preferences('server')->get('remotestreamtimeout') || 10;
# Skip async DNS if we know the IP address or are using a proxy (skipDNS)
if ( $args->{skipDNS} || $args->{PeerAddr} || Net::IP::ip_is_ipv4( $args->{Host} ) ) {
Modified: trunk/server/Slim/Networking/Async/HTTP.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Networking/Async/HTTP.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Networking/Async/HTTP.pm (original)
+++ trunk/server/Slim/Networking/Async/HTTP.pm Mon Apr 16 15:26:59 2007
@@ -47,6 +47,8 @@
use Slim::Utils::Prefs;
use Slim::Utils::Timers;
+my $prefs = preferences('server');
+
__PACKAGE__->mk_classaccessors( qw(
uri request response saveAs fh
) );
@@ -102,7 +104,7 @@
my $self = shift;
# Proxy will be used for non-local HTTP requests
- if ( my $proxy = Slim::Utils::Prefs::get('webproxy') ) {
+ if ( my $proxy = $prefs->get('webproxy') ) {
my $host = $self->request->uri->host;
my $scheme = $self->request->uri->scheme;
if ( $scheme ne 'https' && $host !~ /(?:localhost|127.0.0.1)/ ) {
@@ -351,7 +353,7 @@
$self->socket->set( passthrough => [ $self, $args ] );
# Timer in case the server never sends any body data
- my $timeout = Slim::Utils::Prefs::get('remotestreamtimeout') || 10;
+ my $timeout = $prefs->get('remotestreamtimeout') || 10;
Slim::Utils::Timers::setTimer( $self->socket, Time::HiRes::time() + $timeout, \&_http_socket_error, $self, $args );
Slim::Networking::Select::addError( $self->socket, \&_http_socket_error );
@@ -427,7 +429,7 @@
# More body data to read
# Some servers may never send EOF, but we want to return whatever data we've read
- my $timeout = Slim::Utils::Prefs::get('remotestreamtimeout') || 10;
+ my $timeout = $prefs->get('remotestreamtimeout') || 10;
Slim::Utils::Timers::setTimer( $socket, Time::HiRes::time() + $timeout, \&_http_read_timeout, $self, $args );
}
}
Modified: trunk/server/Slim/Networking/SimpleAsyncHTTP.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Networking/SimpleAsyncHTTP.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Networking/SimpleAsyncHTTP.pm (original)
+++ trunk/server/Slim/Networking/SimpleAsyncHTTP.pm Mon Apr 16 15:26:59 2007
@@ -27,6 +27,7 @@
use Slim::Networking::Async::HTTP;
use Slim::Utils::Cache;
use Slim::Utils::Log;
+use Slim::Utils::Prefs;
use HTTP::Date ();
use HTTP::Request;
@@ -125,7 +126,7 @@
my $timeout
= $self->{params}->{Timeout}
- || Slim::Utils::Prefs::get('remotestreamtimeout')
+ || preferences('server')->get('remotestreamtimeout')
|| 10;
my $request = HTTP::Request->new( $type => $url );
Modified: trunk/server/Slim/Networking/SliMP3/Stream.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Networking/SliMP3/Stream.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Networking/SliMP3/Stream.pm (original)
+++ trunk/server/Slim/Networking/SliMP3/Stream.pm Mon Apr 16 15:26:59 2007
@@ -14,6 +14,7 @@
use Slim::Utils::Log;
use Slim::Utils::Misc;
use Slim::Utils::Timers;
+use Slim::Utils::Prefs;
###
### lots o' knobs:
@@ -451,7 +452,7 @@
return 0;
}
- my $requestedChunkSize = Slim::Utils::Prefs::get('udpChunkSize');
+ my $requestedChunkSize = preferences('server')->get('udpChunkSize');
my $remainingSpace = $client->bufferSize() - ($curWptr * 2);
Modified: trunk/server/Slim/Networking/Slimproto.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Networking/Slimproto.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Networking/Slimproto.pm (original)
+++ trunk/server/Slim/Networking/Slimproto.pm Mon Apr 16 15:26:59 2007
@@ -27,6 +27,7 @@
use Slim::Utils::Misc;
use Slim::Utils::Network;
use Slim::Utils::Strings qw(string);
+use Slim::Utils::Prefs;
use constant SLIMPROTO_PORT => 3483;
@@ -156,7 +157,7 @@
my $tmpaddr = inet_ntoa($peer);
- if (Slim::Utils::Prefs::get('filterHosts') && !(Slim::Utils::Network::isAllowedHost($tmpaddr))) {
+ if (preferences('server')->get('filterHosts') && !(Slim::Utils::Network::isAllowedHost($tmpaddr))) {
$log->error("unauthorized host, accept denied: $tmpaddr");
Modified: trunk/server/Slim/Networking/mDNS.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Networking/mDNS.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Networking/mDNS.pm (original)
+++ trunk/server/Slim/Networking/mDNS.pm Mon Apr 16 15:26:59 2007
@@ -31,7 +31,9 @@
}
my $log = logger('network.mdns');
-
+
+my $prefs = preferences('server');
+
my %services = ();
sub init {
@@ -46,7 +48,7 @@
$log->info("Initializing..");
- my $cacheDir = Slim::Utils::Prefs::get('cachedir');
+ my $cacheDir = $prefs->get('cachedir');
if (!-d $cacheDir) {
@@ -68,7 +70,7 @@
return if !$class->init;
}
- my $name = Slim::Utils::Prefs::get('mDNSname');
+ my $name = $prefs->get('mDNSname');
if (!$name) {
Modified: trunk/server/Slim/Player/Client.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Player/Client.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Player/Client.pm (original)
+++ trunk/server/Slim/Player/Client.pm Mon Apr 16 15:26:59 2007
@@ -26,6 +26,8 @@
use Slim::Utils::Strings;
use Slim::Utils::Timers;
use Slim::Web::HTTP;
+
+my $prefs = preferences('server');
# depricated, use $client->maxVolume
our $maxVolume = 100;
@@ -375,7 +377,7 @@
Slim::Player::Sync::restoreSync($client);
# restore the old playlist if we aren't already synced with somebody (that has a playlist)
- if (!Slim::Player::Sync::isSynced($client) && Slim::Utils::Prefs::get('persistPlaylists')) {
+ if (!Slim::Player::Sync::isSynced($client) && $prefs->get('persistPlaylists')) {
my $playlist = Slim::Music::Info::playlistForClient($client);
my $currsong = $client->prefGet('currentSong');
Modified: trunk/server/Slim/Player/Playlist.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Player/Playlist.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Player/Playlist.pm (original)
+++ trunk/server/Slim/Player/Playlist.pm Mon Apr 16 15:26:59 2007
@@ -16,6 +16,8 @@
use Slim::Utils::Log;
use Slim::Utils::Misc;
use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
our %validSubCommands = map { $_ => 1 } qw(play append load_done loadalbum addalbum loadtracks addtracks clear delete move sync);
@@ -653,7 +655,7 @@
# This can happen if the user removes the
# playlist - because this is a closure, we get
# a bogus object back)
- if (!blessed($playlistObj) || !$playlistObj->can('tracks') || !Slim::Utils::Prefs::get('playlistdir')) {
+ if (!blessed($playlistObj) || !$playlistObj->can('tracks') || !$prefs->get('playlistdir')) {
return 0;
}
@@ -689,7 +691,7 @@
} else {
- unlink catfile(Slim::Utils::Prefs::get('playlistdir'), $playlistObj->title . '.m3u');
+ unlink catfile($prefs->get('playlistdir'), $playlistObj->title . '.m3u');
}
}
@@ -711,7 +713,7 @@
return if Slim::Music::Info::isRemoteURL($playlist) || Slim::Player::Playlist::shuffle($client);
- if (Slim::Utils::Prefs::get('playlistdir')) {
+ if ($prefs->get('playlistdir')) {
logger('player.playlist')->info("Calling writeCurTrackForM3U()");
@@ -730,7 +732,7 @@
$log->info("Checking if persistPlaylists is set..");
- if (!$client || !Slim::Utils::Prefs::get('persistPlaylists') ||
+ if (!$client || !$prefs->get('persistPlaylists') ||
exists &Slim::Plugin::RandomPlay::Plugin::active && Slim::Plugin::RandomPlay::Plugin::active($client) ) {
return;
Modified: trunk/server/Slim/Player/Protocols/MMS.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Player/Protocols/MMS.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Player/Protocols/MMS.pm (original)
+++ trunk/server/Slim/Player/Protocols/MMS.pm Mon Apr 16 15:26:59 2007
@@ -20,6 +20,9 @@
use Slim::Utils::Cache;
use Slim::Utils::Log;
use Slim::Utils::Misc;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
use constant DEFAULT_TYPE => 'wma';
@@ -122,7 +125,7 @@
my ($server, $port, $path, $user, $password) = Slim::Utils::Misc::crackURL($url);
# Use full path for proxy servers
- my $proxy = Slim::Utils::Prefs::get('webproxy');
+ my $proxy = $prefs->get('webproxy');
if ( $proxy && $server !~ /(?:localhost|127.0.0.1)/ ) {
$path = "http://$server:$port$path";
}
Modified: trunk/server/Slim/Player/Source.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Player/Source.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Player/Source.pm (original)
+++ trunk/server/Slim/Player/Source.pm Mon Apr 16 15:26:59 2007
@@ -31,11 +31,14 @@
use Slim::Utils::Misc;
use Slim::Utils::Network;
use Slim::Utils::OSDetect;
+use Slim::Utils::Prefs;
my $TRICKSEGMENTDURATION = 1.0;
my $FADEVOLUME = 0.3125;
my $log = logger('player.source');
+
+my $prefs = preferences('server');
use constant STATUS_STREAMING => 0;
use constant STATUS_PLAYING => 1;
@@ -1341,7 +1344,7 @@
# play the next song and start over if necessary
if (Slim::Player::Playlist::shuffle($client) &&
Slim::Player::Playlist::repeat($client) == 2 &&
- Slim::Utils::Prefs::get('reshuffleOnRepeat')) {
+ $prefs->get('reshuffleOnRepeat')) {
Slim::Player::Playlist::reshuffle($client, 1);
}
@@ -1888,7 +1891,7 @@
my $givenChunkSize = shift;
if (!defined($givenChunkSize)) {
- $givenChunkSize = Slim::Utils::Prefs::get('udpChunkSize') * 10;
+ $givenChunkSize = $prefs->get('udpChunkSize') * 10;
}
my $chunksize = $givenChunkSize;
Modified: trunk/server/Slim/Player/Squeezebox.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Player/Squeezebox.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Player/Squeezebox.pm (original)
+++ trunk/server/Slim/Player/Squeezebox.pm Mon Apr 16 15:26:59 2007
@@ -26,6 +26,9 @@
use Slim::Utils::Log;
use Slim::Utils::Misc;
use Slim::Utils::Network;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
# We inherit new() completely from our parent class.
@@ -150,7 +153,7 @@
# If we know the bitrate of the stream, we instead buffer a certain number of seconds of audio
if ( my $bitrate = Slim::Music::Info::getBitrate( $params->{url} ) ) {
- my $bufferSecs = Slim::Utils::Prefs::get('bufferSecs') || 3;
+ my $bufferSecs = $prefs->get('bufferSecs') || 3;
$params->{bufferThreshold} = ( int($bitrate / 8) * $bufferSecs ) / 1000;
# Max threshold is 255
@@ -921,7 +924,7 @@
my ($server, $port, $path, $user, $password) = Slim::Utils::Misc::crackURL($server_url);
# If a proxy server is set, change ip/port
- my $proxy = Slim::Utils::Prefs::get('webproxy');
+ my $proxy = $prefs->get('webproxy');
if ( $proxy ) {
my ($pserver, $pport) = split /:/, $proxy;
$server = $pserver;
@@ -965,7 +968,7 @@
$request_string = sprintf("GET /stream.mp3?player=%s HTTP/1.0\n", $client->id);
- if (Slim::Utils::Prefs::get('authorize')) {
+ if ($prefs->get('authorize')) {
$client->password(generate_random_string(10));
@@ -974,7 +977,7 @@
$request_string .= "Authorization: Basic $password\n";
}
- $server_port = Slim::Utils::Prefs::get('httpport');
+ $server_port = $prefs->get('httpport');
# server IP of 0 means use IP of control server
$server_ip = 0;
@@ -1020,7 +1023,7 @@
$outputThreshold,
0, # reserved
$client->canDoReplayGain($params->{replay_gain}),
- $server_port || Slim::Utils::Prefs::get('httpport'), # use slim server's IP
+ $server_port || $prefs->get('httpport'), # use slim server's IP
$server_ip || 0,
);
Modified: trunk/server/Slim/Player/TranscodingHelper.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Player/TranscodingHelper.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Player/TranscodingHelper.pm (original)
+++ trunk/server/Slim/Player/TranscodingHelper.pm Mon Apr 16 15:26:59 2007
@@ -29,6 +29,8 @@
my $log = logger('player.source');
+my $prefs = preferences('server');
+
sub loadConversionTables {
my @convertFiles = ();
@@ -100,21 +102,19 @@
$log->debug("Checking to see if $profile is enabled");
- my $count = Slim::Utils::Prefs::getArrayMax('disabledformats');
-
- if (!defined($count) || $count < 0) {
+ my @disabled = @{ $prefs->get('disabledformats') };
+
+ if (!@disabled) {
return 1;
}
- $log->debug("There are $count disabled formats...");
-
- for (my $i = $count; $i >= 0; $i--) {
-
- my $disabled = Slim::Utils::Prefs::getInd('disabledformats', $i);
-
- $log->debug("Testing $disabled vs $profile");
-
- if ($disabled eq $profile) {
+ $log->debug("There are " . scalar @disabled . " disabled formats...");
+
+ for my $format (@disabled) {
+
+ $log->debug("Testing $format vs $profile");
+
+ if ($format eq $profile) {
$log->debug("** $profile Disabled **");
Modified: trunk/server/Slim/Plugin/CLI/Plugin.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/CLI/Plugin.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/CLI/Plugin.pm (original)
+++ trunk/server/Slim/Plugin/CLI/Plugin.pm Mon Apr 16 15:26:59 2007
@@ -61,6 +61,7 @@
});
my $prefs = preferences('plugin.cli');
+my $prefsServer = preferences('server');
################################################################################
# PLUGIN CODE
@@ -218,7 +219,7 @@
$log->debug("Begin Function");
# Check max connections
- if (scalar keys %connections > Slim::Utils::Prefs::get("tcpConnectMaximum")) {
+ if (scalar keys %connections > $prefsServer->get('tcpConnectMaximum')) {
$log->warn("Warning: Did not accept connection: too many connections open!");
@@ -233,7 +234,7 @@
# Check allowed hosts
- if (!(Slim::Utils::Prefs::get('filterHosts')) || (Slim::Utils::Network::isAllowedHost($tmpaddr))) {
+ if (!($prefsServer->get('filterHosts')) || (Slim::Utils::Network::isAllowedHost($tmpaddr))) {
Slim::Networking::Select::addRead($client_socket, \&client_socket_read);
Slim::Networking::Select::addError($client_socket, \&client_socket_close);
@@ -242,7 +243,7 @@
$connections{$client_socket}{'id'} = $tmpaddr.':'.$client_socket->peerport;
$connections{$client_socket}{'inbuff'} = '';
$connections{$client_socket}{'outbuff'} = ();
- $connections{$client_socket}{'auth'} = !Slim::Utils::Prefs::get('authorize');
+ $connections{$client_socket}{'auth'} = !$prefsServer->get('authorize');
$connections{$client_socket}{'terminator'} = $LF;
$log->info("Accepted connection from $connections{$client_socket}{'id'} (" . (keys %connections) . " active connections)");
Modified: trunk/server/Slim/Plugin/Favorites/Opml.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/Favorites/Opml.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/Favorites/Opml.pm (original)
+++ trunk/server/Slim/Plugin/Favorites/Opml.pm Mon Apr 16 15:26:59 2007
@@ -11,6 +11,7 @@
use Slim::Utils::Misc;
use Slim::Utils::Strings qw(string);
use Slim::Music::Info;
+use Slim::Utils::Prefs;
use XML::Simple;
use File::Basename;
@@ -19,6 +20,8 @@
use Storable;
my $log = logger('favorites');
+
+my $prefsServer = preferences('server');
my $nullopml = {
'head' => {
@@ -154,9 +157,9 @@
$name = Slim::Utils::Misc::pathFromFileURL($name);
- } elsif ( !Slim::Music::Info::isURL($name) && dirname($name) eq '.' && Slim::Utils::Prefs::get("playlistdir") ) {
-
- $name = catdir(Slim::Utils::Prefs::get("playlistdir"), $name);
+ } elsif ( !Slim::Music::Info::isURL($name) && dirname($name) eq '.' && $prefsServer->get("playlistdir") ) {
+
+ $name = catdir($prefsServer->get("playlistdir"), $name);
}
return $class->{'filename'} = $name;
Modified: trunk/server/Slim/Plugin/Favorites/OpmlFavorites.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/Favorites/OpmlFavorites.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/Favorites/OpmlFavorites.pm (original)
+++ trunk/server/Slim/Plugin/Favorites/OpmlFavorites.pm Mon Apr 16 15:26:59 2007
@@ -13,8 +13,11 @@
use Slim::Utils::Log;
use Slim::Utils::Strings qw(string);
+use Slim::Utils::Prefs;
my $log = logger('favorites');
+
+my $prefsServer = preferences('server');
my $favs; # single instance for all callers
@@ -41,7 +44,7 @@
sub filename {
my $class = shift;
- my $dir = Slim::Utils::Prefs::get('playlistdir') || Slim::Utils::Prefs::get('cachedir');
+ my $dir = $prefsServer->get('playlistdir') || $prefsServer->get('cachedir');
return catdir($dir, "favorites.opml");
}
Modified: trunk/server/Slim/Plugin/Favorites/Playlist.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/Favorites/Playlist.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/Favorites/Playlist.pm (original)
+++ trunk/server/Slim/Plugin/Favorites/Playlist.pm Mon Apr 16 15:26:59 2007
@@ -8,10 +8,13 @@
use File::Spec::Functions qw(:ALL);
use Slim::Utils::Log;
+use Slim::Utils::Prefs;
use strict;
my $log = logger('favorites');
+
+my $prefsServer = preferences('server');
sub read {
my $class = shift;
@@ -23,7 +26,7 @@
} elsif (dirname($name) eq '.') {
- $name = catdir(Slim::Utils::Prefs::get("playlistdir"), $name);
+ $name = catdir($prefsServer->get('playlistdir'), $name);
}
my $type = Slim::Music::Info::contentType($name);
Modified: trunk/server/Slim/Plugin/Rhapsody/ProtocolHandler.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/Rhapsody/ProtocolHandler.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/Rhapsody/ProtocolHandler.pm (original)
+++ trunk/server/Slim/Plugin/Rhapsody/ProtocolHandler.pm Mon Apr 16 15:26:59 2007
@@ -10,10 +10,13 @@
use Slim::Utils::IPDetect;
use Slim::Utils::Log;
use Slim::Utils::Misc;
+use Slim::Utils::Prefs;
my %radioTracks = ();
my $log = logger('plugin.rhapsody');
+
+my $prefsServer = preferences('server');
sub new {
my $class = shift;
@@ -145,7 +148,7 @@
}
# Use full path for proxy servers
- my $proxy = Slim::Utils::Prefs::get('webproxy');
+ my $proxy = $prefsServer->get('webproxy');
if ( $proxy ) {
$path = "http://$host:$port$path";
}
Modified: trunk/server/Slim/Plugin/SavePlaylist/Plugin.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/SavePlaylist/Plugin.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/SavePlaylist/Plugin.pm (original)
+++ trunk/server/Slim/Plugin/SavePlaylist/Plugin.pm Mon Apr 16 15:26:59 2007
@@ -12,6 +12,9 @@
use Slim::Player::Playlist;
use File::Spec::Functions qw(:ALL);
use Slim::Utils::Misc;
+use Slim::Utils::Prefs;
+
+my $prefsServer = preferences('server');
our %context = ();
@@ -50,7 +53,7 @@
$client->lines(\&lines);
- if (!Slim::Utils::Prefs::get('playlistdir')) {
+ if (!$prefsServer->get('playlistdir')) {
# do nothing if there is no playlist folder defined.
} elsif ($push ne 'push') {
@@ -103,10 +106,10 @@
my ($line1, $line2, $arrow);
my $newUrl = Slim::Utils::Misc::fileURLFromPath(
- catfile(Slim::Utils::Prefs::get('playlistdir'), $context{$client} . '.m3u')
+ catfile($prefsServer->get('playlistdir'), $context{$client} . '.m3u')
);
- if (!Slim::Utils::Prefs::get('playlistdir')) {
+ if (!$prefsServer->get('playlistdir')) {
$line1 = $client->string('NO_PLAYLIST_DIR');
$line2 = $client->string('NO_PLAYLIST_DIR_MORE');
Modified: trunk/server/Slim/Plugin/iTunes/Common.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/iTunes/Common.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/iTunes/Common.pm (original)
+++ trunk/server/Slim/Plugin/iTunes/Common.pm Mon Apr 16 15:26:59 2007
@@ -40,6 +40,7 @@
my $log = logger('plugin.itunes');
my $prefs = preferences('plugin.itunes');
+my $prefsServer = preferences('server');
{
my $class = __PACKAGE__;
@@ -197,7 +198,7 @@
$base,
);
- my $audiodir = Slim::Utils::Prefs::get('audiodir');
+ my $audiodir = $prefsServer->get('audiodir');
if (defined $audiodir) {
push @searchdirs, (
Modified: trunk/server/Slim/Plugin/iTunes/Settings.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/iTunes/Settings.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/iTunes/Settings.pm (original)
+++ trunk/server/Slim/Plugin/iTunes/Settings.pm Mon Apr 16 15:26:59 2007
@@ -34,8 +34,8 @@
});
$prefs->setValidate('num', 'scan_interval');
-$prefs->setValidate( sub { !$_[1] || -e $_[1] }, 'xml_file'); # empty or a file
-$prefs->setValidate( sub { !$_[1] || -d $_[1] }, 'music_path'); # empty or a directory
+$prefs->setValidate('file', 'xml_file');
+$prefs->setValidate('dir', 'music_path');
$prefs->setChange(
sub {
Modified: trunk/server/Slim/Schema.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Schema.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Schema.pm (original)
+++ trunk/server/Slim/Schema.pm Mon Apr 16 15:26:59 2007
@@ -48,9 +48,12 @@
use Slim::Utils::Text;
use Slim::Utils::Unicode;
use Slim::Utils::Progress;
+use Slim::Utils::Prefs;
use Slim::Schema::Debug;
my $log = logger('database.info');
+
+my $prefs = preferences('server');
# Singleton objects for Unknowns
our ($_unknownArtist, $_unknownGenre, $_unknownAlbum) = ('', '', '');
@@ -267,9 +270,9 @@
sub sourceInformation {
my $class = shift;
- my $source = sprintf(Slim::Utils::Prefs::get('dbsource'), 'slimserver');
- my $username = Slim::Utils::Prefs::get('dbusername');
- my $password = Slim::Utils::Prefs::get('dbpassword');
+ my $source = sprintf($prefs->get('dbsource'), 'slimserver');
+ my $username = $prefs->get('dbusername');
+ my $password = $prefs->get('dbpassword');
my ($driver) = ($source =~ /^dbi:(\w+):/);
# Bug 3443 - append a socket if needed
@@ -1361,7 +1364,7 @@
# Loop through each pref to see if the user wants to show that contributor role.
for my $role (Slim::Schema::Contributor->contributorRoles) {
- if (Slim::Utils::Prefs::get(sprintf('%sInArtists', lc($role)))) {
+ if ($prefs->get(sprintf('%sInArtists', lc($role)))) {
$roles{$role} = 1;
}
@@ -1927,7 +1930,7 @@
# if we have a disc, provided we're not in the iTunes situation (disc == discc == 1)
my $checkDisc = 0;
- if (!Slim::Utils::Prefs::get('groupdiscs') &&
+ if (!$prefs->get('groupdiscs') &&
(($disc && $discc && $discc > 1) || ($disc && !$discc))) {
$checkDisc = 1;
@@ -2121,7 +2124,7 @@
# Make sure we have a good value for DISCC if grouping
# or if one is supplied
- if (Slim::Utils::Prefs::get('groupdiscs') || $discc) {
+ if ($prefs->get('groupdiscs') || $discc) {
$discc = max(($disc || 0), ($discc || 0), ($albumObj->discc || 0));
Modified: trunk/server/Slim/Schema/Album.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Schema/Album.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Schema/Album.pm (original)
+++ trunk/server/Slim/Schema/Album.pm Mon Apr 16 15:26:59 2007
@@ -6,6 +6,9 @@
use base 'Slim::Schema::DBI';
use Slim::Utils::Log;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
{
my $class = __PACKAGE__;
@@ -79,7 +82,7 @@
return $self->set_column('title', shift) if @_;
- if (Slim::Utils::Prefs::get('groupdiscs')) {
+ if ($prefs->get('groupdiscs')) {
return $self->get_column('title');
}
@@ -101,12 +104,12 @@
$form->{'text'} = $self->title;
$form->{'coverThumb'} = $self->artwork || 0;
- $form->{'size'} = Slim::Utils::Prefs::get('thumbSize');
+ $form->{'size'} = $prefs->get('thumbSize');
$form->{'item'} = $self->title;
# Show the year if pref set or storted by year first
- if (my $showYear = Slim::Utils::Prefs::get('showYear') || ($sort && $sort =~ /^album\.year/)) {
+ if (my $showYear = $prefs->get('showYear') || ($sort && $sort =~ /^album\.year/)) {
$form->{'showYear'} = $showYear;
$form->{'year'} = $self->year;
@@ -115,7 +118,7 @@
# Show the artist in the album view
my $showArtists = ($sort && $sort =~ /^contributor\.namesort/);
- if (Slim::Utils::Prefs::get('showArtist') || $showArtists) {
+ if ($prefs->get('showArtist') || $showArtists) {
# XXX - only show the contributor when there are multiple
# contributors in the album view.
@@ -176,13 +179,13 @@
my @artists = $self->artistsForRoles('ALBUMARTIST');
# If the user wants to use TPE2 as album artist, pull that.
- if (scalar @artists == 0 && Slim::Utils::Prefs::get('useBandAsAlbumArtist')) {
+ if (scalar @artists == 0 && $prefs->get('useBandAsAlbumArtist')) {
@artists = $self->artistsForRoles('BAND');
}
# Nothing there, and we're not a compilation? Get a list of artists.
- if (scalar @artists == 0 && (!Slim::Utils::Prefs::get('variousArtistAutoIdentification') || !$self->compilation)) {
+ if (scalar @artists == 0 && (!$prefs->get('variousArtistAutoIdentification') || !$self->compilation)) {
@artists = $self->artistsForRoles('ARTIST');
}
Modified: trunk/server/Slim/Schema/ResultSet/Age.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Schema/ResultSet/Age.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Schema/ResultSet/Age.pm (original)
+++ trunk/server/Slim/Schema/ResultSet/Age.pm Mon Apr 16 15:26:59 2007
@@ -32,7 +32,7 @@
return $self->search($cond, {
'order_by' => 'tracks.timestamp desc, tracks.disc, tracks.tracknum, tracks.titlesort',
'join' => 'tracks',
- 'limit' => (Slim::Utils::Prefs::get('browseagelimit') - 1),
+ 'limit' => (preferences('server')->get('browseagelimit') - 1),
});
}
Modified: trunk/server/Slim/Schema/ResultSet/Album.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Schema/ResultSet/Album.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Schema/ResultSet/Album.pm (original)
+++ trunk/server/Slim/Schema/ResultSet/Album.pm Mon Apr 16 15:26:59 2007
@@ -131,7 +131,7 @@
};
# Filter by genre if requested.
- if (!Slim::Utils::Prefs::get('noGenreFilter') && defined $find->{'genre.id'}) {
+ if (!preferences('server')->get('noGenreFilter') && defined $find->{'genre.id'}) {
push @{$attr->{'join'}}, 'genreTracks';
$cond->{'genreTracks.genre'} = $find->{'genre.id'};
Modified: trunk/server/Slim/Schema/ResultSet/Contributor.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Schema/ResultSet/Contributor.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Schema/ResultSet/Contributor.pm (original)
+++ trunk/server/Slim/Schema/ResultSet/Contributor.pm Mon Apr 16 15:26:59 2007
@@ -81,7 +81,7 @@
$cond->{'contributorAlbums.role'} = { 'in' => $roles };
}
- if (Slim::Utils::Prefs::get('variousArtistAutoIdentification')) {
+ if (preferences('server')->get('variousArtistAutoIdentification')) {
$cond->{'album.compilation'} = [ { 'is' => undef }, { '=' => 0 } ];
Modified: trunk/server/Slim/Schema/ResultSet/Genre.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Schema/ResultSet/Genre.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Schema/ResultSet/Genre.pm (original)
+++ trunk/server/Slim/Schema/ResultSet/Genre.pm Mon Apr 16 15:26:59 2007
@@ -71,7 +71,7 @@
my $rs = $self->search($cond)->search_related('genreTracks');
# If we are automatically identifiying VA albums, constrain the query.
- if (Slim::Utils::Prefs::get('variousArtistAutoIdentification')) {
+ if (preferences('server')->get('variousArtistAutoIdentification')) {
$rs = $rs->search_related('track', {
'album.compilation' => [ { 'is' => undef }, { '=' => 0 } ]
Modified: trunk/server/Slim/Schema/ResultSet/Playlist.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Schema/ResultSet/Playlist.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Schema/ResultSet/Playlist.pm (original)
+++ trunk/server/Slim/Schema/ResultSet/Playlist.pm Mon Apr 16 15:26:59 2007
@@ -91,9 +91,11 @@
# Don't search for playlists if the plugin isn't enabled.
if ($type eq 'all' || $type eq 'external') {
+ my $prefs = preferences('server');
+
for my $importer (qw(itunes musicmagic)) {
- if (Slim::Utils::Prefs::get($importer)) {
+ if ($prefs->get($importer)) {
push @playlists, $Slim::Music::Info::suffixes{sprintf('%splaylist:', $importer)};
}
Modified: trunk/server/Slim/Schema/Storage.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Schema/Storage.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Schema/Storage.pm (original)
+++ trunk/server/Slim/Schema/Storage.pm Mon Apr 16 15:26:59 2007
@@ -29,7 +29,7 @@
# Try and bring up the database if we can't connect.
if ($@ && $@ =~ /Connection failed/) {
- my $lockFile = File::Spec->catdir(Slim::Utils::Prefs::get('cachedir'), 'mysql.startup');
+ my $lockFile = File::Spec->catdir(preferences('server')->get('cachedir'), 'mysql.startup');
if (!-f $lockFile) {
Modified: trunk/server/Slim/Schema/Track.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Schema/Track.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Schema/Track.pm (original)
+++ trunk/server/Slim/Schema/Track.pm Mon Apr 16 15:26:59 2007
@@ -12,6 +12,9 @@
use Slim::Utils::DateTime;
use Slim::Utils::Log;
use Slim::Utils::Misc;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
our @allColumns = (qw(
id url content_type title titlesort titlesearch album tracknum
@@ -369,7 +372,7 @@
sub displayAsHTML {
my ($self, $form, $descend, $sort) = @_;
- my $format = Slim::Utils::Prefs::getInd("titleFormat", Slim::Utils::Prefs::get("titleFormatWeb"));
+ my $format = $prefs->get('titleFormat')->[ $prefs->get('titleFormatWeb') ];
# Go directly to infoFormat, as standardTitle is more client oriented.
$form->{'text'} = Slim::Music::TitleFormatter::infoFormat($self, $format, 'TITLE');
Modified: trunk/server/Slim/Utils/Cache.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Cache.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Cache.pm (original)
+++ trunk/server/Slim/Utils/Cache.pm Mon Apr 16 15:26:59 2007
@@ -120,7 +120,7 @@
my $cache = Cache::FileCache->new( {
namespace => $namespace,
default_expires_in => $DEFAULT_EXPIRES_TIME,
- cache_root => Slim::Utils::Prefs::get('cachedir'),
+ cache_root => preferences('server')->get('cachedir'),
directory_umask => umask(),
} );
Modified: trunk/server/Slim/Utils/DateTime.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/DateTime.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/DateTime.pm (original)
+++ trunk/server/Slim/Utils/DateTime.pm Mon Apr 16 15:26:59 2007
@@ -13,6 +13,8 @@
use Slim::Utils::Prefs;
use Slim::Utils::Unicode;
+my $prefs = preferences('server');
+
=head1 NAME
Slim::Utils::DateTime
@@ -48,7 +50,7 @@
sub longDateF {
my $time = shift || time();
- my $format = shift || Slim::Utils::Prefs::get('longdateFormat');
+ my $format = shift || $prefs->get('longdateFormat');
my $date = strftime($format, localtime($time));
$date =~ s/\|0*//;
@@ -67,7 +69,7 @@
sub shortDateF {
my $time = shift || time();
- my $format = shift || Slim::Utils::Prefs::get('shortdateFormat');
+ my $format = shift || $prefs->get('shortdateFormat');
my $date = strftime($format, localtime($time));
$date =~ s/\|0*//;
@@ -86,7 +88,7 @@
sub timeF {
my $ltime = shift || time();
- my $format = shift || Slim::Utils::Prefs::get('timeFormat');
+ my $format = shift || $prefs->get('timeFormat');
# remove leading zero if another digit follows
my $time = strftime($format, localtime($ltime));
@@ -182,7 +184,7 @@
my $m = int(($time - $h * 60 * 60) / 60);
my $p = undef;
- if (Slim::Utils::Prefs::get('timeFormat') =~ /%p/) {
+ if ($prefs->get('timeFormat') =~ /%p/) {
$p = 'AM';
if ($h > 11) { $h -= 12; $p = 'PM'; }
Modified: trunk/server/Slim/Utils/Misc.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Misc.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Misc.pm (original)
+++ trunk/server/Slim/Utils/Misc.pm Mon Apr 16 15:26:59 2007
@@ -56,6 +56,9 @@
require Slim::Utils::Unicode;
use Slim::Utils::Log;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
{
if ($^O =~ /Win32/) {
@@ -625,8 +628,8 @@
# the only kind of absolute file we like is one in
# the music directory or the playlist directory...
- my $audiodir = Slim::Utils::Prefs::get("audiodir");
- my $savedplaylistdir = Slim::Utils::Prefs::get("playlistdir");
+ my $audiodir = $prefs->get('audiodir');
+ my $savedplaylistdir = $prefs->get('playlistdir');
if ($audiodir && $file =~ /^\Q$audiodir\E/) {
@@ -770,7 +773,7 @@
$path = fixPath($path) || return 0;
$path = pathFromFileURL($path) || return 0;
- my $checkdir = Slim::Utils::Prefs::get($pref);
+ my $checkdir = $prefs->get($pref);
if ($checkdir && $path =~ /^\Q$checkdir\E/) {
return 1;
@@ -821,7 +824,7 @@
my @diritems = ();
my $log = logger('os.files');
- my $ignore = Slim::Utils::Prefs::get('ignoreDirRE') || '';
+ my $ignore = $prefs->get('ignoreDirRE') || '';
opendir(DIR, $dirname) || do {
@@ -891,7 +894,7 @@
sub findAndScanDirectoryTree {
my $levels = shift;
- my $urlOrObj = shift || Slim::Utils::Misc::fileURLFromPath(Slim::Utils::Prefs::get('audiodir'));
+ my $urlOrObj = shift || Slim::Utils::Misc::fileURLFromPath($prefs->get('audiodir'));
# Find the db entry that corresponds to the requested directory.
# If we don't have one - that means we're starting out from the root audiodir.
@@ -956,7 +959,7 @@
# Bug: 3841 - check for new artwork
# But don't search at the root level.
- if ($path ne Slim::Utils::Prefs::get('audiodir')) {
+ if ($path ne $prefs->get('audiodir')) {
Slim::Music::Artwork->findArtwork($topLevelObj);
}
@@ -989,7 +992,7 @@
$osDetails->{'os'},
$osDetails->{'osName'},
($osDetails->{'osArch'} || 'Unknown'),
- Slim::Utils::Prefs::get('language'),
+ $prefs->get('language'),
Slim::Utils::Unicode::currentLocale(),
);
@@ -1016,7 +1019,7 @@
$::VERSION,
$::REVISION,
$osDetails->{'osName'},
- Slim::Utils::Prefs::get('language'),
+ $prefs->get('language'),
Slim::Utils::Unicode::currentLocale(),
);
Modified: trunk/server/Slim/Utils/MySQLHelper.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/MySQLHelper.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/MySQLHelper.pm (original)
+++ trunk/server/Slim/Utils/MySQLHelper.pm Mon Apr 16 15:26:59 2007
@@ -34,6 +34,7 @@
use Slim::Utils::OSDetect;
use Slim::Utils::Prefs;
use Slim::Utils::SQLHelper;
+use Slim::Utils::Prefs;
{
my $class = __PACKAGE__;
@@ -45,6 +46,9 @@
}
my $log = logger('database.mysql');
+
+my $prefs = preferences('server');
+
my $OS = Slim::Utils::OSDetect::OS();
my $serviceName = 'SlimServerMySQL';
@@ -60,7 +64,7 @@
# Check to see if our private port is being used. If not, we'll assume
# the user has setup their own copy of MySQL.
- if (Slim::Utils::Prefs::get('dbsource') !~ /port=9092/) {
+ if ($prefs->get('dbsource') !~ /port=9092/) {
$log->info("Not starting MySQL - looks to be user configured.");
@@ -92,7 +96,7 @@
}
}
- my $cacheDir = Slim::Utils::Prefs::get('cachedir');
+ my $cacheDir = $prefs->get('cachedir');
$class->socketFile( catdir($cacheDir, 'slimserver-mysql.sock') ),
$class->pidFile( catdir($cacheDir, 'slimserver-mysql.pid') );
@@ -463,7 +467,7 @@
if ($OS eq 'win') {
- $dsn = Slim::Utils::Prefs::get('dbsource');
+ $dsn = $prefs->get('dbsource');
$dsn =~ s/;database=.+;?//;
} else {
@@ -488,7 +492,7 @@
my $class = shift;
my $dbh = shift;
- my $source = Slim::Utils::Prefs::get('dbsource');
+ my $source = $prefs->get('dbsource');
# Set a reasonable default. :)
my $dbname = 'slimserver';
Modified: trunk/server/Slim/Utils/Network.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Network.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Network.pm (original)
+++ trunk/server/Slim/Utils/Network.pm Mon Apr 16 15:26:59 2007
@@ -69,7 +69,7 @@
sub isAllowedHost {
my $host = shift;
- my $allowedHosts = shift || Slim::Utils::Prefs::get('allowedHosts');
+ my $allowedHosts = shift || preferences('server')->get('allowedHosts');
my @rules = split /\,/, $allowedHosts;
foreach my $item (@rules) {
Modified: trunk/server/Slim/Utils/PluginManager.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/PluginManager.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/PluginManager.pm (original)
+++ trunk/server/Slim/Utils/PluginManager.pm Mon Apr 16 15:26:59 2007
@@ -98,7 +98,7 @@
sub pluginCacheFile {
my $class = shift;
- return catdir( Slim::Utils::Prefs::get('cachedir'), 'plugin-data.yaml' );
+ return catdir( preferences('server')->get('cachedir'), 'plugin-data.yaml' );
}
sub writePluginCache {
Modified: trunk/server/Slim/Utils/Prefs.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Prefs.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Prefs.pm (original)
+++ trunk/server/Slim/Utils/Prefs.pm Mon Apr 16 15:26:59 2007
@@ -17,8 +17,8 @@
use YAML::Syck qw(DumpFile LoadFile Dump);
use Slim::Utils::Log;
-use Slim::Utils::Misc;
-use Slim::Utils::Network;
+#use Slim::Utils::Misc;
+#use Slim::Utils::Network;
use Slim::Utils::Unicode;
our %prefs = ();
@@ -159,7 +159,7 @@
"username" => '',
"password" => '',
"filterHosts" => 0, # No filtering by default
- "allowedHosts" => join(',', Slim::Utils::Network::hostAddr()),
+# "allowedHosts" => join(',', Slim::Utils::Network::hostAddr()),
"tcpReadMaximum" => 20,
"tcpWriteMaximum" => 20,
"tcpConnectMaximum" => 30,
@@ -481,7 +481,7 @@
sub homeURL {
my $host = $main::httpaddr || Slim::Utils::Network::hostname() || '127.0.0.1';
- my $port = Slim::Utils::Prefs::get('httpport');
+ my $port = preferences('server')->get('httpport');
return "http://$host:$port/";
}
@@ -1337,28 +1337,186 @@
}
sub init_new {
+ my %defaults = (
+ # Server Prefs not settable from web pages
+ 'dbsource' => $DEFAULT_DBSOURCE,
+ 'dbusername' => 'slimserver',
+ 'dbpassword' => '',
+ 'cachedir' => \&defaultCacheDir,
+ 'securitySecret' => \&makeSecuritySecret,
+ 'ignoreDirRE' => '',
+ 'rank-PLUGIN_PICKS_MODULE_NAME' => 4,
+ # Server Settings - Basic
+ 'language' => 'EN',
+ 'audiodir' => \&defaultAudioDir,
+ 'playlistdir' => \&defaultPlaylistDir,
+ # Server Settings - Behaviour
+ 'displaytexttimeout' => 1,
+ 'checkVersion' => 1,
+ 'checkVersionInterval' => 60*60*24,
+ 'noGenreFilter' => 0,
+ 'playtrackalbum' => 1,
+ 'searchSubString' => 0,
+ 'ignoredarticles' => "The El La Los Las Le Les",
+ 'splitList' => '',
+ 'browseagelimit' => 100,
+ 'groupdiscs' => 0,
+ 'persistPlaylists' => 1,
+ 'reshuffleOnRepeat' => 0,
+ 'saveShuffled' => 0,
+ 'composerInArtists' => 0,
+ 'conductorInArtists' => 0,
+ 'bandInArtists' => 0,
+ 'variousArtistAutoIdentification' => 0,
+ 'useBandAsAlbumArtist' => 0,
+ 'variousArtistsString' => undef,
+ # Server Settings - FileTypes
+ 'disabledextensionsaudio' => '',
+ 'disabledextensionsplaylist' => '',
+ 'disabledformats' => [],
+ # Server Settings - Networking
+ 'webproxy' => '',
+ 'httpport' => 9000,
+ 'bufferSecs' => 3,
+ 'remotestreamtimeout' => 5,
+ 'maxWMArate' => 9999,
+ 'tcpConnectMaximum' => 30, # not on web page
+ 'udpChunkSize' => 1400, # only used for Slimp3
+ 'mDNSname' => 'SlimServer',
+ # Server Settings - Performance
+ 'disableStatistics' => 0,
+ 'serverPriority' => '',
+ 'scannerPriority' => 0,
+ # Server Settings - Security
+ 'filterHosts' => 0,
+ 'allowedHosts' => sub { join(',', Slim::Utils::Network::hostAddr()) },
+ 'csrfProtectionLevel' => 1,
+ 'authorize' => 0,
+ 'username' => '',
+ 'password' => '',
+ # Server Settings - TextFormatting
+ 'longdateFormat' => q(%A, %B |%d, %Y),
+ 'shortdateFormat' => q(%m/%d/%Y),
+ 'timeFormat' => q(|%I:%M:%S %p),
+ 'showArtist' => 0,
+ 'showYear' => 0,
+ 'guessFileFormats' => [
+ '(ARTIST - ALBUM) TRACKNUM - TITLE',
+ '/ARTIST/ALBUM/TRACKNUM - TITLE',
+ '/ARTIST/ALBUM/TRACKNUM TITLE',
+ '/ARTIST/ALBUM/TRACKNUM. TITLE'
+ ],
+ 'titleFormat' => [
+ 'TITLE',
+ 'DISC-TRACKNUM. TITLE',
+ 'TRACKNUM. TITLE',
+ 'TRACKNUM. ARTIST - TITLE',
+ 'TRACKNUM. TITLE (ARTIST)',
+ 'TRACKNUM. TITLE - ARTIST - ALBUM',
+ 'FILE.EXT',
+ 'TRACKNUM. TITLE from ALBUM by ARTIST',
+ 'TITLE (ARTIST)',
+ 'ARTIST - TITLE'
+ ],
+ 'titleFormatWeb' => 1,
+ # Server Settings - UserInterface
+ 'skin' => 'Default',
+ 'itemsPerPage' => 50,
+ 'refreshRate' => 30,
+ 'coverArt' => '',
+ 'artfolder' => '',
+ 'thumbSize' => 100,
+ );
+
+ # migrate old prefs across
$prefs->migrate(1, sub {
- unless (-d $path) {
- mkdir $path;
- }
-
- unless (-d $path) {
- logError("can't create new preferences directory at $path");
- }
-
- 0;
+ unless (-d $path) { mkdir $path; }
+ unless (-d $path) { logError("can't create new preferences directory at $path"); }
+
+ for my $pref (keys %defaults) {
+ my $old = Slim::Utils::Prefs::OldPrefs->get($pref);
+ $prefs->set($pref, $old) if !$prefs->exists($pref) && defined $old;
+ }
+
+ 0; # FIXME - set this to 1 once migration complete!
});
unless (-d $path && -w $path) {
logError("unable to write to preferences directory $path");
}
-}
+
+ # initialise any new prefs
+ $prefs->init(\%defaults);
+
+ # set validation functions
+ $prefs->setValidate( 'num', qw(displaytexttimeout browseagelimit remotestreamtimeout) );
+ $prefs->setValidate( 'dir', qw(cachedir playlistdir audiodir artfolder) );
+ $prefs->setValidate( 'array', qw(guessFileFormats titleFormat disabledformats) );
+
+ $prefs->setValidate({ 'validator' => 'intlimit', 'low' => 1024, 'high' => 65535 }, 'httpport' );
+ $prefs->setValidate({ 'validator' => 'intlimit', 'low' => 3, 'high' => 30 }, 'bufferSecs' );
+ $prefs->setValidate({ 'validator' => 'intlimit', 'low' => 1, 'high' => 4096 }, 'udpChunkSize');
+ $prefs->setValidate({ 'validator' => 'intlimit', 'low' => 1, }, 'itemsPerPage');
+ $prefs->setValidate({ 'validator' => 'intlimit', 'low' => 2, }, 'refreshRate' );
+ $prefs->setValidate({ 'validator' => 'intlimit', 'low' => 25, 'high' => 250 }, 'thumbSize' );
+
+ # set on change functions
+ $prefs->setChange( \&Slim::Web::HTTP::adjustHTTPPort, 'httpport' );
+ $prefs->setChange( sub { Slim::Utils::Strings::setLanguage($_[1]) }, 'language' );
+ $prefs->setChange( \&main::checkVersion, 'checkVersion');
+
+ $prefs->setChange( sub { Slim::Control::Request::executeRequest(undef, ['wipecache']) }, qw(splitList groupdiscs) );
+
+ $prefs->setChange( sub {
+ Slim::Utils::Text::clearCaseArticleCache();
+ Slim::Control::Request::executeRequest(undef, ['wipecache'])
+ }, 'ignoredarticles');
+
+ $prefs->setChange( sub {
+ Slim::Buttons::BrowseTree->init;
+ Slim::Music::MusicFolderScan->init;
+ Slim::Control::Request::executeRequest(undef, ['wipecache']);
+ }, 'audiodir');
+
+ $prefs->setChange( sub {
+ Slim::Music::PlaylistFolderScan->init;
+ Slim::Control::Request::executeRequest(undef, ['rescan', 'playlists']);
+ for my $client (Slim::Player::Client::clients()) {
+ Slim::Buttons::Home::updateMenu($client);
+ }
+ }, 'playlistdir');
+
+ $prefs->setChange( sub {
+ if ($_[1]) {
+ Slim::Control::Request::subscribe(\&Slim::Player::Playlist::modifyPlaylistCallback, [['playlist']]);
+ for my $client (Slim::Player::Client::clients()) {
+ next if Slim::Player::Sync::isSlave($client);
+ my $request = Slim::Control::Request->new($client, ['playlist','load_done']);
+ Slim::Player::Playlist::modifyPlaylistCallback($request);
+ }
+ } else {
+ Slim::Control::Request::unsubscribe(\&Slim::Player::Playlist::modifyPlaylistCallback);
+ }
+ }, 'persistPlaylists');
+}
+
+=head2 writeAll( )
+
+Write all pending preference changes to disk.
+
+=cut
sub writeAll {
for my $n (values %namespaces) {
$n->savenow;
}
}
+
+=head2 dir( )
+
+Returns path to preference files.
+
+=cut
sub dir {
return $path;
Modified: trunk/server/Slim/Utils/Prefs/Namespace.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Prefs/Namespace.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Prefs/Namespace.pm (original)
+++ trunk/server/Slim/Utils/Prefs/Namespace.pm Mon Apr 16 15:26:59 2007
@@ -31,19 +31,23 @@
my $log = logger('prefs');
-# Simple validator functions which may be references by name in setValidate calls
+# Simple validator functions which may be referenced by name in setValidate calls
my $simpleValidators = {
# $_[0] = pref, $_[1] = value, $_[2] = params hash, $_[3] = old value, $_[4] = object (client) if appropriate
'int' => sub { $_[1] =~ /^-?\d+$/ },
'num' => sub { $_[1] =~ /^-?\.?\d+\.?\d*$/ },
- 'intlimit' => sub { $_[1] =~ /^-?\d+$/ && $_[1] >= $_[2]->{'low'} && $_[1] <= $_[2]->{'high'} },
- 'numlimit' => sub { $_[1] =~ /^-?\.?\d+\.?\d*$/ && $_[1] >= $_[2]->{'low'} && $_[1] <= $_[2]->{'high'} },
'array' => sub { ref $_[1] eq 'ARRAY' },
'hash' => sub { ref $_[1] eq 'HASH' },
'defined' => sub { defined $_[1] },
'false' => sub { 0 },
- 'file' => sub { -e $_[1] },
- 'dir' => sub { -d $_[1] },
+ 'file' => sub { !$_[1] || -e $_[1] },
+ 'dir' => sub { !$_[1] || -d $_[1] },
+ 'intlimit' => sub { $_[1] =~ /^-?\d+$/ &&
+ (!defined $_[2]->{'low'} || $_[1] >= $_[2]->{'low'} ) &&
+ (!defined $_[2]->{'high'} || $_[1] <= $_[2]->{'high'}) },
+ 'numlimit' => sub { $_[1] =~ /^-?\.?\d+\.?\d*$/ &&
+ (!defined $_[2]->{'low'} || $_[1] >= $_[2]->{'low'} ) &&
+ (!defined $_[2]->{'high'} || $_[1] <= $_[2]->{'high'}) },
};
sub new {
@@ -90,7 +94,7 @@
or a hash containing the key 'validator' which specifies either 'intlimit' or 'numlimit' of a callback function.
In the case of a hash the hash is stored and passed to the validator function to provide parameters to the validation function.
-The built in 'intlimit' and 'num' limit require 'low' and 'high' parameters:
+The built in 'intlimit' and 'numlimit' use 'low' and/or 'high' parameters to perform range validation.
e.g. $prefs->setValidate({ 'validator' => 'intlimit', 'low' => 1 'high' => 10 }, 'pref1');
Modified: trunk/server/Slim/Utils/Prefs/OldPrefs.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Prefs/OldPrefs.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Prefs/OldPrefs.pm (original)
+++ trunk/server/Slim/Utils/Prefs/OldPrefs.pm Mon Apr 16 15:26:59 2007
@@ -66,7 +66,7 @@
$oldPrefs = catdir($Bin, 'slimserver.pref');
- } elsif (-r $::prefsfile) {
+ } elsif ($::prefsfile && -r $::prefsfile) {
$oldPrefs = $::prefsfile;
Modified: trunk/server/Slim/Utils/Scanner.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Scanner.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Scanner.pm (original)
+++ trunk/server/Slim/Utils/Scanner.pm Mon Apr 16 15:26:59 2007
@@ -48,6 +48,7 @@
use Slim::Utils::Misc;
use Slim::Utils::Progress;
use Slim::Utils::Strings;
+use Slim::Utils::Prefs;
my $log = logger('scan.scanner');
@@ -1083,7 +1084,7 @@
# Look through all available streams and select the one with the highest bitrate still below
# the user's preferred max bitrate
- my $max = Slim::Utils::Prefs::get('maxWMArate') || 9999;
+ my $max = preferences('server')->get('maxWMArate') || 9999;
my $bitrate = 0;
for my $stream ( @{ $wma->stream } ) {
Modified: trunk/server/Slim/Utils/Strings.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Strings.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Strings.pm (original)
+++ trunk/server/Slim/Utils/Strings.pm Mon Apr 16 15:26:59 2007
@@ -45,6 +45,7 @@
use Storable;
use Slim::Utils::Log;
+use Slim::Utils::Prefs;
our $strings = {};
our $defaultStrings;
@@ -53,6 +54,8 @@
my $failsafeLang = 'EN';
my $log = logger('server');
+
+my $prefs = preferences('server');
=head1 METHODS
@@ -91,7 +94,7 @@
my ($newest, $files) = stringsFiles();
- my $stringCache = catdir( Slim::Utils::Prefs::get('cachedir'),
+ my $stringCache = catdir( $prefs->get('cachedir'),
Slim::Utils::OSDetect::OS() eq 'unix' ? 'stringcache' : 'strings.bin');
my $stringCacheVersion = 1; # Version number for cache file
@@ -402,7 +405,7 @@
}
sub getLanguage {
- return Slim::Utils::Prefs::get('language') || $failsafeLang;
+ return $prefs->get('language') || $failsafeLang;
}
sub setLanguage {
@@ -410,7 +413,7 @@
if ($strings->{'langchoices'}->{$lang}) {
- Slim::Utils::Prefs::set('language', $lang);
+ $prefs->set('language', $lang);
$currentLang = $lang;
loadStrings({'ignoreCache' => 1});
@@ -447,7 +450,7 @@
sub storeFailsafe {
return ($currentLang ne $failsafeLang &&
- (Slim::Utils::Prefs::get('loadFontsSqueezeboxG') || Slim::Utils::Prefs::get('loadFontsText') ) &&
+ ($prefs->get('loadFontsSqueezeboxG') || $prefs->get('loadFontsText') ) &&
$currentLang !~ /CS|DE|DA|EN|ES|FI|FR|IT|NL|NO|PT|SV/ ) ? 1 : 0;
}
Modified: trunk/server/Slim/Utils/Text.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Text.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Text.pm (original)
+++ trunk/server/Slim/Utils/Text.pm Mon Apr 16 15:26:59 2007
@@ -9,6 +9,10 @@
use strict;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
+
our %caseArticlesCache = ();
# Article list to ignore.
@@ -90,7 +94,7 @@
if (!defined($ignoredArticles)) {
- $ignoredArticles = Slim::Utils::Prefs::get("ignoredarticles");
+ $ignoredArticles = $prefs->get('ignoredarticles');
# allow a space seperated list in preferences (easier for humans to deal with)
$ignoredArticles =~ s/\s+/|/g;
@@ -167,7 +171,7 @@
my $search = shift;
my $searchSubString = shift;
- $searchSubString = defined $searchSubString ? $searchSubString : Slim::Utils::Prefs::get('searchSubString');
+ $searchSubString = defined $searchSubString ? $searchSubString : $prefs->get('searchSubString');
# normalize the string
$search = Slim::Utils::Unicode::utf8decode_locale($search);
Modified: trunk/server/Slim/Utils/Validate.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Validate.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Validate.pm (original)
+++ trunk/server/Slim/Utils/Validate.pm Mon Apr 16 15:26:59 2007
@@ -28,6 +28,7 @@
use Slim::Utils::Log;
use Slim::Utils::Network;
+use Slim::Utils::Prefs;
######################################################################
# Validation Functions
@@ -401,7 +402,7 @@
sub password {
my $val = shift;
- my $currentPassword = Slim::Utils::Prefs::get('password');
+ my $currentPassword = preferences('server')->get('password');
if (defined($val) && $val ne '' && $val ne $currentPassword) {
srand (time());
Modified: trunk/server/Slim/Web/Graphics.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Graphics.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Web/Graphics.pm (original)
+++ trunk/server/Slim/Web/Graphics.pm Mon Apr 16 15:26:59 2007
@@ -7,6 +7,7 @@
use Slim::Utils::Log;
use Slim::Utils::Misc;
use Slim::Utils::Cache;
+use Slim::Utils::Prefs;
my %typeToMethod = (
'image/gif' => 'newFromGifData',
@@ -188,13 +189,15 @@
$returnedWidth = $requestedWidth;
$returnedHeight = $requestedHeight;
+ my $prefs = preferences('server');
+
# don't cache if width or height not set so pref can be changed
unless (defined($returnedWidth)) {
- $returnedWidth = Slim::Utils::Prefs::get('thumbSize') || 100;
+ $returnedWidth = $prefs->get('thumbSize') || 100;
$cacheKey = undef;
}
unless (defined($returnedHeight)) {
- $returnedHeight = Slim::Utils::Prefs::get('thumbSize') || 100;
+ $returnedHeight = $prefs->get('thumbSize') || 100;
$cacheKey = undef;
}
Modified: trunk/server/Slim/Web/HTTP.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/HTTP.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Web/HTTP.pm (original)
+++ trunk/server/Slim/Web/HTTP.pm Mon Apr 16 15:26:59 2007
@@ -43,6 +43,7 @@
use Slim::Utils::Unicode;
use Slim::Web::Pages;
use Slim::Web::Graphics;
+use Slim::Utils::Prefs;
BEGIN {
@@ -120,6 +121,8 @@
my $log = logger('network.http');
+my $prefs = preferences('server');
+
# initialize the http server
sub init {
@@ -150,8 +153,8 @@
sub init2 {
# open HTTP port if specified
# split into second init function so this can be performed after all server init is complete
- if (Slim::Utils::Prefs::get('httpport')) {
- Slim::Web::HTTP::openport(Slim::Utils::Prefs::get('httpport'), $::httpaddr);
+ if ($prefs->get('httpport')) {
+ Slim::Web::HTTP::openport($prefs->get('httpport'), $::httpaddr);
} else {
$openedport = 0; # init complete but no port opened
}
@@ -209,18 +212,14 @@
}
# open new port if specified
- if (Slim::Utils::Prefs::get('httpport')) {
-
- Slim::Web::HTTP::openport(Slim::Utils::Prefs::get('httpport'), $::httpaddr);
+ if ($prefs->get('httpport')) {
+
+ Slim::Web::HTTP::openport($prefs->get('httpport'), $::httpaddr);
# Need to restart mDNS after changing the HTTP port.
Slim::Networking::mDNS->startAdvertising;
}
}
-
-# TODO: Turn this back on
-# my $tcpReadMaximum = Slim::Utils::Prefs::get("tcpReadMaximum");
-# my $streamWriteMaximum = Slim::Utils::Prefs::get("tcpWriteMaximum");
sub connectedSocket {
return $connected;
@@ -245,7 +244,7 @@
$peer = inet_ntoa($peer);
# Check if source address is valid
- if (!(Slim::Utils::Prefs::get('filterHosts')) ||
+ if (!($prefs->get('filterHosts')) ||
(Slim::Utils::Network::isAllowedHost($peer))) {
# this is the timeout for the client connection.
@@ -399,7 +398,7 @@
if ($request->method() eq 'GET' || $request->method() eq 'HEAD' || $request->method() eq 'POST') {
# Manage authorization
- my $authorized = !Slim::Utils::Prefs::get('authorize');
+ my $authorized = !$prefs->get('authorize');
if (my ($user, $pass) = $request->authorization_basic()) {
$authorized = checkAuthorization($user, $pass);
@@ -960,7 +959,7 @@
# execute that, and hand it a callback to send the data.
# fork for certain read-only operations i.e. browsedb
- if ( $forkFunctions{$path} && $^O !~ /Win32/ && Slim::Utils::Prefs::get('forkedWeb') ) {
+ if ( $forkFunctions{$path} && $^O !~ /Win32/ && $prefs->get('forkedWeb') ) {
if ( my $pid = fork ) {
@@ -1024,7 +1023,7 @@
$metaDataBytes{$httpClient} = - length($headers);
# fork for streaming
- if ( $^O !~ /Win32/ && Slim::Utils::Prefs::get('forkedStreaming') ) {
+ if ( $^O !~ /Win32/ && $prefs->get('forkedStreaming') ) {
# This doesn't support synced players at the moment
if ( !Slim::Player::Sync::isSynced($client) ) {
@@ -1094,7 +1093,7 @@
if ($songHandle) {
# fork for sending large file downloads
- if ( $^O !~ /Win32/ && Slim::Utils::Prefs::get('forkedWeb') ) {
+ if ( $^O !~ /Win32/ && $prefs->get('forkedWeb') ) {
if ( my $pid = fork ) {
@@ -2262,7 +2261,7 @@
sub templateCacheDir {
- return catdir( Slim::Utils::Prefs::get('cachedir'), 'templates' );
+ return catdir( $prefs->get('cachedir'), 'templates' );
}
sub initSkinTemplateCache {
@@ -2292,7 +2291,7 @@
sub _generateContentFromFile {
my ($type, $path, $params) = @_;
- my $skin = $params->{'skinOverride'} || Slim::Utils::Prefs::get('skin');
+ my $skin = $params->{'skinOverride'} || $prefs->get('skin');
# Default2 is gone, so redirect to Default.
if ($skin =~ /^(?:Default2)$/i) {
@@ -2407,7 +2406,7 @@
my $template = $skinTemplates{$skin} || return undef;
my $skindirs = $template->context()->{'CONFIG'}->{'INCLUDE_PATH'};
- my $lang = lc(Slim::Utils::Prefs::get('language'));
+ my $lang = lc($prefs->get('language'));
for my $dir (@{$skindirs}) {
@@ -2608,15 +2607,15 @@
my $ok = 0;
# No authorization needed
- if (!Slim::Utils::Prefs::get('authorize')) {
+ if (!$prefs->get('authorize')) {
$ok = 1;
return $ok;
}
- if ($username eq Slim::Utils::Prefs::get('username')) {
-
- my $pwd = Slim::Utils::Prefs::get('password');
+ if ($username eq $prefs->get('username')) {
+
+ my $pwd = $prefs->get('password');
if ($pwd eq $password && $pwd eq '') {
@@ -2691,7 +2690,7 @@
sub isCsrfAuthCodeValid {
my $req = shift;
- my $csrfProtectionLevel = Slim::Utils::Prefs::get("csrfProtectionLevel");
+ my $csrfProtectionLevel = $prefs->get('csrfProtectionLevel');
if (! defined($csrfProtectionLevel) ) {
@@ -2711,7 +2710,7 @@
return 0;
}
- my $secret = Slim::Utils::Prefs::get("securitySecret");
+ my $secret = $prefs->get('securitySecret');
if ( (!defined($secret)) || ($secret !~ m|^[0-9a-f]{32}$|) ) {
@@ -2802,7 +2801,7 @@
sub makeAuthorizedURI {
my $uri = shift;
- my $secret = Slim::Utils::Prefs::get("securitySecret");
+ my $secret = $prefs->get('securitySecret');
if ( (!defined($secret)) || ($secret !~ m|^[0-9a-f]{32}$|) ) {
@@ -2812,7 +2811,7 @@
return undef;
}
- my $csrfProtectionLevel = Slim::Utils::Prefs::get("csrfProtectionLevel");
+ my $csrfProtectionLevel = $prefs->get('csrfProtectionLevel');
if (! defined($csrfProtectionLevel) ) {
@@ -2853,7 +2852,7 @@
$msg .= string('CSRF_ERROR_INFO');
$msg .= "<br>\n<br>\n<A HREF=\"${authURI}\">${authURL}</A></p>";
- my $csrfProtectionLevel = Slim::Utils::Prefs::get("csrfProtectionLevel");
+ my $csrfProtectionLevel = $prefs->get('csrfProtectionLevel');
if ( defined($csrfProtectionLevel) && $csrfProtectionLevel == 1 ) {
$msg .= string('CSRF_ERROR_MEDIUM');
Modified: trunk/server/Slim/Web/Pages.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Pages.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Web/Pages.pm (original)
+++ trunk/server/Slim/Web/Pages.pm Mon Apr 16 15:26:59 2007
@@ -16,6 +16,7 @@
use Slim::Utils::Log;
use Slim::Utils::Misc;
use Slim::Utils::Strings qw(string);
+use Slim::Utils::Prefs;
use Slim::Web::Pages::Search;
use Slim::Web::Pages::BrowseDB;
@@ -28,6 +29,8 @@
use Slim::Web::Pages::Progress;
use Slim::Utils::Progress;
+my $prefs = preferences('server');
+
our %additionalLinks = ();
our %hierarchy = (
@@ -133,7 +136,7 @@
return;
}
- if (Slim::Utils::Prefs::get('disableStatistics')) {
+ if ($prefs->get('disableStatistics')) {
$params->{'song_count'} = 0;
$params->{'album_count'} = 0;
@@ -333,7 +336,7 @@
my $startRef = $args->{'startRef'};
my $headerRef = $args->{'headerRef'};
my $skinOverride = $args->{'skinOverride'};
- my $count = $args->{'perPage'} || Slim::Utils::Prefs::get('itemsPerPage');
+ my $count = $args->{'perPage'} || $prefs->get('itemsPerPage');
my $offset = $args->{'offset'} || 0;
my $start = (defined($$startRef) && $$startRef ne '') ? $$startRef : 0;
@@ -397,7 +400,7 @@
my $results = $args->{'results'};
my $otherparams = $args->{'otherParams'};
my $start = $args->{'start'};
- my $itemsPerPage = $args->{'perPage'} || Slim::Utils::Prefs::get('itemsPerPage');
+ my $itemsPerPage = $args->{'perPage'} || $prefs->get('itemsPerPage');
my %pageinfo = ();
my %alphamap = ();
Modified: trunk/server/Slim/Web/Pages/BrowseDB.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Pages/BrowseDB.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Web/Pages/BrowseDB.pm (original)
+++ trunk/server/Slim/Web/Pages/BrowseDB.pm Mon Apr 16 15:26:59 2007
@@ -15,6 +15,9 @@
use Slim::Utils::Misc;
use Slim::Utils::Strings qw(string);
use Slim::Web::Pages;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
sub init {
@@ -254,7 +257,7 @@
# Force the limit if we're going by age.
if ($levelName eq 'age') {
- $browseRS = $browseRS->slice(0, (Slim::Utils::Prefs::get('browseagelimit') - 1));
+ $browseRS = $browseRS->slice(0, ($prefs->get('browseagelimit') - 1));
}
$count = $browseRS->count;
@@ -348,7 +351,7 @@
}
# Dynamic VA/Compilation listing
- if ($levelName eq 'contributor' && Slim::Utils::Prefs::get('variousArtistAutoIdentification')) {
+ if ($levelName eq 'contributor' && $prefs->get('variousArtistAutoIdentification')) {
# Only show VA item if there's valid listings below the current level.
my %attributes = %attrs;
Modified: trunk/server/Slim/Web/Pages/BrowseTree.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Pages/BrowseTree.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Web/Pages/BrowseTree.pm (original)
+++ trunk/server/Slim/Web/Pages/BrowseTree.pm Mon Apr 16 15:26:59 2007
@@ -16,12 +16,15 @@
use Slim::Utils::Misc;
use Slim::Utils::Strings qw(string);
use Slim::Web::Pages;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
sub init {
Slim::Web::HTTP::addPageFunction( qr/^browsetree\.(?:htm|xml)/, \&browsetree, 'fork' );
- if (Slim::Utils::Prefs::get('audiodir')) {
+ if ($prefs->get('audiodir')) {
Slim::Web::Pages->addPageLinks("browse",{'BROWSE_MUSIC_FOLDER' => "browsetree.html"});
} else {
Slim::Web::Pages->addPageLinks("browse",{'BROWSE_MUSIC_FOLDER' => undef});
@@ -33,7 +36,7 @@
my $hierarchy = $params->{'hierarchy'} || '';
my $player = $params->{'player'};
- my $itemsPer = $params->{'itemsPerPage'} || Slim::Utils::Prefs::get('itemsPerPage');
+ my $itemsPer = $params->{'itemsPerPage'} || $prefs->get('itemsPerPage');
my @levels = split(/\//, $hierarchy);
my $itemnumber = 0;
Modified: trunk/server/Slim/Web/Pages/Home.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Pages/Home.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Web/Pages/Home.pm (original)
+++ trunk/server/Slim/Web/Pages/Home.pm Mon Apr 16 15:26:59 2007
@@ -12,6 +12,10 @@
use POSIX ();
use base qw(Slim::Web::Pages);
+
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
sub init {
my $class = shift;
@@ -66,7 +70,7 @@
$class->addPageLinks("help", {'TECHNICAL_INFORMATION' => "html/docs/index.html"});
}
- if (Slim::Utils::Prefs::get('audiodir')) {
+ if ($prefs->get('audiodir')) {
$class->addPageLinks("browse", {'BROWSE_MUSIC_FOLDER' => "browsetree.html"});
@@ -77,7 +81,7 @@
}
# Show playlists if any exists
- if (Slim::Utils::Prefs::get('playlistdir') || Slim::Schema->rs('Playlist')->getPlaylists->count) {
+ if ($prefs->get('playlistdir') || Slim::Schema->rs('Playlist')->getPlaylists->count) {
$class->addPageLinks("browse", {'SAVED_PLAYLISTS' => "browsedb.html?hierarchy=playlist,playlistTrack&level=0"});
}
Modified: trunk/server/Slim/Web/Pages/LiveSearch.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Pages/LiveSearch.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Web/Pages/LiveSearch.pm (original)
+++ trunk/server/Slim/Web/Pages/LiveSearch.pm Mon Apr 16 15:26:59 2007
@@ -15,8 +15,11 @@
use Slim::Music::Info;
use Slim::Utils::Strings qw(string);
use Slim::Web::Pages;
+use Slim::Utils::Prefs;
use constant MAXRESULTS => 10;
+
+my $prefs = preferences('server');
sub outputAsXHTML {
my $class = shift;
@@ -131,7 +134,7 @@
$name = Slim::Music::Info::standardTitle(undef, $item) || '';
# Starting work on the standard track list format, but its a work in progress.
- my $webFormat = Slim::Utils::Prefs::getInd("titleFormat",Slim::Utils::Prefs::get("titleFormatWeb")) || '';
+ my $webFormat = $prefs->get('titleFormat')->[ $prefs->get('titleFormatWeb') ] || '';
# This is rather redundant from Pages.pm
if ($webFormat !~ /ARTIST/ && $item->can('artist') && $item->artist) {
Modified: trunk/server/Slim/Web/Pages/Playlist.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Pages/Playlist.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Web/Pages/Playlist.pm (original)
+++ trunk/server/Slim/Web/Pages/Playlist.pm Mon Apr 16 15:26:59 2007
@@ -17,8 +17,11 @@
use Slim::Utils::Misc;
use Slim::Utils::Strings qw(string);
use Slim::Web::Pages;
+use Slim::Utils::Prefs;
my $log = logger('player.playlist');
+
+my $prefs = preferences('server');
use constant CACHE_TIME => 300;
@@ -52,7 +55,7 @@
$params->{'playlist_items'} = '';
$params->{'skinOverride'} ||= '';
- my $count = Slim::Utils::Prefs::get('itemsPerPage');
+ my $count = $prefs->get('itemsPerPage');
unless (defined($params->{'start'}) && $params->{'start'} ne '') {
@@ -102,7 +105,7 @@
$log->info("Rebuilding playlist from cached params.");
- if (Slim::Utils::Prefs::get("playlistdir")) {
+ if ($prefs->get('playlistdir')) {
$params->{'cansave'} = 1;
}
@@ -139,8 +142,8 @@
my $currsongind = Slim::Player::Source::playingSongIndex($client);
- my $itemsPerPage = Slim::Utils::Prefs::get('itemsPerPage');
- my $composerIn = Slim::Utils::Prefs::get('composerInArtists');
+ my $itemsPerPage = $prefs->get('itemsPerPage');
+ my $composerIn = $prefs->get('composerInArtists');
my $titleFormat = Slim::Music::Info::standardTitleFormat();
@@ -206,7 +209,7 @@
# For the moment cache html for Default, other skins only cache params
# Later consider caching as html unless an ajaxRequest
# my $cacheHtml = !$params->{'ajaxRequest'};
- my $cacheHtml = (($params->{'skinOverride'} || Slim::Utils::Prefs::get('skin')) eq 'Default');
+ my $cacheHtml = (($params->{'skinOverride'} || $prefs->get('skin')) eq 'Default');
my $time = time();
Modified: trunk/server/Slim/Web/Pages/Search.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Pages/Search.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Web/Pages/Search.pm (original)
+++ trunk/server/Slim/Web/Pages/Search.pm Mon Apr 16 15:26:59 2007
@@ -20,6 +20,7 @@
use Slim::Utils::Text;
use Slim::Web::Pages;
use Slim::Web::Pages::LiveSearch;
+use Slim::Utils::Prefs;
sub init {
@@ -277,7 +278,7 @@
# Set some reasonable defaults
$params->{'numresults'} = $count;
- $params->{'itemsPerPage'} ||= Slim::Utils::Prefs::get('itemsPerPage');
+ $params->{'itemsPerPage'} ||= preferences('server')->get('itemsPerPage');
# This is handed to pageInfo to generate the pagebar 1 2 3 >> links.
my $otherParams = 'player=' . Slim::Utils::Misc::escape($player) .
Modified: trunk/server/Slim/Web/Pages/Status.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Pages/Status.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Web/Pages/Status.pm (original)
+++ trunk/server/Slim/Web/Pages/Status.pm Mon Apr 16 15:26:59 2007
@@ -19,6 +19,9 @@
use Slim::Utils::Strings qw(string);
use Slim::Web::HTTP;
use Slim::Web::Pages;
+use Slim::Utils::Prefs;
+
+my $prefs = preferences('server');
sub init {
@@ -40,7 +43,7 @@
Slim::Web::Pages->addPlayerList($client, $params);
- $params->{'refresh'} = Slim::Utils::Prefs::get('refreshRate');
+ $params->{'refresh'} = $prefs->get('refreshRate');
if (!defined($client)) {
@@ -161,7 +164,7 @@
$params->{'bitrate'} = string('CONVERTED_TO')." ".Slim::Utils::Prefs::maxRate($client).string('KBPS').' ABR';
}
- if (Slim::Utils::Prefs::get("playlistdir")) {
+ if ($prefs->get('playlistdir')) {
$params->{'cansave'} = 1;
}
}
Modified: trunk/server/Slim/Web/Settings/Server/Basic.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Settings/Server/Basic.pm?rev=11770&r1=11769&r2=11770&view=diff
==============================================================================
--- trunk/server/Slim/Web/Settings/Server/Basic.pm (original)
+++ trunk/server/Slim/Web/Settings/Server/Basic.pm Mon Apr 16 15:26:59 2007
@@ -11,6 +11,7 @@
use base qw(Slim::Web::Settings);
use Slim::Utils::Log;
+use Slim::Utils::Prefs;
sub name {
return 'BASIC_SERVER_SETTINGS';
@@ -20,59 +21,23 @@
return 'settings/server/basic.html';
}
+sub prefs {
+ return (preferences('server'), qw(language audiodir playlistdir) );
+}
+
+# FIXME - add importers back as these are in different namespaces... perhaps they should be in the server namespace...
+
+#for my $importer (qw(iTunes MusicMagic)) {
+
+# if (exists $Slim::Music::Import::Importers{"Slim::Plugin::".$importer."::Plugin"}) {
+# push @prefs, lc($importer);
+# }
+#}
+
sub handler {
my ($class, $client, $paramRef) = @_;
- my @prefs = qw(language audiodir playlistdir rescantype rescan);
-
- for my $importer (qw(iTunes MusicMagic)) {
-
- if (exists $Slim::Music::Import::Importers{"Slim::Plugin::".$importer."::Plugin"}) {
- push @prefs, lc($importer);
- }
- }
-
- # If this is a settings update
- if ($paramRef->{'saveSettings'}) {
-
- if ($paramRef->{'language'} ne Slim::Utils::Prefs::get('language')) {
-
- Slim::Utils::Strings::setLanguage($paramRef->{'language'});
- }
-
- for my $pref (@prefs) {
-
- if ($pref eq 'playlistdir' || $pref eq 'audiodir') {
-
- if ($paramRef->{$pref} ne Slim::Utils::Prefs::get($pref)) {
-
- my ($validDir, $errMsg) = Slim::Utils::Validate::isDir($paramRef->{$pref});
-
- if (!$validDir && $paramRef->{$pref} ne "") {
-
- $paramRef->{'warning'} .= sprintf(Slim::Utils::Strings::string("SETUP_BAD_DIRECTORY"), $paramRef->{$pref});
-
- delete $paramRef->{$pref};
- }
-
- else {
-
- $paramRef->{'rescan'} = 1;
-
- if ($paramRef->{'rescantype'} ne '2wipedb') {
-
- $paramRef->{'rescantype'} = ($pref eq 'playlistdir' ? '3playlist' : '2wipedb');
- }
- }
- }
- }
-
- if (exists $paramRef->{$pref}) {
-
- Slim::Utils::Prefs::set($pref, $paramRef->{$pref});
- }
- }
- }
+ # prefs setting handled by SUPER::handler
if ($paramRef->{'rescan'}) {
@@ -89,7 +54,7 @@
logger('scan.scanner')->info(sprintf("Initiating scan of type: %s",join (" ",@{$rescanType})));
- Slim::Control::Request::executeRequest($client, $rescanType);
+ Slim::Control::Request::executeRequest(undef, $rescanType);
}
$paramRef->{'scanning'}