Browse Source

0.220

Clear artwork when power off
Philippe G 4 years ago
parent
commit
874abb99ed

BIN
plugin/SqueezeESP32.zip


+ 20 - 4
plugin/SqueezeESP32/Player.pm

@@ -107,6 +107,22 @@ sub initPrefs {
 	$client->SUPER::initPrefs;
 }
 
+sub power {
+	my $client = shift;
+	my $on     = shift;
+
+	my $res = $client->SUPER::power($on, @_);
+	return $res unless defined $on;
+	
+	if ($on) {
+		$client->update_artwork(1);
+	} else {
+		$client->clear_artwork(1);
+	}
+	
+	return $res;
+}	
+
 # Allow the player to define it's display width (and probably more)
 sub playerSettingsFrame {
 	my $client   = shift;
@@ -232,16 +248,16 @@ sub send_artwork {
 }
 
 sub clear_artwork {
-	my ($client, $request) = @_;
+	my ($client, $force, $from) = @_;
 
 	my $artwork = $prefs->client($client)->get('artwork');
 
 	if ($artwork && $artwork->{'enable'}) {
-		main::INFOLOG && $log->is_info && $log->info("artwork stop/clear " . $request->getRequestString());
+		main::INFOLOG && $log->is_info && $log->info("artwork stop/clear " . ($from || ""));
 		$client->pluginData('artwork_md5', '');
 		# refresh screen and disable artwork when artwork was full screen (hack)
-		if (!$artwork->{'x'} && !$artwork->{'y'}) {
-			$client->sendFrame(grfa => \("\x00"x4)) unless $artwork->{'x'} || $artwork->{'y'};
+		if ((!$artwork->{'x'} && !$artwork->{'y'}) || $force) {
+			$client->sendFrame(grfa => \("\x00"x4));
 			$client->display->update;
 		}	
 	}

+ 1 - 1
plugin/SqueezeESP32/Plugin.pm

@@ -65,7 +65,7 @@ sub onStopClear {
 	my $client  = $request->client || return;
 
 	if ($client->isa('Plugins::SqueezeESP32::Player')) {
-		$client->clear_artwork($request);
+		$client->clear_artwork(0, $request->getRequestString());
 	}
 }
 

+ 1 - 1
plugin/SqueezeESP32/install.xml

@@ -10,6 +10,6 @@
   <name>PLUGIN_SQUEEZEESP32</name>
   <description>PLUGIN_SQUEEZEESP32_DESC</description>
   <module>Plugins::SqueezeESP32::Plugin</module>
-    <version>0.211</version>
+    <version>0.220</version>
   <creator>Philippe</creator>
 </extensions>

+ 2 - 2
plugin/repo.xml

@@ -1,10 +1,10 @@
 <?xml version='1.0' standalone='yes'?>
 <extensions>
   <plugins>
-    <plugin version="0.211" name="SqueezeESP32" minTarget="7.9" maxTarget="*">
+    <plugin version="0.220" name="SqueezeESP32" minTarget="7.9" maxTarget="*">
       <link>https://github.com/sle118/squeezelite-esp32</link>
       <creator>Philippe</creator>
-      <sha>c33af63de1c2e799a05352708b9f5db9e8d1102a</sha>
+      <sha>e279e31acf8c91652d32bdf6165db21961ea780d</sha>
       <email>philippe_44@outlook.com</email>
       <desc lang="EN">SqueezeESP32 additional player id (100)</desc>
       <url>http://github.com/sle118/squeezelite-esp32/raw/master/plugin/SqueezeESP32.zip</url>