Skip to content

Commit

Permalink
Remove some more MySB legacy: unused prefs, and an error handler whic…
Browse files Browse the repository at this point in the history
…h can't be enabled any more.

Signed-off-by: Michael Herger <[email protected]>
  • Loading branch information
michaelherger committed Jan 24, 2025
1 parent c41b8ea commit f3b965e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 100 deletions.
5 changes: 3 additions & 2 deletions Changelog9.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h2><a name="v9.1.0" id="v9.1.0"></a>Version 9.1.0</h2>

<li>Server Changes:</li>
<ul>
<li>Remove more left-overs from removed picture/video scanning.</li>
<li><a href="https://github.com/LMS-Community/slimserver/pull/1245">#1245</a> - Added a Simple WebSocket client capability for 3rd Party Plugins to support this protocol (expectingtofly)</li>
</ul>
<br />

Expand All @@ -35,7 +35,8 @@ <h2><a name="v9.1.0" id="v9.1.0"></a>Version 9.1.0</h2>

<li>Other:</li>
<ul>
<li><a href="https://github.com/LMS-Community/slimserver/pull/1245">#1245</a> - Added a Simple WebSocket client capability for 3rd Party Plugins to support this protocol (expectingtofly)</li>
<li>Remove more left-overs from removed picture/video scanning.</li>
<li>Remove more left-overs from removed MySqueezebox integration.</li>
</ul>
<br />
</ul>
Expand Down
3 changes: 0 additions & 3 deletions Slim/Player/Squeezebox2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ our $defaultPrefs = {
'remoteReplayGain' => -5,
'disableDac' => 0,
'minSyncAdjust' => 10, # ms
'snLastSyncUp' => -1,
'snLastSyncDown' => -1,
'snSyncInterval' => 30,
'outputChannels' => 0,
'balance' => 0,
};
Expand Down
20 changes: 0 additions & 20 deletions Slim/Plugin/InternetRadio/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
30 changes: 0 additions & 30 deletions Slim/Plugin/InternetRadio/TuneIn.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
69 changes: 25 additions & 44 deletions Slim/Plugin/OPMLBased.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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);
Expand All @@ -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,
Expand All @@ -77,7 +70,7 @@ sub initJive {
node => $args{node} || $args{menu} || 'plugins',
weight => $class->weight,
displayWhenOff => 0,
window => {
window => {
'icon-id' => $icon,
titleStyle => 'album',
},
Expand All @@ -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__';
Expand All @@ -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 ]
Expand All @@ -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,
Expand All @@ -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 );
}
Expand All @@ -180,7 +173,7 @@ sub setMode {
timeout => 35,
},
);

Slim::Buttons::Common::pushModeLeft( $client, 'INPUT.Text', \%params );
}
}
Expand All @@ -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,
Expand Down Expand Up @@ -261,7 +254,7 @@ sub cliRadiosQuery {
elsif ( $type eq 'search' ) {
$type = 'xmlbrowser_search';
}

$data = {
cmd => $tag,
name => $title,
Expand All @@ -270,53 +263,41 @@ 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 );
};
}

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 ),
Expand Down
5 changes: 4 additions & 1 deletion Slim/Utils/Prefs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand Down

0 comments on commit f3b965e

Please sign in to comment.