Skip to content

Commit f1d7740

Browse files
authored
Merge pull request #9 from bpa-code/master
1.7.5 Update - bug fix & binaries update
2 parents 8de2d26 + 23d5ea7 commit f1d7740

File tree

11 files changed

+46
-14
lines changed

11 files changed

+46
-14
lines changed
0 Bytes
Binary file not shown.
-5.5 KB
Binary file not shown.
-43.9 KB
Binary file not shown.

Bin/armhf-linux/squeezelite-armhf

174 KB
Binary file not shown.

Bin/darwin/squeezelite-arm64

16.4 KB
Binary file not shown.

Bin/darwin/squeezelite-osx

8.2 KB
Binary file not shown.

Bin/i386-linux/squeezelite-i386

4 KB
Binary file not shown.
92.5 KB
Binary file not shown.

Settings.pm

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ use strict;
55
use base qw(Slim::Web::Settings);
66

77
use Slim::Utils::Prefs;
8+
use Slim::Utils::Log;
89

910
my $prefs = preferences('plugin.localplayer');
11+
my $log = logger('plugin.localplayer');
1012

1113
sub name { 'PLUGIN_LOCALPLAYER' }
1214

@@ -78,22 +80,30 @@ sub handler2 {
7880
$params->{'running'} = Plugins::LocalPlayer::Squeezelite->alive;
7981

8082
my $path = Slim::Utils::Misc::findbin($bin);
83+
8184
if ($path) {
82-
if (my $options = `$path -?`) {
83-
# extract descriptions for server address, name, and MAC address
85+
my $options = `$path -?`;
86+
if ($?) {
87+
$log->error("Failed to get squeezelite options - error code: $?");
88+
}
89+
90+
if ($options) {
91+
# extract descriptions for server address, name, and MAC address
8492
while ($options =~ /(^\s+-[smn]\s+.+\n)/mg) {
8593
$params->{'optionsTable'} .= $1;
8694
}
8795
}
8896
}
8997

9098
my $devices = Plugins::LocalPlayer::Squeezelite->devices($path);
91-
unshift @$devices, { name => '', desc => "Default" };
92-
99+
if ( scalar(@$devices)) {
100+
unshift @$devices, { name => '', desc => "Default" };
101+
} else {
102+
unshift @$devices, { name => '', desc => "No output devices" };
103+
}
93104
$params->{'devices'} = $devices;
94105

95106
} else {
96-
97107
$params->{'running'} = 0;
98108
}
99109

Squeezelite.pm

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ sub binaries {
2222
return @binaries if !$update && scalar @binaries;
2323

2424
my $os = Slim::Utils::OSDetect::details();
25+
$log->debug(' OS details; OS :"'.$os->{'os'} .'" Arch:"'. $os->{'osArch'}. '" BinArch:"'. $os->{'binArch'}.'"');
2526

2627
if (main::ISMAC) {
2728
@binaries = qw(squeezelite-osx squeezelite-arm64);
@@ -31,13 +32,22 @@ sub binaries {
3132
@binaries = qw(squeezelite-x64 squeezelite-win);
3233
}
3334
elsif ($os->{'os'} eq 'Linux') {
34-
if ($os->{'osArch'} =~ /x86_64/) {
35+
36+
# Some Linux OS examples
37+
# OS :"Linux" Arch:"aarch64-linux" BinArch:"aarch64-linux"
38+
# OS :"Linux" Arch:"x86_64-linux" BinArch:"i386-linux"
39+
# OS :"Linux" Arch:"armv7l-linux" BinArch:"armhf-linux"
40+
41+
if ($os->{'osArch'} =~ /^x86_64/i) {
3542
@binaries = qw(squeezelite-x86-64);
3643
}
37-
if ($os->{'binArch'} =~ /i386/) {
44+
elsif ($os->{'binArch'} =~ /^i386/i) {
3845
@binaries = qw(squeezelite-i386);
3946
}
40-
if ($os->{'binArch'} =~ /arm/) {
47+
elsif ($os->{'binArch'} =~ /^aarch64/) {
48+
@binaries = qw(squeezelite-aarch64);
49+
}
50+
elsif ($os->{'binArch'} =~ /^arm/) {
4151
@binaries = qw(squeezelite-armhf squeezelite-aarch64);
4252
}
4353
else {
@@ -132,14 +142,17 @@ sub start {
132142
eval { $squeezelite = Proc::Background->new({ 'die_upon_destroy' => 1 }, $path, @params); };
133143

134144
if ($@) {
135-
136145
$log->warn($@);
137-
138146
} else {
139147
Slim::Utils::Timers::setTimer($class, Time::HiRes::time() + 1, sub {
140-
if ($squeezelite && $squeezelite->alive) {
141-
$log->debug("$bin running");
142-
$binary = $path;
148+
if ($squeezelite ) {
149+
if ( $squeezelite->alive) {
150+
$log->debug("$bin running");
151+
$binary = $path;
152+
} else {
153+
$log->error("Squeezelite has not started or crashed: $bin");
154+
$log->error("Enable Squeezelite logging in LocalPlayer Settings and check squeezelite log");
155+
}
143156
}
144157
});
145158
}
@@ -173,6 +186,15 @@ sub devices {
173186

174187
# run "squeezelite -l" to get devices and parse result
175188
my @devices = `$myBinary -l`;
189+
if ($?) {
190+
$log->error("Squeezelite failed to get list of output devices. Eeror code:". $?);
191+
return;
192+
}
193+
194+
if (scalar(@devices) == 0) {
195+
$log->error("No output devices found. Command: $myBinary -l ");
196+
return;
197+
}
176198

177199
main::INFOLOG && $log->is_info && $log->info("Getting devices for $myBinary");
178200
main::DEBUGLOG && $log->is_debug && $log->debug(@devices);

0 commit comments

Comments
 (0)