diff --git a/Slim/Buttons/Common.pm b/Slim/Buttons/Common.pm index 4c09593d52b..920efe86cd1 100644 --- a/Slim/Buttons/Common.pm +++ b/Slim/Buttons/Common.pm @@ -39,7 +39,6 @@ use strict; use Scalar::Util qw(blessed); use Slim::Buttons::Alarm; -use Slim::Buttons::SqueezeNetwork; use Slim::Buttons::Volume; use Slim::Buttons::GlobalSearch; use Slim::Buttons::XMLBrowser; @@ -124,7 +123,12 @@ sub init { Slim::Buttons::Power::init(); Slim::Buttons::ScreenSaver::init(); Slim::Buttons::GlobalSearch::init(); - Slim::Buttons::SqueezeNetwork::init(); + + if (!main::NOMYSB) { + require Slim::Buttons::SqueezeNetwork; + Slim::Buttons::SqueezeNetwork::init(); + } + Slim::Buttons::Synchronize::init(); Slim::Buttons::TrackInfo::init(); Slim::Buttons::RemoteTrackInfo::init(); diff --git a/Slim/Buttons/Home.pm b/Slim/Buttons/Home.pm index cc6ccd17e33..e8b3410b8a0 100644 --- a/Slim/Buttons/Home.pm +++ b/Slim/Buttons/Home.pm @@ -832,7 +832,7 @@ sub updateMenu { text => $title, }; - my $url = $apps->{$app}->{url} =~ /^http/ + my $url = ( main::NOMYSB || $apps->{$app}->{url} =~ /^http/ ) ? $apps->{$app}->{url} : Slim::Networking::SqueezeNetwork->url( $apps->{$app}->{url} ); diff --git a/Slim/Buttons/Settings.pm b/Slim/Buttons/Settings.pm index 39a5c26f3e4..87a049286f8 100644 --- a/Slim/Buttons/Settings.pm +++ b/Slim/Buttons/Settings.pm @@ -23,7 +23,6 @@ use Slim::Buttons::Alarm; use Slim::Utils::Misc; use Slim::Utils::Prefs; use Slim::Buttons::Information; -use Slim::Buttons::SqueezeNetwork; use Slim::Networking::Discovery::Server; my $prefs = preferences('server'); diff --git a/Slim/Control/Commands.pm b/Slim/Control/Commands.pm index b1caa701a9d..fd45b79ab3b 100644 --- a/Slim/Control/Commands.pm +++ b/Slim/Control/Commands.pm @@ -298,8 +298,12 @@ sub buttonCommand { sub clientConnectCommand { my $request = shift; my $client = $request->client(); - - if ( $client->hasServ() ) { + + if (main::NOMYSB) { + $request->setStatusBadDispatch(); + return; + } + elsif ( !main::NOMYSB && $client->hasServ() ) { my ($host, $packed); $host = $request->getParam('_where'); @@ -2691,73 +2695,75 @@ sub rescanCommand { sub setSNCredentialsCommand { my $request = shift; - - if ($request->isNotCommand([['setsncredentials']])) { + + if ( main::NOMYSB || $request->isNotCommand([['setsncredentials']]) ) { $request->setStatusBadDispatch(); return; } - - # get our parameters - my $username = $request->getParam('_username'); - my $password = $request->getParam('_password'); - my $sync = $request->getParam('sync'); - my $client = $request->client; - - # Sync can be toggled without username/password - if ( defined $sync ) { - $prefs->set('sn_sync', $sync); - - if ( UNIVERSAL::can('Slim::Networking::SqueezeNetwork::PrefSync', 'shutdown') ) { - Slim::Networking::SqueezeNetwork::PrefSync->shutdown(); - } + elsif ( !main::NOMYSB ) { - if ( $sync ) { - require Slim::Networking::SqueezeNetwork::PrefSync; - Slim::Networking::SqueezeNetwork::PrefSync->init(); + # get our parameters + my $username = $request->getParam('_username'); + my $password = $request->getParam('_password'); + my $sync = $request->getParam('sync'); + my $client = $request->client; + + # Sync can be toggled without username/password + if ( defined $sync ) { + $prefs->set('sn_sync', $sync); + + if ( UNIVERSAL::can('Slim::Networking::SqueezeNetwork::PrefSync', 'shutdown') ) { + Slim::Networking::SqueezeNetwork::PrefSync->shutdown(); + } + + if ( $sync ) { + require Slim::Networking::SqueezeNetwork::PrefSync; + Slim::Networking::SqueezeNetwork::PrefSync->init(); + } } - } - - $password = sha1_base64($password); - - # Verify username/password - if ($username) { - $request->setStatusProcessing(); - - Slim::Networking::SqueezeNetwork->login( - username => $username, - password => $password, - client => $client, - cb => sub { - $request->addResult('validated', 1); - $request->addResult('warning', $request->cstring('SETUP_SN_VALID_LOGIN')); + $password = sha1_base64($password); + + # Verify username/password + if ($username) { + + $request->setStatusProcessing(); - # Shut down all SN activity - Slim::Networking::SqueezeNetwork->shutdown(); - - $prefs->set('sn_email', $username); - $prefs->set('sn_password_sha', $password); + Slim::Networking::SqueezeNetwork->login( + username => $username, + password => $password, + client => $client, + cb => sub { + $request->addResult('validated', 1); + $request->addResult('warning', $request->cstring('SETUP_SN_VALID_LOGIN')); + + # Shut down all SN activity + Slim::Networking::SqueezeNetwork->shutdown(); - # Start it up again if the user enabled it - Slim::Networking::SqueezeNetwork->init(); - - $request->setStatusDone(); - }, - ecb => sub { - $request->addResult('validated', 0); - $request->addResult('warning', $request->cstring('SETUP_SN_INVALID_LOGIN')); - - $request->setStatusDone(); - }, - ); - } - - # stop SN integration if either mail or password is undefined - else { - $request->addResult('validated', 1); - $prefs->set('sn_email', ''); - $prefs->set('sn_password_sha', ''); - Slim::Networking::SqueezeNetwork->shutdown(); + $prefs->set('sn_email', $username); + $prefs->set('sn_password_sha', $password); + + # Start it up again if the user enabled it + Slim::Networking::SqueezeNetwork->init(); + + $request->setStatusDone(); + }, + ecb => sub { + $request->addResult('validated', 0); + $request->addResult('warning', $request->cstring('SETUP_SN_INVALID_LOGIN')); + + $request->setStatusDone(); + }, + ); + } + + # stop SN integration if either mail or password is undefined + else { + $request->addResult('validated', 1); + $prefs->set('sn_email', ''); + $prefs->set('sn_password_sha', ''); + Slim::Networking::SqueezeNetwork->shutdown(); + } } } diff --git a/Slim/Control/Jive.pm b/Slim/Control/Jive.pm index a88d880d5ee..f71b1610b1b 100644 --- a/Slim/Control/Jive.pm +++ b/Slim/Control/Jive.pm @@ -2973,7 +2973,7 @@ sub appMenus { # use icon as defined by MySB to allow for white-label solutions if ( my $icon = $apps->{$app}->{icon} ) { - $icon = Slim::Networking::SqueezeNetwork->url( $icon, 'external' ) unless $icon =~ /^http/; + $icon = Slim::Networking::SqueezeNetwork->url( $icon, 'external' ) unless main::NOMYSB || $icon =~ /^http/; $clone->{window}->{'icon-id'} = Slim::Web::ImageProxy::proxiedImage($icon); } @@ -2993,11 +2993,11 @@ sub appMenus { if ( $apps->{$app}->{type} eq 'opml' ) { main::INFOLOG && $isInfo && $log->info( "App: $app, using generic OPML handler" ); - my $url = $apps->{$app}->{url} =~ /^http/ + my $url = ( main::NOMYSB || $apps->{$app}->{url} =~ /^http/ ) ? $apps->{$app}->{url} : Slim::Networking::SqueezeNetwork->url( $apps->{$app}->{url} ); - my $icon = $apps->{$app}->{icon} =~ /^http/ + my $icon = ( main::NOMYSB || $apps->{$app}->{icon} =~ /^http/ ) ? $apps->{$app}->{icon} : Slim::Networking::SqueezeNetwork->url( $apps->{$app}->{icon}, 'external' ); diff --git a/Slim/Control/Queries.pm b/Slim/Control/Queries.pm index 6dfc84af3f7..0ce463430b5 100644 --- a/Slim/Control/Queries.pm +++ b/Slim/Control/Queries.pm @@ -3263,37 +3263,39 @@ sub serverstatusQuery { } - # return list of players connected to SN - my @sn_players = Slim::Networking::SqueezeNetwork::Players->get_players(); - - $count = scalar @sn_players || 0; - - $request->addResult('sn player count', $count); - - ($valid, $start, $end) = $request->normalize(scalar($index), scalar($quantity), $count); - - if ($valid) { - - my $sn_cnt = 0; - - for my $player ( @sn_players ) { - $request->addResultLoop( - 'sn_players_loop', $sn_cnt, 'id', $player->{id} - ); - - $request->addResultLoop( - 'sn_players_loop', $sn_cnt, 'name', $player->{name} - ); - - $request->addResultLoop( - 'sn_players_loop', $sn_cnt, 'playerid', $player->{mac} - ); - - $request->addResultLoop( - 'sn_players_loop', $sn_cnt, 'model', $player->{model} - ); + if (!main::NOMYSB) { + # return list of players connected to SN + my @sn_players = Slim::Networking::SqueezeNetwork::Players->get_players(); + + $count = scalar @sn_players || 0; + + $request->addResult('sn player count', $count); + + ($valid, $start, $end) = $request->normalize(scalar($index), scalar($quantity), $count); + + if ($valid) { + + my $sn_cnt = 0; - $sn_cnt++; + for my $player ( @sn_players ) { + $request->addResultLoop( + 'sn_players_loop', $sn_cnt, 'id', $player->{id} + ); + + $request->addResultLoop( + 'sn_players_loop', $sn_cnt, 'name', $player->{name} + ); + + $request->addResultLoop( + 'sn_players_loop', $sn_cnt, 'playerid', $player->{mac} + ); + + $request->addResultLoop( + 'sn_players_loop', $sn_cnt, 'model', $player->{model} + ); + + $sn_cnt++; + } } } diff --git a/Slim/Formats/XML.pm b/Slim/Formats/XML.pm index 49481452700..a25df36dfed 100644 --- a/Slim/Formats/XML.pm +++ b/Slim/Formats/XML.pm @@ -20,7 +20,6 @@ use XML::Simple; use Slim::Music::Info; use Slim::Networking::SimpleAsyncHTTP; -use Slim::Networking::SqueezeNetwork; use Slim::Player::Protocols::HTTP; use Slim::Utils::Cache; use Slim::Utils::Misc; @@ -124,7 +123,7 @@ sub getFeedAsync { } # If the URL is on SqueezeNetwork, add session headers or login first - if ( Slim::Networking::SqueezeNetwork->isSNURL($url) && !$params->{no_sn} ) { + if ( !main::NOMYSB && Slim::Networking::SqueezeNetwork->isSNURL($url) && !$params->{no_sn} ) { # Sometimes from the web we won't have a client, so pick a random one $params->{client} ||= Slim::Player::Client::clientRandom(); diff --git a/Slim/Player/Player.pm b/Slim/Player/Player.pm index 609c718a2ca..d2dbf576468 100644 --- a/Slim/Player/Player.pm +++ b/Slim/Player/Player.pm @@ -19,7 +19,6 @@ use Scalar::Util qw(blessed); use base qw(Slim::Player::Client); -use Slim::Buttons::SqueezeNetwork; use Slim::Hardware::IR; use Slim::Player::Client; use Slim::Player::Source; diff --git a/Slim/Utils/Firmware.pm b/Slim/Utils/Firmware.pm index afc7dbdf992..c932719bb8a 100644 --- a/Slim/Utils/Firmware.pm +++ b/Slim/Utils/Firmware.pm @@ -34,7 +34,6 @@ use File::Basename; use File::Slurp qw(read_file); use File::Spec::Functions qw(:ALL); -use Slim::Networking::SqueezeNetwork; use Slim::Networking::SimpleAsyncHTTP; use Slim::Utils::Log; use Slim::Utils::Misc; @@ -51,11 +50,11 @@ my $dir; my $updatesDir; # Download location -sub BASE { +sub BASE { if (main::NOMYSB) { '' } else { 'http://' . Slim::Networking::SqueezeNetwork->get_server("update") . '/update/firmware'; -} +} } # Check interval when firmware can't be downloaded my $CHECK_TIME = INITIAL_RETRY_TIME; @@ -127,23 +126,25 @@ sub init_firmware_download { } # Don't check for Jive firmware if the 'check for updated versions' pref is disabled - if ( !$prefs->get('checkVersion') ) { + if ( main::NOMYSB || !$prefs->get('checkVersion') ) { main::INFOLOG && $log->info("Not downloading firmware for $model - update check has been disabled in Settings/Advanced/Software Updates"); get_fw_locally($model); return; } - main::INFOLOG && $log->is_info && $log->info("Downloading $model.version file..."); - - # Any async downloads in init must be started on a timer so they don't - # time out from other slow init things - Slim::Utils::Timers::setTimer( - undef, - time(), - sub { - downloadAsync( $version_file, {cb => \&init_version_done, pt => [$version_file, $model]} ); - }, - ); + if ( !main::NOMYSB ) { + main::INFOLOG && $log->is_info && $log->info("Downloading $model.version file..."); + + # Any async downloads in init must be started on a timer so they don't + # time out from other slow init things + Slim::Utils::Timers::setTimer( + undef, + time(), + sub { + downloadAsync( $version_file, {cb => \&init_version_done, pt => [$version_file, $model]} ); + }, + ); + } } =head2 init_version_done($version_file, $model) @@ -154,7 +155,7 @@ in 1 day. =cut -sub init_version_done { +sub init_version_done { if (!main::NOMYSB) { my $version_file = shift; my $model = shift || 'jive'; @@ -211,7 +212,7 @@ sub init_version_done { init_firmware_download($model); }, ); -} +} } =head2 init_fw_done($fw_file, $model) @@ -221,7 +222,7 @@ Removes old firmware file if one exists. =cut -sub init_fw_done { +sub init_fw_done { if (!main::NOMYSB) { my $fw_file = shift; my $model = shift; @@ -241,7 +242,7 @@ sub init_fw_done { # send a notification that this firmware is downloaded Slim::Control::Request->new(undef, ['fwdownloaded', $model])->notify('firmwareupgrade'); -} +} } =head2 init_fw_error($model) @@ -249,7 +250,7 @@ Called if firmware download failed. Checks if another firmware exists in cache. =cut -sub init_fw_error { +sub init_fw_error { if (!main::NOMYSB) { my $model = shift || 'jive'; main::INFOLOG && $log->info("$model firmware download had an error"); @@ -257,7 +258,7 @@ sub init_fw_error { get_fw_locally( $model ); # Note: Server will keep trying to download a new one -} +} } sub get_fw_locally { my $model = shift || 'jive'; @@ -298,7 +299,7 @@ undef if firmware has not been downloaded. =cut -sub url { +sub url { if (!main::NOMYSB) { my $class = shift; my $model = shift || 'jive'; @@ -323,7 +324,7 @@ sub url { . Slim::Utils::Network::serverAddr() . ':' . preferences('server')->get('httpport') . '/firmware/' . basename($firmwares->{$model}->{file}); -} +} } =head2 need_upgrade( $current_version, $model ) @@ -373,7 +374,7 @@ $file must be an absolute path. =cut -sub download { +sub download { if (!main::NOMYSB) { my ( $url, $file ) = @_; require LWP::UserAgent; @@ -429,7 +430,7 @@ sub download { logError("Unable to download firmware from $url: $error"); return 0; -} +} } =head2 downloadAsync($file) @@ -440,7 +441,7 @@ This timer tries to download any missing firmware in the background every 10 min # Keep track of what files are being downloaded and their callbacks my %filesDownloading; -sub downloadAsync { +sub downloadAsync { if (!main::NOMYSB) { my ($file, $args) = @_; $args ||= {}; @@ -475,7 +476,7 @@ sub downloadAsync { main::INFOLOG && $log->info("Downloading in the background: $url -> $file"); $http->get( $url ); -} +} } =head2 downloadAsyncDone($http) @@ -483,7 +484,7 @@ Callback after our firmware file has been downloaded. =cut -sub downloadAsyncDone { +sub downloadAsyncDone { if (!main::NOMYSB) { my $http = shift; my $args = $http->params(); my $file = $args->{'file'}; @@ -505,7 +506,7 @@ sub downloadAsyncDone { ); $http->get( $url . '.sha' ); -} +} } =head2 downloadAsyncSHADone($http) @@ -513,7 +514,7 @@ Callback after our firmware's SHA checksum file has been downloaded. =cut -sub downloadAsyncSHADone { +sub downloadAsyncSHADone { if (!main::NOMYSB) { my $http = shift; my $args = $http->params(); my $file = $args->{'file'}; @@ -557,7 +558,7 @@ sub downloadAsyncSHADone { else { downloadAsyncError( $http, "Validation of firmware $file failed, SHA1 checksum did not match" ); } -} +} } =head2 downloadAsyncError( $http, $error ) @@ -566,7 +567,7 @@ file and resets the check timer. =cut -sub downloadAsyncError { +sub downloadAsyncError { if (!main::NOMYSB) { my ( $http, $error ) = @_; my $file = $http->params('file'); my $cb = $http->params('cb'); @@ -617,7 +618,7 @@ sub downloadAsyncError { if ( $file =~ /$model/ ) { init_fw_error($model); } -} +} } =head2 fatal($msg) diff --git a/Slim/Utils/OS/OSX.pm b/Slim/Utils/OS/OSX.pm index 0dc4168058a..19ab49b9061 100644 --- a/Slim/Utils/OS/OSX.pm +++ b/Slim/Utils/OS/OSX.pm @@ -362,7 +362,7 @@ sub getUpdateParams { }; } -sub signalUpdateReady { +sub signalUpdateReady { if (main::NOMYSB) { my $updater = Slim::Utils::Update::getUpdateInstaller(); my $log = Slim::Utils::Log::logger('server.update'); @@ -384,7 +384,7 @@ sub signalUpdateReady { # don't run the signal immediately, as the prefs are written delayed Slim::Utils::Timers::setTimer(undef, Time::HiRes::time() + 15, \&_signalUpdateReady); -} +} } # don't re-try Growl if it fails to be called my $hasGrowl = 1; diff --git a/Slim/Utils/Prefs.pm b/Slim/Utils/Prefs.pm index 0cbea97a774..220928dd95e 100644 --- a/Slim/Utils/Prefs.pm +++ b/Slim/Utils/Prefs.pm @@ -257,8 +257,8 @@ sub init { 'jivealbumsort' => 'album', 'defeatDestructiveTouchToPlay' => 4, # 4 => defeat only if playing and current item not a radio stream # Server Settings - mysqueezebox.com - 'sn_sync' => 1, - 'sn_disable_stats' => 1, + 'sn_sync' => main::NOMYSB ? undef : 1, + 'sn_disable_stats' => main::NOMYSB ? undef : 1, # Bug 5557, disable UPnP support by default 'noupnp' => 1, ); @@ -399,7 +399,7 @@ sub init { require Slim::Utils::Update; Slim::Utils::Update::checkVersion(); } - }, 'checkVersion' ); + }, 'checkVersion' ) if !main::NOMYSB; if ( !main::SCANNER ) { $prefs->setChange( sub { @@ -560,31 +560,33 @@ sub init { } }, 'timeFormat'); - # Clear SN cookies from the cookie jar if the session changes - $prefs->setChange( sub { - # XXX the sn.com hostnames can be removed later - my $cookieJar = Slim::Networking::Async::HTTP::cookie_jar(); - $cookieJar->clear( 'www.squeezenetwork.com' ); - $cookieJar->clear( 'www.test.squeezenetwork.com' ); - $cookieJar->clear( 'www.mysqueezebox.com' ); - $cookieJar->clear( 'www.test.mysqueezebox.com' ); - $cookieJar->save(); - main::DEBUGLOG && logger('network.squeezenetwork')->debug( 'SN session has changed, removing cookies' ); - }, 'sn_session' ); - - $prefs->setChange( sub { - Slim::Utils::Timers::setTimer( - $_[1], - time() + 30, - sub { - my $isDisabled = shift; - my $http = Slim::Networking::SqueezeNetwork->new(sub {}, sub {}); - - $http->get( $http->url( '/api/v1/stats/mark_disabled/' . $isDisabled ? 1 : 0 ) ); - }, - ); + if (!main::NOMYSB) { + # Clear SN cookies from the cookie jar if the session changes + $prefs->setChange( sub { + # XXX the sn.com hostnames can be removed later + my $cookieJar = Slim::Networking::Async::HTTP::cookie_jar(); + $cookieJar->clear( 'www.squeezenetwork.com' ); + $cookieJar->clear( 'www.test.squeezenetwork.com' ); + $cookieJar->clear( 'www.mysqueezebox.com' ); + $cookieJar->clear( 'www.test.mysqueezebox.com' ); + $cookieJar->save(); + main::DEBUGLOG && logger('network.squeezenetwork')->debug( 'SN session has changed, removing cookies' ); + }, 'sn_session' ); - }, 'sn_disable_stats'); + $prefs->setChange( sub { + Slim::Utils::Timers::setTimer( + $_[1], + time() + 30, + sub { + my $isDisabled = shift; + my $http = Slim::Networking::SqueezeNetwork->new(sub {}, sub {}); + + $http->get( $http->url( '/api/v1/stats/mark_disabled/' . $isDisabled ? 1 : 0 ) ); + }, + ); + + }, 'sn_disable_stats'); + } # Reset IR state if preference change $prefs->setChange( sub { diff --git a/Slim/Utils/Scanner/Remote.pm b/Slim/Utils/Scanner/Remote.pm index 34d5fed8625..cf5d23f7b4a 100644 --- a/Slim/Utils/Scanner/Remote.pm +++ b/Slim/Utils/Scanner/Remote.pm @@ -168,7 +168,7 @@ sub scanURL { } # If the URL is on SqueezeNetwork, add session headers - if ( Slim::Networking::SqueezeNetwork->isSNURL($url) ) { + if ( !main::NOMYSB && Slim::Networking::SqueezeNetwork->isSNURL($url) ) { my %snHeaders = Slim::Networking::SqueezeNetwork->getHeaders($client); while ( my ($k, $v) = each %snHeaders ) { $request->header( $k => $v ); diff --git a/Slim/Utils/Update.pm b/Slim/Utils/Update.pm index 4ad015ec435..21fe896fc1e 100644 --- a/Slim/Utils/Update.pm +++ b/Slim/Utils/Update.pm @@ -4,7 +4,6 @@ use strict; use Time::HiRes; use File::Spec::Functions qw(splitpath catdir); -use Slim::Networking::SqueezeNetwork; use Slim::Utils::Log; use Slim::Utils::OSDetect; use Slim::Utils::Prefs; @@ -23,7 +22,7 @@ my $os = Slim::Utils::OSDetect->getOS(); my $versionFile; -sub checkVersion { +sub checkVersion { if (main::NOMYSB) { # clean up old download location Slim::Utils::Misc::deleteFiles($prefs->get('cachedir'), qr/^(?:Squeezebox|SqueezeCenter|LogitechMediaServer).*\.(pkg|dmg|exe)(\.tmp)?$/i); @@ -88,10 +87,10 @@ sub checkVersion { $prefs->set('checkVersionLastTime', Time::HiRes::time()); Slim::Utils::Timers::setTimer(0, Time::HiRes::time() + $prefs->get('checkVersionInterval'), \&checkVersion); -} +} } # called when check version request is complete -sub checkVersionCB { +sub checkVersionCB { if (main::NOMYSB) { my $http = shift; # Ignore update check results for users running from svn @@ -124,10 +123,10 @@ sub checkVersionCB { $::newVersion = 0; $log->warn(sprintf(Slim::Utils::Strings::string('CHECKVERSION_PROBLEM'), $http->code)); } -} +} } # called only if check version request fails -sub checkVersionError { +sub checkVersionError { if (main::NOMYSB) { my $http = shift; # Ignore update check results for users running from svn @@ -139,11 +138,11 @@ sub checkVersionError { . "\n" . $http->error . ($proxy ? sprintf("\nPlease check your proxy configuration (%s)", $proxy) : '') ); -} +} } # download the installer -sub getUpdate { +sub getUpdate { if (main::NOMYSB) { my $url = shift; my $params = $os->getUpdateParams(); @@ -201,9 +200,9 @@ sub getUpdate { else { $log->error("Didn't receive valid update URL: " . substr($url, 0, 50) . (length($url) > 50 ? '...' : '')); } -} +} } -sub downloadAsyncDone { +sub downloadAsyncDone { if (main::NOMYSB) { my $http = shift; my $file = $http->params('file'); @@ -245,9 +244,9 @@ sub downloadAsyncDone { } cleanup($path, 'tmp'); -} +} } -sub setUpdateInstaller { +sub setUpdateInstaller { if (main::NOMYSB) { my $file = shift; if ($file && open(UPDATEFLAG, ">$versionFile")) { @@ -267,10 +266,10 @@ sub setUpdateInstaller { unlink $versionFile; } -} +} } -sub getUpdateInstaller { +sub getUpdateInstaller { if (main::NOMYSB) { return unless $prefs->get('autoDownloadUpdate'); @@ -299,9 +298,9 @@ sub getUpdateInstaller { main::DEBUGLOG && $log->debug("Found update installer path: '$updateInstaller'"); return $updateInstaller; -} +} } -sub installerIsUpToDate { +sub installerIsUpToDate { if (main::NOMYSB) { return unless $prefs->get('autoDownloadUpdate'); @@ -309,7 +308,7 @@ sub installerIsUpToDate { return ( $::REVISION eq 'TRUNK' # we'll consider TRUNK to always be up to date || ($installer =~ /$::REVISION/ && $installer =~ /$::VERSION/) ) # same revision and revision -} +} } sub cleanup { my ($path, $additionalExt) = @_; diff --git a/Slim/Web/HTTP.pm b/Slim/Web/HTTP.pm index c1fbf182c3c..c54b36a49ff 100644 --- a/Slim/Web/HTTP.pm +++ b/Slim/Web/HTTP.pm @@ -1060,7 +1060,7 @@ sub generateHTTPResponse { $params->{'imageproxy'} = Slim::Networking::SqueezeNetwork->url( "/public/imageproxy" - ); + ) if !main::NOMYSB; main::PERFMON && (my $startTime = AnyEvent->time); diff --git a/Slim/Web/Pages/Home.pm b/Slim/Web/Pages/Home.pm index 5b8d8407ded..9571f258fed 100644 --- a/Slim/Web/Pages/Home.pm +++ b/Slim/Web/Pages/Home.pm @@ -14,7 +14,6 @@ use HTTP::Status qw(RC_MOVED_TEMPORARILY); use Slim::Utils::Prefs; use Slim::Utils::Strings; use Slim::Networking::Discovery::Server; -use Slim::Networking::SqueezeNetwork; use Slim::Plugin::Base; my $prefs = preferences('server'); @@ -25,7 +24,7 @@ sub init { Slim::Web::Pages->addPageFunction(qr/^index\.(?:htm|xml)/, \&home); Slim::Web::Pages->addPageFunction(qr/^switchserver\.(?:htm|xml)/, \&switchServer); - Slim::Web::Pages->addPageLinks('my_apps', {'PLUGIN_APP_GALLERY_MODULE_NAME' => Slim::Networking::SqueezeNetwork->url('/appgallery') }); + Slim::Web::Pages->addPageLinks('my_apps', {'PLUGIN_APP_GALLERY_MODULE_NAME' => Slim::Networking::SqueezeNetwork->url('/appgallery') }) if !main::NOMYSB; Slim::Web::Pages->addPageLinks("help", { 'HELP_REMOTE' => "html/docs/remote.html" }); Slim::Web::Pages->addPageLinks("help", { 'REMOTE_STREAMING' => "html/docs/remotestreaming.html" }); @@ -159,8 +158,8 @@ sub home { sub switchServer { my ($client, $params) = @_; - if (lc($params->{'switchto'}) eq 'squeezenetwork' - || $params->{'switchto'} eq Slim::Utils::Strings::string('SQUEEZENETWORK')) { + if ( !main::NOMYSB && ( lc($params->{'switchto'}) eq 'squeezenetwork' + || $params->{'switchto'} eq Slim::Utils::Strings::string('SQUEEZENETWORK') ) ) { if ( _canSwitch($client) ) { Slim::Utils::Timers::setTimer( @@ -193,7 +192,7 @@ sub switchServer { else { $params->{servers} = Slim::Networking::Discovery::Server::getServerList(); - if ( _canSwitch($client) ) { + if ( !main::NOMYSB && _canSwitch($client) ) { $params->{servers}->{'SQUEEZENETWORK'} = { NAME => Slim::Utils::Strings::string('SQUEEZENETWORK') }; @@ -207,11 +206,11 @@ sub switchServer { } # Bug 7254, don't tell Ray to reconnect to SN unless it's known to be attached to the user's account -sub _canSwitch { +sub _canSwitch { if (main::NOMYSB) { my $client = shift; return ( ($client->deviceid != 7) || Slim::Networking::SqueezeNetwork::Players->is_known_player($client) ); -} +} } 1; diff --git a/Slim/Web/Settings/Server/Wizard.pm b/Slim/Web/Settings/Server/Wizard.pm index 0f3f6bc5254..3273913a696 100644 --- a/Slim/Web/Settings/Server/Wizard.pm +++ b/Slim/Web/Settings/Server/Wizard.pm @@ -14,7 +14,6 @@ use HTTP::Status qw(RC_MOVED_TEMPORARILY); use Slim::Utils::Log; use Slim::Utils::Prefs; use Slim::Utils::Timers; -use Slim::Networking::SqueezeNetwork; my $log = Slim::Utils::Log->addLogCategory({ 'category' => 'wizard', @@ -34,7 +33,7 @@ sub handler { $paramRef->{languageoptions} = Slim::Utils::Strings::languageOptions(); # The hostname for mysqueezebox.com - $paramRef->{sn_server} = Slim::Networking::SqueezeNetwork->get_server("sn"); + $paramRef->{sn_server} = Slim::Networking::SqueezeNetwork->get_server("sn") if !main::NOMYSB; # make sure we only enforce the wizard at the very first startup if ($paramRef->{saveSettings}) { @@ -144,7 +143,8 @@ sub handler { if ( $paramRef->{saveSettings} ) { - if ( $paramRef->{sn_email} + if ( !main::NOMYSB + && $paramRef->{sn_email} && $paramRef->{sn_password_sha} && $serverPrefs->get('sn_sync') ) { diff --git a/Slim/Web/Setup.pm b/Slim/Web/Setup.pm index 63cfefb90df..f0b9d3b14fb 100644 --- a/Slim/Web/Setup.pm +++ b/Slim/Web/Setup.pm @@ -38,13 +38,16 @@ sub initSetup { Plugins Security Software - SqueezeNetwork Status TextFormatting UserInterface Wizard ); + if (!main::NOMYSB) { + push @classes, 'Slim::Web::Settings::Server::SqueezeNetwork'; + } + if (main::TRANSCODING) { push @classes, 'Slim::Web::Settings::Server::FileTypes'; } diff --git a/Slim/Web/Template/SkinManager.pm b/Slim/Web/Template/SkinManager.pm index 4450293f2f0..858fc194987 100644 --- a/Slim/Web/Template/SkinManager.pm +++ b/Slim/Web/Template/SkinManager.pm @@ -267,7 +267,7 @@ sub _resizeImage { } # fall back to using external image proxy for external resources - elsif ( $url =~ m{^https?://} ) { + elsif ( !main::NOMYSB && $url =~ m{^https?://} ) { return Slim::Networking::SqueezeNetwork->url( "/public/imageproxy?w=$width&h=$height&u=" . uri_escape($url) ); diff --git a/cleanup.pl b/cleanup.pl index ec46d50bdb7..526e55a73d2 100755 --- a/cleanup.pl +++ b/cleanup.pl @@ -48,6 +48,7 @@ use constant SB1SLIMP3SYNC=> 0; use constant WEBUI => 0; use constant LOCALFILE => 0; +use constant NOMYSB => 1; # load these later, don't need them right now require File::Path; diff --git a/gdresize.pl b/gdresize.pl index bd013f5a041..df2dc13d79e 100755 --- a/gdresize.pl +++ b/gdresize.pl @@ -18,6 +18,7 @@ use constant ISWINDOWS => ( $^O =~ /^m?s?win/i ) ? 1 : 0; use constant DEBUG => ( grep { /--debug/ } @ARGV ) ? 1 : 0; use constant LOCALFILE => 0; +use constant NOMYSB => 1; BEGIN { use Slim::bootstrap (); diff --git a/gdresized.pl b/gdresized.pl index be0340ca2fc..f495f6b8889 100755 --- a/gdresized.pl +++ b/gdresized.pl @@ -18,6 +18,7 @@ use constant DEBUG => ( grep { /--debug/ } @ARGV ) ? 1 : 0; use constant SOCKET_PATH => '/tmp/sbs_artwork'; use constant LOCALFILE => 0; +use constant NOMYSB => 1; # Copied from Slim::bootstrap to reduce memory overhead of unnecessary stuff BEGIN { diff --git a/scanner.pl b/scanner.pl index b5d1616d137..0ea33d754e5 100755 --- a/scanner.pl +++ b/scanner.pl @@ -34,6 +34,7 @@ use constant ISMAC => ( $^O =~ /darwin/i ) ? 1 : 0; use constant HAS_AIO => 0; use constant LOCALFILE => 0; +use constant NOMYSB => 1; # Tell PerlApp to bundle these modules if (0) { diff --git a/slimserver.pl b/slimserver.pl index 5a054271308..484fcb31412 100755 --- a/slimserver.pl +++ b/slimserver.pl @@ -26,6 +26,7 @@ use constant SB1SLIMP3SYNC=> ( grep { /--nosb1slimp3sync/ } @ARGV ) ? 0 : 1; use constant WEBUI => ( grep { /--noweb/ } @ARGV ) ? 0 : 1; use constant NOUPNP => ( grep { /--noupnp/ } @ARGV ) ? 1 : 0; +use constant NOMYSB => ( grep { /--nomysqueezebox/ } @ARGV ) ? 1 : 0; use constant IMAGE => ( grep { /--noimage/ } @ARGV ) ? 0 : !NOUPNP; use constant VIDEO => ( grep { /--novideo/ } @ARGV ) ? 0 : !NOUPNP; use constant ISWINDOWS => ( $^O =~ /^m?s?win/i ) ? 1 : 0; @@ -238,7 +239,6 @@ sub MEDIASUPPORT { use Slim::Utils::Scheduler; use Slim::Networking::Async::DNS; use Slim::Networking::Select; -use Slim::Networking::SqueezeNetwork; use Slim::Networking::UDP; use Slim::Control::Stdio; use Slim::Utils::Strings qw(string); @@ -490,8 +490,11 @@ sub init { Slim::Networking::Async::HTTP->init; Slim::Networking::SimpleAsyncHTTP->init; - main::INFOLOG && $log->info("SqueezeNetwork Init..."); - Slim::Networking::SqueezeNetwork->init(); + if (!main::NOMYSB) { + main::INFOLOG && $log->info("SqueezeNetwork Init..."); + require Slim::Networking::SqueezeNetwork; + Slim::Networking::SqueezeNetwork->init(); + } main::INFOLOG && $log->info("Firmware init..."); Slim::Utils::Firmware->init; @@ -634,7 +637,7 @@ sub init { Slim::Utils::PerfMon->init($perfwarn); } - if ( $prefs->get('checkVersion') ) { + if ( !main::NOMYSB && $prefs->get('checkVersion') ) { require Slim::Utils::Update; Slim::Utils::Timers::setTimer( undef,