Skip to content

Commit

Permalink
Fix playback of alarm fallback sound.
Browse files Browse the repository at this point in the history
  • Loading branch information
mherger committed Mar 13, 2024
1 parent bc60fe2 commit 81b3ada
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
9 changes: 7 additions & 2 deletions Slim/Plugin/Sounds/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ sub getSortedSounds {
$a->{name} cmp $b->{name}
} map {
my $path = $menus->{$menu->{id}}->{$_};
$validPaths{$path} = 1;
$validPaths{$path} = string("PLUGIN_SOUNDS_$_");
{
name => string("PLUGIN_SOUNDS_$_"),
bitrate => 128,
Expand All @@ -199,7 +199,7 @@ sub getSortedSounds {
delete $menu->{id};
}

main::DEBUGLOG && $log->is_debug && $log->debug(Data::Dump::dump(\@items));
main::DEBUGLOG && $log->is_debug && $log->debug(Data::Dump::dump(\@items, \%validPaths));

$alarmPlaylists = \@playlistItems;
return $soundsMenus = {
Expand All @@ -209,6 +209,11 @@ sub getSortedSounds {
};
}

sub getSoundName {
my ($class, $path) = @_;
return $validPaths{$path =~ s/^loop:\/\///r};
}

sub getStreamUrl {
my ($class, $client, $url) = @_;

Expand Down
3 changes: 2 additions & 1 deletion Slim/Plugin/Sounds/ProtocolHandler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ sub getNextTrack {
}

sub getMetadataFor {
my $class = shift;
my ( $class, $client, $url ) = @_;

my $icon = Slim::Plugin::Sounds::Plugin->_pluginDataFor('icon');

return {
title => Slim::Plugin::Sounds::Plugin->getSoundName($url),
cover => $icon,
icon => $icon,
bitrate => '128k CBR',
Expand Down
14 changes: 1 addition & 13 deletions Slim/Utils/Alarm.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1133,19 +1133,7 @@ sub _playFallback {

my $client = $self->client;

my $url;

my $server = Slim::Utils::Network::serverAddr();
my $port = $prefs->get('httpport');

my $auth = '';
if ( $prefs->get('authorize') ) {
my $password = Slim::Player::Squeezebox::generate_random_string(10);
$client->password($password);
$auth = "squeezeboxXXX:${password}@";
}

$url = "loop://${auth}${server}:${port}/html/slim-backup-alarm.mp3";
my $url = "loop://html/slim-backup-alarm.mp3";

main::DEBUGLOG && $log->is_debug && $log->debug("Starting fallback alarm: $url");

Expand Down

0 comments on commit 81b3ada

Please sign in to comment.