From b26c53305cad96e871cdfa29ea903515df0489c6 Mon Sep 17 00:00:00 2001 From: markusbloch <> Date: Fri, 7 Nov 2014 21:39:54 +0000 Subject: [PATCH] YAMAHA_AVR: use non-greedy regexp for XML parsing git-svn-id: https://svn.fhem.de/fhem/trunk@6908 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/71_YAMAHA_AVR.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fhem/FHEM/71_YAMAHA_AVR.pm b/fhem/FHEM/71_YAMAHA_AVR.pm index 938ae0520..b25c0e0a6 100755 --- a/fhem/FHEM/71_YAMAHA_AVR.pm +++ b/fhem/FHEM/71_YAMAHA_AVR.pm @@ -844,7 +844,7 @@ YAMAHA_AVR_ParseResponse ($$$) } elsif($arg eq "systemConfig") { - if($data =~ /(.+?)<\/Model_Name>.*(.+?)<\/System_ID>.*.*
(.+?)<\/Main>.*(.+?)<\/Sub>.*<\/Version>/) + if($data =~ /(.+?)<\/Model_Name>.*(.+?)<\/System_ID>.*.*
(.+?)<\/Main>.*(.+?)<\/Sub>.*?<\/Version>/) { $hash->{MODEL} = $1; $hash->{SYSTEM_ID} = $2; @@ -896,7 +896,7 @@ YAMAHA_AVR_ParseResponse ($$$) } elsif($arg eq "basicStatus") { - if($data =~ /(.+)<\/Power>/) + if($data =~ /(.+?)<\/Power>/) { my $power = $1; @@ -909,7 +909,7 @@ YAMAHA_AVR_ParseResponse ($$$) } # current volume and mute status - if($data =~ /(.+)<\/Val>(.+)<\/Exp>.+<\/Unit><\/Lvl>(.+)<\/Mute>.*<\/Volume>/) + if($data =~ /(.+?)<\/Val>(.+?)<\/Exp>.+?<\/Unit><\/Lvl>(.+?)<\/Mute>.*?<\/Volume>/) { readingsBulkUpdate($hash, "volumeStraight", ($1 / 10 ** $2)); readingsBulkUpdate($hash, "volume", YAMAHA_AVR_volume_abs2rel(($1 / 10 ** $2))); @@ -917,7 +917,7 @@ YAMAHA_AVR_ParseResponse ($$$) $hash->{helper}{USE_SHORT_VOL_CMD} = "0"; } - elsif($data =~ /(.+)<\/Val>(.+)<\/Exp>.+<\/Unit><\/Lvl>(.+)<\/Mute>.*<\/Vol>/) + elsif($data =~ /(.+?)<\/Val>(.+?)<\/Exp>.+?<\/Unit><\/Lvl>(.+?)<\/Mute>.*?<\/Vol>/) { readingsBulkUpdate($hash, "volumeStraight", ($1 / 10 ** $2)); readingsBulkUpdate($hash, "volume", YAMAHA_AVR_volume_abs2rel(($1 / 10 ** $2))); @@ -942,7 +942,7 @@ YAMAHA_AVR_ParseResponse ($$$) } # current input same as the corresponding set command name - if($data =~ /(.+)<\/Input_Sel>/) + if($data =~ /(.+?)<\/Input_Sel>/) { readingsBulkUpdate($hash, "input", YAMAHA_AVR_Param2Fhem(lc($1), 0)); @@ -963,11 +963,11 @@ YAMAHA_AVR_ParseResponse ($$$) } # input name as it is displayed on the receivers front display - if($data =~ /.*?\s*(.+?)\s*<\/Title>.*<\/Input>/) + if($data =~ /<Input>.*?<Title>\s*(.+?)\s*<\/Title>.*?<\/Input>/) { readingsBulkUpdate($hash, "inputName", $1); } - elsif($data =~ /<Input>.*?<Input_Sel_Title>\s*(.+?)\s*<\/Input_Sel_Title>.*<\/Input>/) + elsif($data =~ /<Input>.*?<Input_Sel_Title>\s*(.+?)\s*<\/Input_Sel_Title>.*?<\/Input>/) { readingsBulkUpdate($hash, "inputName", $1); } @@ -987,7 +987,7 @@ YAMAHA_AVR_ParseResponse ($$$) readingsBulkUpdate($hash, "dsp", YAMAHA_AVR_Param2Fhem($1, 0)); } - if($data =~ /<Surround>.*?<_3D_Cinema_DSP>(.+?)<\/_3D_Cinema_DSP>*?<\/Surround>/) + if($data =~ /<Surround>.*?<_3D_Cinema_DSP>(.+?)<\/_3D_Cinema_DSP>.*?<\/Surround>/) { readingsBulkUpdate($hash, "3dCinemaDsp", lc($1)); }