Add handling of not finding version to download and add ElvUI hacks where the HTML module fails to parse the whole document.
This commit is contained in:
11
pcurse.pm
11
pcurse.pm
@ -242,7 +242,7 @@ sub find_in_html {
|
|||||||
if(defined($html)) {
|
if(defined($html)) {
|
||||||
my @file = split(/\n/, $html);
|
my @file = split(/\n/, $html);
|
||||||
foreach my $line(@file) {
|
foreach my $line(@file) {
|
||||||
if($line =~ m/$sstring/) {
|
if($line =~ m/$sstring/) {
|
||||||
my $parsed = $parser->parse_balanced_chunk($line);
|
my $parsed = $parser->parse_balanced_chunk($line);
|
||||||
my @nodes = $parsed->nonBlankChildNodes();
|
my @nodes = $parsed->nonBlankChildNodes();
|
||||||
foreach my $node(@nodes) {
|
foreach my $node(@nodes) {
|
||||||
@ -251,7 +251,12 @@ sub find_in_html {
|
|||||||
my $href = $node->getAttribute('href');
|
my $href = $node->getAttribute('href');
|
||||||
$retstr = (split(/$sstring/, $href,2))[1];
|
$retstr = (split(/$sstring/, $href,2))[1];
|
||||||
} elsif($mode eq 'vstring') {
|
} 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);
|
return $retstr if($retstr);
|
||||||
}
|
}
|
||||||
@ -328,6 +333,8 @@ sub init_pool {
|
|||||||
$addon->{'targetversion'} = $version;
|
$addon->{'targetversion'} = $version;
|
||||||
return { retval => 1, did => 'check', addon => $addon };
|
return { retval => 1, did => 'check', addon => $addon };
|
||||||
}
|
}
|
||||||
|
} elsif (! defined($version)) {
|
||||||
|
return { retval => 0, did => 'check', result => 'Could not find version number', addon => $addon };
|
||||||
} else {
|
} else {
|
||||||
return { retval => 0, did => 'check', result => 'No need to update', addon => $addon };
|
return { retval => 0, did => 'check', result => 'No need to update', addon => $addon };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user