change Master play_previous, change all Modules decode_json in a eval
This commit is contained in:
parent
3a71f505f5
commit
3acc0dc955
@ -38,7 +38,7 @@ use JSON qw(decode_json);
|
||||
use Encode qw(encode_utf8);
|
||||
|
||||
|
||||
my $version = "1.0.0";
|
||||
my $version = "1.0.3";
|
||||
|
||||
|
||||
|
||||
@ -433,8 +433,13 @@ sub HEOSGroup_Parse($$) {
|
||||
my $decode_json;
|
||||
my $code;
|
||||
|
||||
|
||||
$decode_json = eval{decode_json(encode_utf8($json))};
|
||||
if($@){
|
||||
Log3 $name, 3, "HEOSGroup ($name) - JSON error while request: $@";
|
||||
return;
|
||||
}
|
||||
|
||||
$decode_json = decode_json(encode_utf8($json));
|
||||
Log3 $name, 4, "HEOSGroup ($name) - ParseFn wurde aufgerufen";
|
||||
|
||||
if( defined($decode_json->{gid}) ) {
|
||||
|
@ -65,7 +65,7 @@ eval "use Encode;1" or $missingModul .= "Encode ";
|
||||
|
||||
|
||||
|
||||
my $version = "1.0.2";
|
||||
my $version = "1.0.3";
|
||||
|
||||
my %heosCmds = (
|
||||
'enableChangeEvents' => 'system/register_for_change_events?enable=',
|
||||
@ -94,7 +94,7 @@ my %heosCmds = (
|
||||
'setMute' => 'player/set_mute?',
|
||||
'setGroupMute' => 'group/set_mute?',
|
||||
'playNext' => 'player/play_next?',
|
||||
'playPrev' => 'player/play_prev?',
|
||||
'playPrev' => 'player/play_previous?',
|
||||
'playPresetStation' => 'browse/play_preset?',
|
||||
'playInput' => 'browse/play_input?',
|
||||
'playStream' => 'browse/play_stream?',
|
||||
@ -514,7 +514,12 @@ sub HEOSMaster_ProcessRead($$) {
|
||||
|
||||
$hash->{LAST_RECV} = time();
|
||||
Log3 $name, 5, "HEOSMaster ($name) - Decoding JSON message. Length: " . length($json) . " Content: " . $json;
|
||||
my $obj = decode_json($json);
|
||||
|
||||
my $obj = eval{decode_json($json)};
|
||||
if($@){
|
||||
Log3 $name, 3, "HEOSMaster ($name) - JSON error while request: $@";
|
||||
return;
|
||||
}
|
||||
|
||||
if(defined($obj->{heos})) {
|
||||
|
||||
@ -548,7 +553,11 @@ sub HEOSMaster_ResponseProcessing($$) {
|
||||
unless( defined($json));
|
||||
|
||||
Log3 $name, 4, "HEOSMaster ($name) - JSON detected!";
|
||||
$decode_json = decode_json(encode_utf8($json));
|
||||
$decode_json = eval{decode_json(encode_utf8($json))};
|
||||
if($@){
|
||||
Log3 $name, 3, "HEOSMaster ($name) - JSON error while request: $@";
|
||||
return;
|
||||
}
|
||||
|
||||
return Log3 $name, 3, "HEOSMaster ($name) - decode_json has no Hash"
|
||||
unless(ref($decode_json) eq "HASH");
|
||||
|
@ -39,7 +39,7 @@ use Encode qw(encode_utf8);
|
||||
use URI::Escape;
|
||||
#use Data::Dumper;
|
||||
|
||||
my $version = "1.0.2";
|
||||
my $version = "1.0.3";
|
||||
|
||||
|
||||
|
||||
@ -790,8 +790,13 @@ sub HEOSPlayer_Parse($$) {
|
||||
my $decode_json;
|
||||
my $code;
|
||||
|
||||
|
||||
$decode_json = eval{decode_json(encode_utf8($json))};
|
||||
if($@){
|
||||
Log3 $name, 3, "HEOSPlayer ($name) - JSON error while request: $@";
|
||||
return;
|
||||
}
|
||||
|
||||
$decode_json = decode_json(encode_utf8($json));
|
||||
Log3 $name, 4, "HEOSPlayer - ParseFn wurde aufgerufen";
|
||||
if( defined($decode_json->{pid}) ) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user