mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 12:07:09 +03:00
add width parameter in plugin
This commit is contained in:
Binary file not shown.
@@ -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;
|
||||
@@ -0,0 +1,11 @@
|
||||
[% PROCESS settings/header.html %]
|
||||
|
||||
<div class="prefDesc">
|
||||
|
||||
[% WRAPPER setting title="PLUGIN_SQUEEZEESP32_WIDTH" desc="PLUGIN_SQUEEZEESP32_WIDTH_DESC" %]
|
||||
<input type="text" class="stdedit" name="pref_width" id="pref_width" value="[% prefs.pref_width %]" size="3">
|
||||
[% END %]
|
||||
|
||||
</div>
|
||||
|
||||
[% PROCESS settings/footer.html %]
|
||||
@@ -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' });
|
||||
|
||||
30
plugin/SqueezeESP32/Settings.pm
Normal file
30
plugin/SqueezeESP32/Settings.pm
Normal file
@@ -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;
|
||||
@@ -10,6 +10,6 @@
|
||||
<name>PLUGIN_SQUEEZEESP32</name>
|
||||
<description>PLUGIN_SQUEEZEESP32_DESC</description>
|
||||
<module>Plugins::SqueezeESP32::Plugin</module>
|
||||
<version>0.3</version>
|
||||
<version>0.4</version>
|
||||
<creator>Philippe</creator>
|
||||
</extensions>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<plugin version="0.3" name="SqueezeESP32" minTarget="7.9" maxTarget="7.*">
|
||||
<link>https://github.com/sle118/squeezelite-esp32</link>
|
||||
<creator>Philippe</creator>
|
||||
<sha>799ae4860f9c009ac25c2ec35eb4070c5f474659</sha>
|
||||
<sha>cec20d0489ed120d56ea2de836c616c7d970c0d5</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>
|
||||
|
||||
Reference in New Issue
Block a user