diff --git a/plugin/SqueezeESP32.zip b/plugin/SqueezeESP32.zip
index 9c205293..a13bded0 100644
Binary files a/plugin/SqueezeESP32.zip and b/plugin/SqueezeESP32.zip differ
diff --git a/plugin/SqueezeESP32/Player.pm b/plugin/SqueezeESP32/Player.pm
index 78eba318..ef25eeec 100644
--- a/plugin/SqueezeESP32/Player.pm
+++ b/plugin/SqueezeESP32/Player.pm
@@ -91,12 +91,19 @@ sub init {
}
$client->SUPER::init(@_);
- $client->config_artwork;
-}
+ main::INFOLOG && $log->is_info && $log->info("SqueezeESP player connected: " . $client->id);
+}
sub initPrefs {
my $client = shift;
+
$sprefs->client($client)->init($defaultPrefs);
+
+ $prefs->client($client)->init( {
+ equalizer => [(0) x 10],
+ artwork => 0,
+ } );
+
$client->SUPER::initPrefs;
}
@@ -146,6 +153,15 @@ sub treble {
return $value;
}
+sub send_equalizer {
+ my ($client, $equalizer) = @_;
+
+ $equalizer ||= $prefs->client($client)->get('equalizer') || [(0) x 10];
+ my $size = @$equalizer;
+ my $data = pack("c[$size]", @{$equalizer});
+ $client->sendFrame( eqlz => \$data );
+}
+
sub update_equalizer {
my ($client, $value, $index) = @_;
return if $client->tone_update;
@@ -240,8 +256,11 @@ sub config_artwork {
sub reconnect {
my $client = shift;
- $client->pluginData('artwork_md5', '');
$client->SUPER::reconnect(@_);
+
+ $client->pluginData('artwork_md5', '');
+ $client->config_artwork;
+ $client->send_equalizer;
}
# Change the analog output mode between headphone and sub-woofer
diff --git a/plugin/SqueezeESP32/PlayerSettings.pm b/plugin/SqueezeESP32/PlayerSettings.pm
index cde4bb0c..d4a4e2d6 100644
--- a/plugin/SqueezeESP32/PlayerSettings.pm
+++ b/plugin/SqueezeESP32/PlayerSettings.pm
@@ -31,7 +31,7 @@ sub page {
sub prefs {
my ($class, $client) = @_;
my @prefs;
- push @prefs, qw(width small_VU) if defined $client->displayWidth;
+ push @prefs, qw(width small_VU) if $client->displayWidth;
return ($prefs->client($client), @prefs);
}
@@ -41,7 +41,7 @@ sub handler {
my ($cprefs, @prefs) = $class->prefs($client);
if ($paramRef->{'saveSettings'}) {
- if (defined $client->displayWidth) {
+ if ($client->displayWidth) {
$cprefs->set('small_VU', $paramRef->{'pref_small_VU'} || 15);
my $spectrum = {
scale => $paramRef->{'pref_spectrum_scale'} || 25,
@@ -76,7 +76,7 @@ sub handler {
$client->update_tones($equalizer);
}
- if (defined $client->displayWidth) {
+ if ($client->displayWidth) {
# the Settings super class can't handle anything but scalar values
# we need to populate the $paramRef for the other prefs manually
$paramRef->{'pref_spectrum'} = $cprefs->get('spectrum');
diff --git a/plugin/SqueezeESP32/Plugin.pm b/plugin/SqueezeESP32/Plugin.pm
index e2b13573..007f65f4 100644
--- a/plugin/SqueezeESP32/Plugin.pm
+++ b/plugin/SqueezeESP32/Plugin.pm
@@ -25,7 +25,7 @@ $prefs->migrateClient(1, sub {
});
$prefs->setChange(sub {
- send_equalizer($_[2]);
+ $_[2]->send_equalizer;
}, 'equalizer');
sub initPlugin {
@@ -40,8 +40,10 @@ sub initPlugin {
}
$class->SUPER::initPlugin(@_);
- Slim::Networking::Slimproto::addPlayerClass($class, 100, 'squeezeesp32', { client => 'Plugins::SqueezeESP32::Player', display => 'Plugins::SqueezeESP32::Graphics' });
- main::INFOLOG && $log->is_info && $log->info("Added class 100 for SqueezeESP32");
+ # no name can be a subset of others due to a bug in addPlayerClass
+ Slim::Networking::Slimproto::addPlayerClass($class, 100, 'squeezeesp32-basic', { client => 'Plugins::SqueezeESP32::Player', display => 'Plugins::SqueezeESP32::Graphics' });
+ Slim::Networking::Slimproto::addPlayerClass($class, 101, 'squeezeesp32-graphic', { client => 'Plugins::SqueezeESP32::Player', display => 'Slim::Display::NoDisplay' });
+ main::INFOLOG && $log->is_info && $log->info("Added class 100 and 101 for SqueezeESP32");
# register a command to set the EQ - without saving the values! Send params as single comma separated list of values
Slim::Control::Request::addDispatch(['squeezeesp32', 'seteq', '_eq'], [1, 0, 0, \&setEQ]);
@@ -50,9 +52,6 @@ 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'] ]);
-
- # the custom player class is only initialized if it has a display - thus we need to listen to connect events in order to initializes other player prefs
- Slim::Control::Request::subscribe( \&onPlayer,[ ['client'], [ 'new', 'reconnect' ] ] );
}
sub onStopClear {
@@ -64,20 +63,6 @@ sub onStopClear {
}
}
-sub onPlayer {
- my $request = shift;
- my $client = $request->client || return;
-
- if ($client->model eq 'squeezeesp32') {
- main::INFOLOG && $log->is_info && $log->info("SqueezeESP player connected: " . $client->id);
-
- $prefs->client($client)->init( {
- equalizer => [(0) x 10],
- } );
- send_equalizer($client);
- }
-}
-
sub onNotification {
my $request = shift;
my $client = $request->client || return;
@@ -104,18 +89,7 @@ sub setEQ {
$eqParams[$x] ||= 0;
}
- send_equalizer($client, \@eqParams);
-}
-
-sub send_equalizer {
- my ($client, $equalizer) = @_;
-
- if ($client->model eq 'squeezeesp32') {
- $equalizer ||= $prefs->client($client)->get('equalizer') || [(0) x 10];
- my $size = @$equalizer;
- my $data = pack("c[$size]", @{$equalizer});
- $client->sendFrame( eqlz => \$data );
- }
+ $client->send_equalizer(\@eqParams);
}
1;
diff --git a/plugin/SqueezeESP32/install.xml b/plugin/SqueezeESP32/install.xml
index ef8c3894..59a0ca49 100644
--- a/plugin/SqueezeESP32/install.xml
+++ b/plugin/SqueezeESP32/install.xml
@@ -10,6 +10,6 @@
PLUGIN_SQUEEZEESP32
PLUGIN_SQUEEZEESP32_DESC
Plugins::SqueezeESP32::Plugin
- 0.104
+ 0.201
Philippe
diff --git a/plugin/repo.xml b/plugin/repo.xml
index a9a90fa7..19917eec 100644
--- a/plugin/repo.xml
+++ b/plugin/repo.xml
@@ -1,10 +1,10 @@
-
+
https://github.com/sle118/squeezelite-esp32
Philippe
- ab2d65f5ba8e73f0f78a1a8650af19ebb1e8e724
+ c7134a3f03fbb836c48c929700ad7765854644f7
philippe_44@outlook.com
SqueezeESP32 additional player id (100)
http://github.com/sle118/squeezelite-esp32/raw/master/plugin/SqueezeESP32.zip