From: Andrew Ruthven Date: Wed, 28 Nov 2007 17:45:34 +0000 (+1300) Subject: Try and make the XML recovery a bit more silent, but provide a verbose option to... X-Git-Tag: 0.5.2~3 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b0b9a73dd1c0d829849353bc15c191999f163be;p=mythtv-status.git Try and make the XML recovery a bit more silent, but provide a verbose option to enable it. --- diff --git a/bin/mythtv-status b/bin/mythtv-status index 97d37f9..6d533b9 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -28,6 +28,7 @@ my @email; my $email_only_on_conflict = 0; my $help = undef; my $xml_file = undef; +my $verbose = 0; my $VERSION = '0.5.1'; @@ -49,6 +50,7 @@ GetOptions( 'file=s' => \$xml_file, + 'verbose' => \$verbose, 'help|?' => \$help, ) || pod2usage("\nUse --help for help.\n"); @@ -296,7 +298,13 @@ sub load_xml { # Parse the XML my $parser = XML::LibXML->new(); + + # Some XML data seems to have badness in it, including non-existant + # UTF-8 characters. We'll try and recover. $parser->recover(1); + $parser->recover_silently(1) + unless $verbose; + my $xml = eval { $parser->parse_string( $status ) }; if ($@) { @@ -497,6 +505,11 @@ Suppress displaying blocks of the output if they would normally be displayed. The port to use when connecting to MythTV, defaults to 6544. +=item B<--verbose> + +Have slightly more verbose output. This includes any warnings that might +be generated while parsing the XML. + =item B<-v, --version> Show the version of mythtv-status and then exit.