2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 07:56:03 +00:00

96_Snapcast.pm:Small Bugfix which prevented automatic Playlist Cycling

git-svn-id: https://svn.fhem.de/fhem/trunk@13192 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
unimatrix 2017-01-22 19:01:40 +00:00
parent ce27576cf5
commit ee1663568e

View File

@ -503,16 +503,15 @@ sub Snapcast_setClient($$$$){
$param="id"; $param="id";
if($value eq "next"){ # just switch to the next stream, if last stream, jump to first one. This way streams can be cycled with a button press if($value eq "next"){ # just switch to the next stream, if last stream, jump to first one. This way streams can be cycled with a button press
my $totalstreams=ReadingsVal($name,"streams",""); my $totalstreams=ReadingsVal($name,"streams","");
my $currentstream = ReadingsVal($name,"clients_".$cnumber."_stream",""); my $currentstream = ReadingsVal($name,"clients_".$id."_stream","");
Log3 $name,3,"SNAP: Current Stream $currentstream";
$currentstream = Snapcast_getStreamNumber($hash,$currentstream); $currentstream = Snapcast_getStreamNumber($hash,$currentstream);
Log3 $name,3,"SNAP: Current Stream $currentstream";
my $newstream = $currentstream+1; my $newstream = $currentstream+1;
$newstream=1 unless $newstream <= $totalstreams; $newstream=1 unless $newstream <= $totalstreams;
while(AttrVal($name, 'streamnext', 'all') eq 'playing' && ReadingsVal($name,"streams_".$newstream."_status","") ne "playing" && $newstream!=$currentstream ) { Log3 $name,3,"SNAP: New Stream $currentstream";
$newstream++;
$newstream=1 unless $newstream <= $totalstreams;
}
$value=ReadingsVal($name,"streams_".$newstream."_id",""); $value=ReadingsVal($name,"streams_".$newstream."_id","");
Log3 $name,3,"SNAP: Value $value";
} }
} }
if($param eq "mute" && (not (defined($value)) || $value eq '')){ if($param eq "mute" && (not (defined($value)) || $value eq '')){