Initial upload
This commit is contained in:
42
pcurse
Normal file
42
pcurse
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '.';
|
||||
use Data::Dumper;
|
||||
use pcurse;
|
||||
select(STDOUT);
|
||||
$| = 1;
|
||||
my $wowpath = '/mnt/Div/World of Warcraft/_retail_/Interface/AddOns/';
|
||||
my $base_uri = 'http://www.curseforge.com';
|
||||
my $addons_file = $ENV{'HOME'}.'/.pcurse/addons.json';
|
||||
my %opts = pcurse::parse_arguments;
|
||||
my $addons = pcurse::load_addons($addons_file);
|
||||
foreach my $addon(@{$addons}) {
|
||||
print 'Found '.$addon->{'name'}.'('.$addon->{'version'}.')';
|
||||
if(exists($addon->{'uri'})) {
|
||||
#print ' - at '.$addon->{'uri'};
|
||||
my $html = pcurse::html_get($base_uri.$addon->{'uri'});
|
||||
my $fileid = pcurse::get_latest_file_id($html,$addon->{'uri'});
|
||||
if($fileid) {
|
||||
my $version = pcurse::get_product_version($html,$addon->{'uri'},$fileid);
|
||||
print ' - latest version is '.$version;
|
||||
if($version && ($version ne $addon->{'version'})) {
|
||||
print ' - updating';
|
||||
my $ret = 0;
|
||||
#my $ret = pcurse::update($base_uri.$addon->{'uri'},$fileid,$wowpath);
|
||||
if($ret) {
|
||||
print ' - done';
|
||||
$addon->{'version'} = $version;
|
||||
} else {
|
||||
print ' - failed';
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
print 'Could not find product id for '.$addon->{'name'};
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
my ($ret,$msg) = pcurse::save_addons($addons_file,$addons);
|
||||
print $msg."\n" unless($ret);
|
||||
Reference in New Issue
Block a user