mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
zwavealliance.images.parse: Delete unused images
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@16152 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
f857adcb33
commit
388481b09b
@ -5,7 +5,7 @@
|
|||||||
# Usage: zwavealliance.images.parse downloaddir
|
# Usage: zwavealliance.images.parse downloaddir
|
||||||
# Downloaddir is filled with the following script:
|
# Downloaddir is filled with the following script:
|
||||||
# i=1
|
# i=1
|
||||||
# while test $i -lt 2680
|
# while test $i -lt 3000
|
||||||
# do
|
# do
|
||||||
# echo $i
|
# echo $i
|
||||||
# wget -O $i -q http://products.z-wavealliance.org/products/$i/XML
|
# wget -O $i -q http://products.z-wavealliance.org/products/$i/XML
|
||||||
@ -30,7 +30,7 @@ for my $fn (sort { $a <=> $b } @files) {
|
|||||||
while(my $l = <FH>) {
|
while(my $l = <FH>) {
|
||||||
chomp($l);
|
chomp($l);
|
||||||
|
|
||||||
$em = empty if($l =~ m,<h2>Oh no ... we encountered an error!</h2>,);
|
$em = 'empty' if($l =~ m,<h2>Oh no ... we encountered an error!</h2>,);
|
||||||
$bn = $1 if($l =~ m,<Brand>(.*)</Brand>,);
|
$bn = $1 if($l =~ m,<Brand>(.*)</Brand>,);
|
||||||
$mi = $1 if($l =~ m,<ManufacturerId>0x(....)</ManufacturerId>,);
|
$mi = $1 if($l =~ m,<ManufacturerId>0x(....)</ManufacturerId>,);
|
||||||
$pti = $1 if($l =~ m,<ProductTypeId>0x(....)</ProductTypeId>,);
|
$pti = $1 if($l =~ m,<ProductTypeId>0x(....)</ProductTypeId>,);
|
||||||
@ -39,16 +39,16 @@ for my $fn (sort { $a <=> $b } @files) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
close(FH);
|
close(FH);
|
||||||
if($mi eq '' && $pti eq '' && $pi eq '' && -s $path eq 4880) {
|
|
||||||
printf "DELETE empty $path\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
if($em eq 'empty') {
|
if($em eq 'empty') {
|
||||||
printf "Empty for $fn\n";
|
printf "No data for $fn, deleting the file\n";
|
||||||
|
# in the hope that somebody will fix the file
|
||||||
|
unlink("$ARGV[0]/$fn");
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if($mi eq '' || $pti eq '' || $pi eq '') {
|
if($mi eq '' || $pti eq '' || $pi eq '') {
|
||||||
printf "Missing parameters for $fn: $bn/$mi/$pti/$pi\n";
|
printf "Missing parameters for $fn: Brand:$bn, ManufId:$mi, ProductType:$pti, ProductId:$pi, deleting the file\n";
|
||||||
|
# in the hope that somebody will fix the file
|
||||||
|
unlink("$ARGV[0]/$fn");
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
printf OF "%s-%s-%s,%s,%s,%s\n", $mi,$pti,$pi,$fn,$pic,$bn;
|
printf OF "%s-%s-%s,%s,%s,%s\n", $mi,$pti,$pi,$fn,$pic,$bn;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user