mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-12 06:27:12 +03:00
better screensaver handling - release
This commit is contained in:
@@ -42,7 +42,10 @@ sub new {
|
||||
|
||||
$display->init_accessor(
|
||||
modes => $display->build_modes,
|
||||
vfdmodel => 'graphic-<width>x32', # doesn't matter much
|
||||
# Only seems to matter for screensaver and update to decide font. Not
|
||||
# any value is acceptable, so use Boom value which seems to be best
|
||||
# compromise
|
||||
vfdmodel => 'graphic-160x32',
|
||||
);
|
||||
|
||||
return $display;
|
||||
|
||||
@@ -13,6 +13,12 @@ sub model { 'squeezeesp32' }
|
||||
sub modelName { 'SqueezeESP32' }
|
||||
sub hasIR { 0 }
|
||||
|
||||
sub init {
|
||||
my $client = shift;
|
||||
$client->SUPER::init(@_);
|
||||
Plugins::SqueezeESP32::Plugin::config_artwork($client);
|
||||
}
|
||||
|
||||
# Allow the player to define it's display width (and probably more)
|
||||
sub playerSettingsFrame {
|
||||
my $client = shift;
|
||||
|
||||
@@ -59,7 +59,7 @@ sub handler {
|
||||
if ($artwork->{'enable'}) {
|
||||
Plugins::SqueezeESP32::Plugin::update_artwork($client, 1);
|
||||
} else {
|
||||
Plugins::SqueezeESP32::Plugin::disable_artwork($client);
|
||||
Plugins::SqueezeESP32::Plugin::config_artwork($client);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ sub onNotification {
|
||||
|
||||
sub update_artwork {
|
||||
my $client = shift;
|
||||
my $force = shift || 0;
|
||||
my $params = { force => shift || 0 };
|
||||
my $cprefs = $prefs->client($client);
|
||||
my $artwork = $cprefs->get('artwork');
|
||||
|
||||
@@ -60,17 +60,17 @@ sub update_artwork {
|
||||
$s = min($s, $cprefs->get('width') - $artwork->{'x'});
|
||||
|
||||
my $path = 'music/current/cover_' . $s . 'x' . $s . '_o.jpg';
|
||||
my $body = Slim::Web::Graphics::artworkRequest($client, $path, $force, \&send_artwork, undef, HTTP::Response->new);
|
||||
my $body = Slim::Web::Graphics::artworkRequest($client, $path, $params, \&send_artwork, undef, HTTP::Response->new);
|
||||
|
||||
send_artwork($client, undef, \$body) if $body;
|
||||
}
|
||||
|
||||
sub send_artwork {
|
||||
my ($client, $force, $dataref) = @_;
|
||||
my ($client, $params, $dataref) = @_;
|
||||
|
||||
# I'm not sure why we are called so often, so only send when needed
|
||||
my $md5 = md5($$dataref);
|
||||
return if $client->pluginData('artwork_md5') eq $md5 && !$force;
|
||||
return if $client->pluginData('artwork_md5') eq $md5 && !$params->{'force'};
|
||||
|
||||
$client->pluginData('artwork', $dataref);
|
||||
$client->pluginData('artwork_md5', $md5);
|
||||
@@ -95,9 +95,10 @@ sub send_artwork {
|
||||
}
|
||||
}
|
||||
|
||||
sub disable_artwork {
|
||||
sub config_artwork {
|
||||
my ($client) = @_;
|
||||
my $header = pack('N', 0);
|
||||
my $artwork = $prefs->client($client)->get('artwork');
|
||||
my $header = pack('Nnn', $artwork->{'enable'}, $artwork->{'x'}, $artwork->{'y'});
|
||||
$client->sendFrame( grfa => \$header );
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
<name>PLUGIN_SQUEEZEESP32</name>
|
||||
<description>PLUGIN_SQUEEZEESP32_DESC</description>
|
||||
<module>Plugins::SqueezeESP32::Plugin</module>
|
||||
<version>0.50</version>
|
||||
<version>0.51</version>
|
||||
<creator>Philippe</creator>
|
||||
</extensions>
|
||||
|
||||
Reference in New Issue
Block a user