diverse kleinere Anpassungen und fixes
This commit is contained in:
parent
2eaceb4bb9
commit
ce554402f6
@ -61,12 +61,11 @@ my $missingModul = "";
|
||||
eval "use Net::Telnet;1" or $missingModul .= "Net::Telnet ";
|
||||
eval "use JSON;1" or $missingModul .= "JSON ";
|
||||
eval "use Encode;1" or $missingModul .= "Encode ";
|
||||
eval "use IO::Socket::Multicast;1" or $missingModul .= "IO::Socket::Multicast ";
|
||||
|
||||
|
||||
|
||||
|
||||
my $version = "0.2.0";
|
||||
my $version = "0.2.5";
|
||||
|
||||
my %heosCmds = (
|
||||
'enableChangeEvents' => 'system/register_for_change_events?enable=',
|
||||
@ -365,7 +364,7 @@ sub HEOSMaster_Open($) {
|
||||
my $password = HEOSMaster_ReadPassword($hash);
|
||||
|
||||
|
||||
Log3 $name, 4, "HEOSMaster ($name) - Baue Socket Verbindung auf";
|
||||
Log3 $name, 4, "HEOSMaster ($name) - Build socket connection";
|
||||
|
||||
my $socket = new Net::Telnet ( Host=>$host,
|
||||
Port => $port,
|
||||
@ -463,7 +462,7 @@ sub HEOSMaster_Read($) {
|
||||
|
||||
|
||||
Log3 $name, 4, "HEOSMaster ($name) - ReadFn gestartet";
|
||||
$len = sysread($hash->{CD},$buf,1024); # die genaue Puffergröße wird noch ermittelt
|
||||
$len = sysread($hash->{CD},$buf,1024);
|
||||
|
||||
if( !defined($len) || !$len ) {
|
||||
|
||||
@ -474,7 +473,7 @@ sub HEOSMaster_Read($) {
|
||||
|
||||
unless( defined $buf) {
|
||||
|
||||
Log3 $name, 3, "HEOSMaster ($name) - Keine Daten empfangen";
|
||||
Log3 $name, 3, "HEOSMaster ($name) - no data received";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -515,7 +514,6 @@ sub HEOSMaster_ProcessRead($$) {
|
||||
|
||||
$hash->{LAST_RECV} = time();
|
||||
Log3 $name, 5, "HEOSMaster ($name) - Decoding JSON message. Length: " . length($json) . " Content: " . $json;
|
||||
#my $obj = JSON->new->utf8(0)->decode($json); Änderung unter großem Vorbehalt wegen Sorge was Umlaute an geht!!!
|
||||
my $obj = decode_json($json);
|
||||
|
||||
if(defined($obj->{heos})) {
|
||||
@ -829,18 +827,6 @@ sub HEOSMaster_ResponseProcessing($$) {
|
||||
$ret = "<pre>$ret</pre>" if( $ret =~ m/ / );
|
||||
$ret = "<html>$ret</html>";
|
||||
|
||||
} else {
|
||||
|
||||
#$ret =~ s/<a[^>]*>//g;
|
||||
#$ret =~ s/<\/a>//g;
|
||||
#$ret =~ s/<img[^>]*>\n//g;
|
||||
#$ret =~ s/<div[^>]*>//g;
|
||||
#$ret =~ s/<\/div>//g;
|
||||
#$ret =~ s/<h2[^>]*>//g;
|
||||
#$ret =~ s/<\/h2>//g;
|
||||
#$ret .= "\n";
|
||||
}
|
||||
|
||||
asyncOutput( $hash->{helper}{blocking}{$idx}{cl}, $ret );
|
||||
delete $hash->{helper}{blocking}{$idx};
|
||||
}
|
||||
@ -886,10 +872,6 @@ sub HEOSMaster_ResponseProcessing($$) {
|
||||
my $ret = '';
|
||||
|
||||
$ret .= sprintf( "%-35s %-10s %s\n", 'Fav', 'type', 'title' );
|
||||
#foreach my $item (@{ $hash->{helper}{searchresult}}) {
|
||||
|
||||
# $ret .= HEOSMaster_MakePlayLink($hash->{helper}{blocking}{name}, 'input', $message{sid}, $item, sprintf( "%-35s %-10s %s\n", "x", $item->{type}, $item->{name} ) );
|
||||
#}
|
||||
|
||||
$ret .= "\n\n";
|
||||
|
||||
@ -1079,7 +1061,6 @@ sub HEOSMaster_ParseMsg($$) {
|
||||
foreach my $c (split //, $buffer) {
|
||||
if($open == $close && $open > 0) {
|
||||
$tail .= $c;
|
||||
#Log3 $name, 5, "HEOSMaster ($name) - $open == $close && $open > 0";
|
||||
|
||||
} elsif(($open == $close) && ($c ne '{')) {
|
||||
|
||||
@ -1107,7 +1088,6 @@ sub HEOSMaster_ParseMsg($$) {
|
||||
}
|
||||
}
|
||||
|
||||
#Log3 $name, 5, "HEOSMaster ($name) - return msg: $msg and tail: $tail";
|
||||
return ($msg,$tail);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ use Encode qw(encode_utf8);
|
||||
use URI::Escape;
|
||||
#use Data::Dumper;
|
||||
|
||||
my $version = "0.2.0";
|
||||
my $version = "0.2.5";
|
||||
|
||||
|
||||
|
||||
@ -246,7 +246,6 @@ sub HEOSPlayer_Get($$@) {
|
||||
|
||||
my $param = shift( @args );
|
||||
$param = '' if( !$param );
|
||||
#$param = substr($param,1) if( $param && $param =~ '^|' );
|
||||
|
||||
if ( $param eq '' ) {
|
||||
|
||||
@ -277,7 +276,6 @@ sub HEOSPlayer_Get($$@) {
|
||||
|
||||
$ret .= HEOSPlayer_MakePlayLink($me->{cl}->{TYPE}, $hash->{NAME}, "1029", "heos_service", "Warteschlange", "https://production.ws.skyegloup.com:443/media/images/service/logos/musicsource_logo_playlists.png", 128, 32);
|
||||
|
||||
#$ret .= "\n\n";
|
||||
|
||||
if( $me->{cl}->{TYPE} eq 'FHEMWEB' ) {
|
||||
|
||||
@ -288,28 +286,11 @@ sub HEOSPlayer_Get($$@) {
|
||||
$ret = "<pre>$ret</pre>" if( $ret =~ m/ / );
|
||||
$ret = "<html>$ret</html>";
|
||||
|
||||
} else {
|
||||
|
||||
#$ret =~ s/<h3[^>]*>//g;
|
||||
#$ret =~ s/<\/h3>/\n\n/g;
|
||||
#$ret =~ s/<h5[^>]*>//g;
|
||||
#$ret =~ s/<\/h5>/\n/g;
|
||||
#$ret =~ s/<hr>//g;
|
||||
#$ret =~ s/<a[^>]*>//g;
|
||||
#$ret =~ s/<\/a>//g;
|
||||
#$ret =~ s/<img[^>]*>//g;
|
||||
#$ret =~ s/<div[^>]*>//g;
|
||||
#$ret =~ s/<\/div>//g;
|
||||
#$ret .= "\n";
|
||||
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
||||
} else {
|
||||
|
||||
my ($sid,$cid) = split /,/,$param;
|
||||
#$param=~/^(-?\d+),?(.*)$/;
|
||||
|
||||
if ( $sid eq "1025" ) {
|
||||
|
||||
@ -405,16 +386,6 @@ sub HEOSPlayer_Get($$@) {
|
||||
$ret = "<pre>$ret</pre>" if( $ret =~ m/ / );
|
||||
$ret = "<html>$ret</html>";
|
||||
|
||||
} else {
|
||||
|
||||
#$ret =~ s/<a[^>]*>//g;
|
||||
#$ret =~ s/<\/a>//g;
|
||||
#$ret =~ s/<img[^>]*>\n//g;
|
||||
#$ret =~ s/<div[^>]*>//g;
|
||||
#$ret =~ s/<\/div>//g;
|
||||
#$ret .= "\n";
|
||||
}
|
||||
|
||||
asyncOutput( $me->{cl}, $ret );
|
||||
|
||||
} else {
|
||||
@ -789,7 +760,7 @@ sub HEOSPlayer_Set($$@) {
|
||||
$list .= " playPlaylist:".join(",",@playlists) if( scalar @playlists > 0 );
|
||||
$list .= " deletePlaylist:".join(",",@playlists) if( scalar @playlists > 0 );
|
||||
}
|
||||
#print "List#########################################################\n".Dumper($list);
|
||||
|
||||
$list .= " aux:noArg" if ( exists $hash->{helper}{aux} );
|
||||
return "Unknown argument $cmd, choose one of $list";
|
||||
}
|
||||
@ -913,7 +884,6 @@ sub HEOSPlayer_WriteReadings($$) {
|
||||
my( @index )= grep { $presets[$_] eq $search } 0..$#presets if ( defined $search );
|
||||
|
||||
readingsBulkUpdate( $hash, 'channel', $index[0]+1 ) if ( scalar @index > 0 );
|
||||
#readingsBulkUpdate( $hash, 'state', 'on' );
|
||||
readingsEndUpdate( $hash, 1 );
|
||||
Log3 $name, 5, "HEOSPlayer ($name) - readings set for $name";
|
||||
return undef;
|
||||
|
Loading…
Reference in New Issue
Block a user