From b3e5b7ba8694156afc97633c634682feb9ee7b8b Mon Sep 17 00:00:00 2001 From: Daniel Lysfjord Date: Sun, 19 Jan 2020 17:12:14 +0100 Subject: [PATCH] Add handling of not finding version to download and add ElvUI hacks where the HTML module fails to parse the whole document. --- pcurse.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pcurse.pm b/pcurse.pm index bc78e0b..599418d 100644 --- a/pcurse.pm +++ b/pcurse.pm @@ -242,7 +242,7 @@ sub find_in_html { if(defined($html)) { my @file = split(/\n/, $html); foreach my $line(@file) { - if($line =~ m/$sstring/) { + if($line =~ m/$sstring/) { my $parsed = $parser->parse_balanced_chunk($line); my @nodes = $parsed->nonBlankChildNodes(); foreach my $node(@nodes) { @@ -251,7 +251,12 @@ sub find_in_html { my $href = $node->getAttribute('href'); $retstr = (split(/$sstring/, $href,2))[1]; } elsif($mode eq 'vstring') { - $retstr = $node->getAttribute('data-name'); + if($sstring =~ m/downloads/) { #ElvUI hacks + $retstr = $node->getAttribute('href'); + $retstr =~ s/$sstring//g; + } else { + $retstr = $node->getAttribute('data-name'); + } } return $retstr if($retstr); } @@ -328,6 +333,8 @@ sub init_pool { $addon->{'targetversion'} = $version; return { retval => 1, did => 'check', addon => $addon }; } + } elsif (! defined($version)) { + return { retval => 0, did => 'check', result => 'Could not find version number', addon => $addon }; } else { return { retval => 0, did => 'check', result => 'No need to update', addon => $addon }; }