mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
contrib/55_GDS.2015:
perl Packages LWP:.* no longer needed git-svn-id: https://svn.fhem.de/fhem/trunk@9400 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
dcab43f49e
commit
a3518cb78a
@ -1,4 +1,4 @@
|
|||||||
# $Id: 55_GDS.pm 9298 2015-09-24 20:57:33Z betateilchen $
|
# $Id: 55_GDS.pm 2015 2015-10-07 00:00:00Z betateilchen $
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
#
|
#
|
||||||
# 55_GDS.pm
|
# 55_GDS.pm
|
||||||
@ -30,14 +30,14 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use feature qw/say switch/;
|
use feature qw/say switch/;
|
||||||
use Time::HiRes qw(gettimeofday);
|
use Time::HiRes qw(gettimeofday);
|
||||||
use Data::Dumper;
|
|
||||||
use Archive::Zip;
|
|
||||||
use Text::CSV;
|
use Text::CSV;
|
||||||
use Net::FTP;
|
use Net::FTP;
|
||||||
use List::MoreUtils 'first_index';
|
use List::MoreUtils 'first_index';
|
||||||
use XML::Simple;
|
use XML::Simple;
|
||||||
#require LWP::UserAgent;
|
use Archive::Zip;
|
||||||
require LWP::Parallel::UserAgent;
|
|
||||||
|
#use POE qw( Component::Client::SimpleFTP );
|
||||||
|
#use Data::Dumper;
|
||||||
|
|
||||||
no if $] >= 5.017011, warnings => 'experimental';
|
no if $] >= 5.017011, warnings => 'experimental';
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ my $tempDir = "/tmp/";
|
|||||||
#
|
#
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
|
|
||||||
sub unzipCapFile;
|
#sub unzipCapFile;
|
||||||
|
|
||||||
sub GDS_Initialize($) {
|
sub GDS_Initialize($) {
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
@ -334,12 +334,13 @@ sub GDS_Get($@) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
when("rereadcfg"){
|
when("rereadcfg"){
|
||||||
|
eval {
|
||||||
|
retrieveFile($hash,"alerts");
|
||||||
|
};
|
||||||
eval {
|
eval {
|
||||||
retrieveFile($hash,"conditions");
|
retrieveFile($hash,"conditions");
|
||||||
};
|
};
|
||||||
eval {
|
sleep(5);
|
||||||
retrieveFile($hash,"alerts");
|
|
||||||
};
|
|
||||||
initDropdownLists($hash);
|
initDropdownLists($hash);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -661,6 +662,7 @@ sub buildCAPList(@){
|
|||||||
|
|
||||||
# write the big XML file
|
# write the big XML file
|
||||||
my $cF = $destinationDirectory."/gds_alerts";
|
my $cF = $destinationDirectory."/gds_alerts";
|
||||||
|
unlink $cF if -e $cF;
|
||||||
my $err = FileWrite({ FileName=>$cF,ForceType=>"file" },@alertsArray);
|
my $err = FileWrite({ FileName=>$cF,ForceType=>"file" },@alertsArray);
|
||||||
|
|
||||||
# make XML array
|
# make XML array
|
||||||
@ -1109,18 +1111,6 @@ sub retrieveFile($$;$$){
|
|||||||
my ($dwd, $dir, $ftp, @files, $dataFile, $targetFile, $found, $readingName);
|
my ($dwd, $dir, $ftp, @files, $dataFile, $targetFile, $found, $readingName);
|
||||||
|
|
||||||
my $urlString = "ftp://$user:$pass\@ftp-outgoing2.dwd.de/";
|
my $urlString = "ftp://$user:$pass\@ftp-outgoing2.dwd.de/";
|
||||||
my $ua;
|
|
||||||
eval { $ua = LWP::Parallel::UserAgent->new; };
|
|
||||||
|
|
||||||
if(!defined($ua)) {
|
|
||||||
Log3($name, 1, "GDS $name: LWP not available!");
|
|
||||||
readingsSingleUpdate($hash, 'LWP error', 'LWP not available!',1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ua->timeout(10);
|
|
||||||
$ua->env_proxy;
|
|
||||||
$ua->nonblock("true");
|
|
||||||
|
|
||||||
given($request){
|
given($request){
|
||||||
|
|
||||||
@ -1214,7 +1204,7 @@ sub retrieveFile($$;$$){
|
|||||||
$dataFile = $files[-1];
|
$dataFile = $files[-1];
|
||||||
$urlString .= $dataFile;
|
$urlString .= $dataFile;
|
||||||
Log3($name, 4, "GDS $name: retrieving $dataFile");
|
Log3($name, 4, "GDS $name: retrieving $dataFile");
|
||||||
$ua->get($urlString,':content_file' => $targetFile);
|
$ftp->get($dataFile,$targetFile);
|
||||||
} else {
|
} else {
|
||||||
Log3($name, 4, "GDS $name: filelist not found.");
|
Log3($name, 4, "GDS $name: filelist not found.");
|
||||||
$found = 0;
|
$found = 0;
|
||||||
@ -1230,6 +1220,32 @@ sub retrieveFile($$;$$){
|
|||||||
return ($dataFile, $found);
|
return ($dataFile, $found);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub gdsFtp_authenticated {
|
||||||
|
Debug "authenticated";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub gdsFtp_getconnected {
|
||||||
|
Debug "getconnected";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub gdsFtp_getdata {
|
||||||
|
Debug "getdata";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub gdsFtp_getdone {
|
||||||
|
Debug "getdone";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub gdsFtp_size {
|
||||||
|
Debug "size";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub getListStationsDropdown($){
|
sub getListStationsDropdown($){
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user