diff --git a/plugin/SqueezeESP32.zip b/plugin/SqueezeESP32.zip index 15126a7d..ddffccc8 100644 Binary files a/plugin/SqueezeESP32.zip and b/plugin/SqueezeESP32.zip differ diff --git a/plugin/SqueezeESP32/Graphics.pm b/plugin/SqueezeESP32/Graphics.pm index 03f3aed5..e1a61f9e 100644 --- a/plugin/SqueezeESP32/Graphics.pm +++ b/plugin/SqueezeESP32/Graphics.pm @@ -4,36 +4,42 @@ use strict; use base qw(Slim::Display::Squeezebox2); +use Slim::Utils::Prefs; +use Slim::Utils::Log; + +my $prefs = preferences('plugin.squeezeesp32'); + my $VISUALIZER_NONE = 0; +my $width = $prefs->get('width') || 128; my @modes = ( # mode 0 { desc => ['BLANK'], - bar => 0, secs => 0, width => 128, + bar => 0, secs => 0, width => $width, params => [$VISUALIZER_NONE] }, # mode 1 { desc => ['PROGRESS_BAR'], - bar => 1, secs => 0, width => 128, + bar => 1, secs => 0, width => $width, params => [$VISUALIZER_NONE] }, # mode 2 { desc => ['ELAPSED'], - bar => 0, secs => 1, width => 128, + bar => 0, secs => 1, width => $width, params => [$VISUALIZER_NONE] }, # mode 3 { desc => ['ELAPSED', 'AND', 'PROGRESS_BAR'], - bar => 1, secs => 1, width => 128, + bar => 1, secs => 1, width => $width, params => [$VISUALIZER_NONE] }, # mode 4 { desc => ['REMAINING'], - bar => 0, secs => -1, width => 128, + bar => 0, secs => -1, width => $width, params => [$VISUALIZER_NONE] }, # mode 5 { desc => ['CLOCK'], - bar => 0, secs => 0, width => 128, clock => 1, + bar => 0, secs => 0, width => $width, clock => 1, params => [$VISUALIZER_NONE] }, # mode 6 { desc => ['SETUP_SHOWBUFFERFULLNESS'], - bar => 0, secs => 0, width => 128, fullness => 1, + bar => 0, secs => 0, width => $width, fullness => 1, params => [$VISUALIZER_NONE] }, ); @@ -62,11 +68,11 @@ sub displayHeight { } sub displayWidth { - return shift->widthOverride(@_) || 128; + return shift->widthOverride(@_) || $width; } sub vfdmodel { - return 'graphic-128x32'; + return 'graphic-'.$width.'x32'; } 1; \ No newline at end of file diff --git a/plugin/SqueezeESP32/HTML/EN/plugins/SqueezeESP32/settings/basic.html b/plugin/SqueezeESP32/HTML/EN/plugins/SqueezeESP32/settings/basic.html new file mode 100644 index 00000000..f6cffbe7 --- /dev/null +++ b/plugin/SqueezeESP32/HTML/EN/plugins/SqueezeESP32/settings/basic.html @@ -0,0 +1,11 @@ +[% PROCESS settings/header.html %] + +
+ + [% WRAPPER setting title="PLUGIN_SQUEEZEESP32_WIDTH" desc="PLUGIN_SQUEEZEESP32_WIDTH_DESC" %] + + [% END %] + +
+ +[% PROCESS settings/footer.html %] diff --git a/plugin/SqueezeESP32/Plugin.pm b/plugin/SqueezeESP32/Plugin.pm index 80a074fa..893500b0 100644 --- a/plugin/SqueezeESP32/Plugin.pm +++ b/plugin/SqueezeESP32/Plugin.pm @@ -8,7 +8,9 @@ use Slim::Utils::Log; my $prefs = preferences('plugin.squeezeesp32'); -$prefs->init(); +$prefs->init({ + width => 128, +}); my $log = Slim::Utils::Log->addLogCategory({ 'category' => 'plugin.squeezeesp32', @@ -18,6 +20,11 @@ my $log = Slim::Utils::Log->addLogCategory({ sub initPlugin { my $class = shift; + + if ( main::WEBUI ) { + require Plugins::SqueezeESP32::Settings; + Plugins::SqueezeESP32::Settings->new; + } $class->SUPER::initPlugin(@_); Slim::Networking::Slimproto::addPlayerClass($class, 100, 'squeezeesp32', { client => 'Plugins::SqueezeESP32::Player', display => 'Plugins::SqueezeESP32::Graphics' }); diff --git a/plugin/SqueezeESP32/Settings.pm b/plugin/SqueezeESP32/Settings.pm new file mode 100644 index 00000000..0281fb07 --- /dev/null +++ b/plugin/SqueezeESP32/Settings.pm @@ -0,0 +1,30 @@ +package Plugins::SqueezeESP32::Settings; +use base qw(Slim::Web::Settings); + +use strict; + +use Slim::Utils::Prefs; +use Slim::Utils::Log; + +my $log = logger('plugin.SqueezeESP32'); + +sub name { + return 'PLUGIN_SQUEEZEESP32'; +} + +sub page { + return 'plugins/SqueezeESP32/settings/basic.html'; +} + +sub prefs { + return (preferences('plugin.SqueezeESP32'), qw(width)); +} + +sub handler { + my ($class, $client, $params, $callback, @args) = @_; + + $callback->($client, $params, $class->SUPER::handler($client, $params), @args); +} + + +1; diff --git a/plugin/SqueezeESP32/install.xml b/plugin/SqueezeESP32/install.xml index 626fd90d..544f5917 100644 --- a/plugin/SqueezeESP32/install.xml +++ b/plugin/SqueezeESP32/install.xml @@ -10,6 +10,6 @@ PLUGIN_SQUEEZEESP32 PLUGIN_SQUEEZEESP32_DESC Plugins::SqueezeESP32::Plugin - 0.3 + 0.4 Philippe diff --git a/plugin/SqueezeESP32/strings.txt b/plugin/SqueezeESP32/strings.txt index 2009781f..b2c86fb6 100644 --- a/plugin/SqueezeESP32/strings.txt +++ b/plugin/SqueezeESP32/strings.txt @@ -2,8 +2,11 @@ WELCOME_TO_SQUEEZEESP32 EN Welcome to SqueezeESP32 PLUGIN_SQUEEZEESP32 - SqueezeESP32 + EN SqueezeESP32 PLUGIN_SQUEEZEESP32_DESC - Adds a new player id (100) to enable display with SqueezeESP32 + EN Adds a new player id (100) to enable display with SqueezeESP32 + +PLUGIN_SQUEEZEESP32_WIDTH + EN Screen width \ No newline at end of file diff --git a/plugin/repo.xml b/plugin/repo.xml index 5d67e7c1..3eb8842d 100644 --- a/plugin/repo.xml +++ b/plugin/repo.xml @@ -4,7 +4,7 @@ https://github.com/sle118/squeezelite-esp32 Philippe - 799ae4860f9c009ac25c2ec35eb4070c5f474659 + cec20d0489ed120d56ea2de836c616c7d970c0d5 philippe_44@outlook.com SqueezeESP32 additional player id (100) http://github.com/sle118/squeezelite-esp32/raw/master/plugin/SqueezeESP32.zip