diff --git a/plugin/SqueezeESP32.zip b/plugin/SqueezeESP32.zip index f4d99dc5..fa298f36 100644 Binary files a/plugin/SqueezeESP32.zip and b/plugin/SqueezeESP32.zip differ diff --git a/plugin/SqueezeESP32/HTML/EN/plugins/SqueezeESP32/settings/player.html b/plugin/SqueezeESP32/HTML/EN/plugins/SqueezeESP32/settings/player.html index ce820ecd..70baae8e 100644 --- a/plugin/SqueezeESP32/HTML/EN/plugins/SqueezeESP32/settings/player.html +++ b/plugin/SqueezeESP32/HTML/EN/plugins/SqueezeESP32/settings/player.html @@ -1,39 +1,42 @@ [% PROCESS settings/header.html %] - [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_WIDTH" desc="PLUGIN_SQUEEZEESP32_WIDTH_DESC" %] - - [% prefs.pref_width %] - [% END %] + [% IF prefs.pref_width %] + [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_WIDTH" desc="PLUGIN_SQUEEZEESP32_WIDTH_DESC" %] + + [% prefs.pref_width %] + [% END %] - [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_SMALL_VU" desc="PLUGIN_SQUEEZEESP32_SMALL_VU_DESC" %] - - [% END %] + [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_SMALL_VU" desc="PLUGIN_SQUEEZEESP32_SMALL_VU_DESC" %] + + [% END %] - [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_SPECTRUM_SCALE" desc="PLUGIN_SQUEEZEESP32_SPECTRUM_SCALE_DESC" %] - - [% END %] + [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_SPECTRUM_SCALE" desc="PLUGIN_SQUEEZEESP32_SPECTRUM_SCALE_DESC" %] + + [% END %] - [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_SMALL_SPECTRUM" desc="PLUGIN_SQUEEZEESP32_SMALL_SPECTRUM_DESC" %] - [% "PLUGIN_SQUEEZEESP32_SMALL_SPECTRUM_SIZE" | string %]  - - [% "PLUGIN_SQUEEZEESP32_SMALL_SPECTRUM_BAND" | string %]  - - [% END %] + [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_SMALL_SPECTRUM" desc="PLUGIN_SQUEEZEESP32_SMALL_SPECTRUM_DESC" %] + [% "PLUGIN_SQUEEZEESP32_SMALL_SPECTRUM_SIZE" | string %]  + + [% "PLUGIN_SQUEEZEESP32_SMALL_SPECTRUM_BAND" | string %]  + + [% END %] - [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_FULL_SPECTRUM_BAND" desc="PLUGIN_SQUEEZEESP32_FULL_SPECTRUM_BAND_DESC" %] - - [% END %] + [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_FULL_SPECTRUM_BAND" desc="PLUGIN_SQUEEZEESP32_FULL_SPECTRUM_BAND_DESC" %] + + [% END %] - [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_ARTWORK" desc="PLUGIN_SQUEEZEESP32_ARTWORK_DESC" %] - [% "PLUGIN_SQUEEZEESP32_ARTWORK_ENABLE" | string %]  - - [% "PLUGIN_SQUEEZEESP32_ARTWORK_X" | string %]  - - [% "PLUGIN_SQUEEZEESP32_ARTWORK_Y" | string %]  - - [% END %] + [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_ARTWORK" desc="PLUGIN_SQUEEZEESP32_ARTWORK_DESC" %] + [% "PLUGIN_SQUEEZEESP32_ARTWORK_ENABLE" | string %]  + + [% "PLUGIN_SQUEEZEESP32_ARTWORK_X" | string %]  + + [% "PLUGIN_SQUEEZEESP32_ARTWORK_Y" | string %]  + + [% END %] -
+
+ [% END %] + [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_EQUALIZER" desc="" %] [% END %] diff --git a/plugin/SqueezeESP32/Player.pm b/plugin/SqueezeESP32/Player.pm index a2024151..7e638201 100644 --- a/plugin/SqueezeESP32/Player.pm +++ b/plugin/SqueezeESP32/Player.pm @@ -15,12 +15,6 @@ sub hasIR { 0 } sub init { my $client = shift; - - $prefs->client($client)->init( { - eq => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - } - ); - $client->SUPER::init(@_); Plugins::SqueezeESP32::Plugin::config_artwork($client); } @@ -61,7 +55,6 @@ sub reconnect { my $client = shift; $client->pluginData('artwork_md5', ''); $client->SUPER::reconnect(@_); - Plugins::SqueezeESP32::Plugin::send_equalizer($client); } 1; diff --git a/plugin/SqueezeESP32/PlayerSettings.pm b/plugin/SqueezeESP32/PlayerSettings.pm index 86bc1929..89c2ff7e 100644 --- a/plugin/SqueezeESP32/PlayerSettings.pm +++ b/plugin/SqueezeESP32/PlayerSettings.pm @@ -21,7 +21,7 @@ sub needsClient { sub validFor { my ($class, $client) = @_; - return $client->model eq 'squeezeesp32' && $client->displayWidth; + return $client->model eq 'squeezeesp32'; } sub page { @@ -40,45 +40,51 @@ sub handler { my ($cprefs, @prefs) = $class->prefs($client); if ($paramRef->{'saveSettings'}) { - $cprefs->set('small_VU', $paramRef->{'pref_small_VU'}); - my $spectrum = { scale => $paramRef->{'pref_spectrum_scale'}, - small => { size => $paramRef->{'pref_spectrum_small_size'}, - band => $paramRef->{'pref_spectrum_small_band'} }, - full => { band => $paramRef->{'pref_spectrum_full_band'} }, - }; - $cprefs->set('spectrum', $spectrum); - my $artwork = { enable => $paramRef->{'pref_artwork_enable'}, - x => $paramRef->{'pref_artwork_x'}, - y => $paramRef->{'pref_artwork_y'}, - }; - $cprefs->set('artwork', $artwork); - $client->display->modes($client->display->build_modes); - $client->display->update; + if ($client->displayWidth) { + $cprefs->set('small_VU', $paramRef->{'pref_small_VU'}); + my $spectrum = { scale => $paramRef->{'pref_spectrum_scale'}, + small => { size => $paramRef->{'pref_spectrum_small_size'}, + band => $paramRef->{'pref_spectrum_small_band'} }, + full => { band => $paramRef->{'pref_spectrum_full_band'} }, + }; + $cprefs->set('spectrum', $spectrum); + + my $artwork = { enable => $paramRef->{'pref_artwork_enable'}, + x => $paramRef->{'pref_artwork_x'}, + y => $paramRef->{'pref_artwork_y'}, + }; + $cprefs->set('artwork', $artwork); + $client->display->modes($client->display->build_modes); + $client->display->update; + + # force update or disable artwork + if ($artwork->{'enable'}) { + Plugins::SqueezeESP32::Plugin::update_artwork($client, 1); + } else { + Plugins::SqueezeESP32::Plugin::config_artwork($client); + } + } my $eq = $cprefs->get('eq'); for my $i (0 .. $#{$eq}) { $eq->[$i] = $paramRef->{"pref_eq.$i"}; } $cprefs->set('eq', $eq); - Plugins::SqueezeESP32::Plugin::send_equalizer($client); - - # force update or disable artwork - if ($artwork->{'enable'}) { - Plugins::SqueezeESP32::Plugin::update_artwork($client, 1); - } else { - Plugins::SqueezeESP32::Plugin::config_artwork($client); - } + Plugins::SqueezeESP32::Plugin::send_equalizer($client); } - # as there is nothing captured, we need to re-set these variables - $paramRef->{'pref_width'} = $cprefs->get('width'); + if ($client->displayWidth) { + # as there is nothing captured, we need to re-set these variables + $paramRef->{'pref_width'} = $cprefs->get('width'); + + # here I don't know why you need to set again spectrum which is a reference + # to a hash. Using $paramRef->{prefs} does not work either. It seems that + # some are copies of value, some are references, can't figure out. This whole + # logic of "Settings" is beyond me and I really hate it + $paramRef->{'pref_spectrum'} = $cprefs->get('spectrum'); + $paramRef->{'pref_artwork'} = $cprefs->get('artwork'); + } - # here I don't know why you need to set again spectrum which is a reference - # to a hash. Using $paramRef->{prefs} does not work either. It seems that - # some are copies of value, some are references, can't figure out. This whole - # logic of "Settings" is beyond me and I really hate it - $paramRef->{'pref_spectrum'} = $cprefs->get('spectrum'); - $paramRef->{'pref_artwork'} = $cprefs->get('artwork'); $paramRef->{'pref_eq'} = $cprefs->get('eq'); return $class->SUPER::handler($client, $paramRef); diff --git a/plugin/SqueezeESP32/Plugin.pm b/plugin/SqueezeESP32/Plugin.pm index 3c2ad5b5..ca533c24 100644 --- a/plugin/SqueezeESP32/Plugin.pm +++ b/plugin/SqueezeESP32/Plugin.pm @@ -36,6 +36,7 @@ sub initPlugin { Slim::Control::Request::subscribe( sub { onNotification(@_) }, [ ['newmetadata'] ] ); Slim::Control::Request::subscribe( sub { onNotification(@_) }, [ ['playlist'], ['open', 'newsong'] ]); Slim::Control::Request::subscribe( \&onStopClear, [ ['playlist'], ['stop', 'clear'] ]); + Slim::Control::Request::subscribe( \&onPlayer,[ ['client'], [ 'new', 'reconnect' ] ] ); } sub onStopClear { @@ -50,6 +51,17 @@ sub onStopClear { } } +sub onPlayer { + my $request = shift; + my $client = $request->client; + + if ($client->model eq 'squeezeesp32') { + $prefs->client($client)->init( { + eq => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + } ); + Plugins::SqueezeESP32::Plugin::send_equalizer($client); + } +} sub onNotification { my $request = shift; diff --git a/plugin/SqueezeESP32/install.xml b/plugin/SqueezeESP32/install.xml index 7a9bee38..c3322c4f 100644 --- a/plugin/SqueezeESP32/install.xml +++ b/plugin/SqueezeESP32/install.xml @@ -10,6 +10,6 @@ PLUGIN_SQUEEZEESP32 PLUGIN_SQUEEZEESP32_DESC Plugins::SqueezeESP32::Plugin - 0.81 + 0.82 Philippe diff --git a/plugin/repo.xml b/plugin/repo.xml index 1c888a8d..8fa1d18b 100644 --- a/plugin/repo.xml +++ b/plugin/repo.xml @@ -1,10 +1,10 @@ - + https://github.com/sle118/squeezelite-esp32 Philippe - dcd91eaeb065cf3e90e964ea40a883ed5480093e + 55eb14f12790d71306d143689d9b3d47f9820731 philippe_44@outlook.com SqueezeESP32 additional player id (100) http://github.com/sle118/squeezelite-esp32/raw/master/plugin/SqueezeESP32.zip