From f3b965ea7fb84b34a7a8bfbc97c56d297b0e9b57 Mon Sep 17 00:00:00 2001 From: Michael Herger Date: Fri, 24 Jan 2025 17:47:50 +0100 Subject: [PATCH] Remove some more MySB legacy: unused prefs, and an error handler which can't be enabled any more. Signed-off-by: Michael Herger --- Changelog9.html | 5 ++- Slim/Player/Squeezebox2.pm | 3 -- Slim/Plugin/InternetRadio/Plugin.pm | 20 --------- Slim/Plugin/InternetRadio/TuneIn.pm | 30 ------------- Slim/Plugin/OPMLBased.pm | 69 +++++++++++------------------ Slim/Utils/Prefs.pm | 5 ++- 6 files changed, 32 insertions(+), 100 deletions(-) diff --git a/Changelog9.html b/Changelog9.html index ee28c5c0864..676e5119f14 100644 --- a/Changelog9.html +++ b/Changelog9.html @@ -11,7 +11,7 @@

Version 9.1.0

  • Server Changes:

  • @@ -35,7 +35,8 @@

    Version 9.1.0

  • Other:

  • diff --git a/Slim/Player/Squeezebox2.pm b/Slim/Player/Squeezebox2.pm index 3e90a0dcdff..51cdaf2a51c 100644 --- a/Slim/Player/Squeezebox2.pm +++ b/Slim/Player/Squeezebox2.pm @@ -48,9 +48,6 @@ our $defaultPrefs = { 'remoteReplayGain' => -5, 'disableDac' => 0, 'minSyncAdjust' => 10, # ms - 'snLastSyncUp' => -1, - 'snLastSyncDown' => -1, - 'snSyncInterval' => 30, 'outputChannels' => 0, 'balance' => 0, }; diff --git a/Slim/Plugin/InternetRadio/Plugin.pm b/Slim/Plugin/InternetRadio/Plugin.pm index 65b1cd7b05e..847ff111e8f 100644 --- a/Slim/Plugin/InternetRadio/Plugin.pm +++ b/Slim/Plugin/InternetRadio/Plugin.pm @@ -28,12 +28,6 @@ sub initPlugin { \&_initRadio, ); - # Setup cant_open handler for TuneIn reporting - Slim::Control::Request::subscribe( - \&cantOpen, - [['playlist'],['cant_open']], - ); - Slim::Plugin::InternetRadio::TuneIn->init(); } @@ -225,18 +219,4 @@ sub _pluginDataFor { return $class->SUPER::_pluginDataFor($key); } -sub cantOpen { - my $request = shift; - - my $url = $request->getParam('_url'); - my $error = $request->getParam('_error'); - - # Do not report if the user has turned off stats reporting - return if $prefs->get('sn_disable_stats'); - - if ( $error && $url =~ /(?:radiotime|tunein)\.com/ ) { - Slim::Plugin::InternetRadio::TuneIn->reportError($url, $error); - } -} - 1; diff --git a/Slim/Plugin/InternetRadio/TuneIn.pm b/Slim/Plugin/InternetRadio/TuneIn.pm index 4a15d99b36d..01ac60d6c3f 100644 --- a/Slim/Plugin/InternetRadio/TuneIn.pm +++ b/Slim/Plugin/InternetRadio/TuneIn.pm @@ -277,34 +277,4 @@ sub setUsername { $prefs->set('username', $username); } -sub reportError { - my ($class, $url, $error) = @_; - - return unless $error && $url =~ m{^https?://[^/](?:radiotime|tunein)\.com}; - - my ($id) = $url =~ /\bid\b=([a-z0-9]+)/; - if ( $id ) { - my $reportUrl = ERROR_URL - . '&id=' . uri_escape_utf8($id) - . '&message=' . uri_escape_utf8($error); - - main::INFOLOG && $log->is_info && $log->info("Reporting stream failure to TuneIn: $reportUrl"); - - my $http = Slim::Networking::SimpleAsyncHTTP->new( - sub { - main::INFOLOG && $log->is_info && $log->info("TuneIn failure report OK"); - }, - sub { - my $http = shift; - main::INFOLOG && $log->is_info && $log->info( "TuneIn failure report failed: " . $http->error ); - }, - { - timeout => 30, - }, - ); - - $http->get($reportUrl); - } -} - 1; diff --git a/Slim/Plugin/OPMLBased.pm b/Slim/Plugin/OPMLBased.pm index 64fc00fe4d7..318574f11bd 100644 --- a/Slim/Plugin/OPMLBased.pm +++ b/Slim/Plugin/OPMLBased.pm @@ -20,12 +20,12 @@ my %cli_next = (); sub initPlugin { my ( $class, %args ) = @_; - + if ( $args{is_app} ) { # Put all apps in the apps menu $args{menu} = 'apps'; } - + { no strict 'refs'; *{$class.'::'.'feed'} = sub { $args{feed} } if $args{feed}; @@ -38,9 +38,9 @@ sub initPlugin { if (!$class->_pluginDataFor('icon')) { Slim::Web::Pages->addPageLinks("icons", { $class->getDisplayName => 'html/images/radio.png' }); } - + $class->initCLI( %args ); - + if ( my $menu = $class->initJive( %args ) ) { if ( $args{is_app} ) { Slim::Control::Jive::registerAppMenu($menu); @@ -54,21 +54,14 @@ sub initPlugin { } # add "hidden" items to Jive home menu for individual OPMLbased items -# this allows individual items to be optionally added to the +# this allows individual items to be optionally added to the # top-level menu through the CustomizeHomeMenu applet sub initJive { my ( $class, %args ) = @_; - - # Exclude disabled plugins - if ( my $disabled = $prefs->get('sn_disabled_plugins') ) { - for my $plugin ( @{$disabled} ) { - return if $class =~ /^Slim::Plugin::${plugin}::/; - } - } my $icon = $class->_pluginDataFor('icon') ? proxiedImage($class->_pluginDataFor('icon')) : 'html/images/radio.png'; my $name = $class->getDisplayName(); - + my @jiveMenu = ( { stringToken => (uc($name) eq $name) ? $name : undef, # Only use string() if it is uppercase text => $name, @@ -77,7 +70,7 @@ sub initJive { node => $args{node} || $args{menu} || 'plugins', weight => $class->weight, displayWhenOff => 0, - window => { + window => { 'icon-id' => $icon, titleStyle => 'album', }, @@ -91,7 +84,7 @@ sub initJive { }, }, } ); - + # Bug 12336, additional items for type=search if ( $args{type} && $args{type} eq 'search' ) { $jiveMenu[0]->{actions}->{go}->{params}->{search} = '__TAGGEDINPUT__'; @@ -114,18 +107,18 @@ sub initJive { sub initCLI { my ( $class, %args ) = @_; - + my $cliQuery = sub { my $request = shift; Slim::Control::XMLBrowser::cliQuery( $args{tag}, $class->feed( $request->client ), $request ); }; - + # CLI support Slim::Control::Request::addDispatch( [ $args{tag}, 'items', '_index', '_quantity' ], [ 1, 1, 1, $cliQuery ] ); - + Slim::Control::Request::addDispatch( [ $args{tag}, 'playlist', '_method' ], [ 1, 1, 1, $cliQuery ] @@ -149,11 +142,11 @@ sub setMode { } my $name = $class->getDisplayName(); - + my $type = $class->type; - + my $title = (uc($name) eq $name) ? $client->string( $name ) : $name; - + if ( $type eq 'link' ) { my %params = ( header => $name, @@ -164,7 +157,7 @@ sub setMode { ); Slim::Buttons::Common::pushMode( $client, 'xmlbrowser', \%params ); - + # we'll handle the push in a callback $client->modeParam( handledTransition => 1 ); } @@ -180,7 +173,7 @@ sub setMode { timeout => 35, }, ); - + Slim::Buttons::Common::pushModeLeft( $client, 'INPUT.Text', \%params ); } } @@ -206,7 +199,7 @@ sub cliRadiosQuery { # what we want the query to report about ourself if (defined $menu) { my $type = $class->type; - + if ( $type eq 'link' ) { $data = { text => $title, @@ -261,7 +254,7 @@ sub cliRadiosQuery { elsif ( $type eq 'search' ) { $type = 'xmlbrowser_search'; } - + $data = { cmd => $tag, name => $title, @@ -270,26 +263,14 @@ sub cliRadiosQuery { weight => $weight, }; } - - # Exclude disabled plugins - my $disabled = $prefs->get('sn_disabled_plugins'); - - if ( $disabled ) { - for my $plugin ( @{$disabled} ) { - if ( $class =~ /^Slim::Plugin::${plugin}::/ ) { - $data = {}; - last; - } - } - } - + # Filter out items which don't match condition if ( $class->can('condition') && $request->client ) { if ( !$class->condition( $request->client ) ) { $data = {}; } } - + # let our super duper function do all the hard work Slim::Control::Queries::dynamicAutoQuery( $request, $cli_menu, $cli_next{ $class }->{ $cli_menu }, $data ); }; @@ -297,26 +278,26 @@ sub cliRadiosQuery { sub webPages { my $class = shift; - + # Only setup webpages here if a menu is defined by the plugin return unless $class->menu; my $title = $class->getDisplayName(); my $url = 'plugins/' . $class->tag() . '/index.html'; - + # default location for plugins is 'plugins' in the web UI, but 'extras' in SP... my $menu = $class->menu(); $menu = 'plugins' if $menu eq 'extras'; - + Slim::Web::Pages->addPageLinks( $menu, { $title => $url } ); - + if ( $class->can('condition') ) { Slim::Web::Pages->addPageCondition( $title, sub { $class->condition(shift); } ); } Slim::Web::Pages->addPageFunction( $url, sub { my $client = $_[0]; - + Slim::Web::XMLBrowser->handleWebIndex( { client => $client, feed => $class->feed( $client ), diff --git a/Slim/Utils/Prefs.pm b/Slim/Utils/Prefs.pm index 489e6e8db3c..5e55cdd67b4 100644 --- a/Slim/Utils/Prefs.pm +++ b/Slim/Utils/Prefs.pm @@ -275,7 +275,7 @@ sub init { 'composerAlbumLink' => $prefs->get('useUnifiedArtistsList') && $prefs->get('composerInArtists'), 'conductorAlbumLink' => $prefs->get('useUnifiedArtistsList') && $prefs->get('conductorInArtists'), 'bandAlbumLink' => $prefs->get('useUnifiedArtistsList') && $prefs->get('bandInArtists'), - 'worksScan'=> $prefs->get("showComposerReleasesbyAlbum") || 2, + 'worksScan' => $prefs->get("showComposerReleasesbyAlbum") || 2, ); # we can have different defaults depending on the OS @@ -295,6 +295,9 @@ sub init { # initialise any new prefs $prefs->init(\%defaults, 'Slim::Utils::Prefs::Migration'); + # remove some SN/MySB legacy + $prefs->remove(qw(snInitErrors snLastSyncDown sn_disable_stats sn_disabled_plugins sn_email sn_protocolhandlers sn_session sn_sync)); + # perform OS-specific post-init steps $os->postInitPrefs($prefs);