67 |
sub dumpArchive2XML($$$) |
sub dumpArchive2XML($$$) |
68 |
{ |
{ |
69 |
my ($dbh, $dvd_nr, $filename) = @_; |
my ($dbh, $dvd_nr, $filename) = @_; |
70 |
my %archive; |
my %archive; |
71 |
my $output = new IO::File(">$filename"); |
|
72 |
|
my $output = new IO::File('> '.$filename.'.tmp'); |
73 |
my $writer = new XML::Writer(OUTPUT=>$output, NEWLINES => 1); |
my $writer = new XML::Writer(OUTPUT=>$output, NEWLINES => 1); |
74 |
|
|
75 |
print "Dumping file list for DVD $dvd_nr"; |
print "Dumping file list for DVD $dvd_nr, countdown:"; |
76 |
|
|
77 |
$writer->pi('xml-stylesheet', 'href="archive.css" type="text/css"'); |
$writer->pi('xml-stylesheet', 'href="archive.css" type="text/css"'); |
78 |
|
|
124 |
my $sth_backups = $dbh->prepare( $backups_sql ); |
my $sth_backups = $dbh->prepare( $backups_sql ); |
125 |
$sth_backups->execute( $row_h->{'id'} ); |
$sth_backups->execute( $row_h->{'id'} ); |
126 |
|
|
127 |
|
my $total_backups = $sth_backups->rows; |
128 |
|
my $curr_backup = 0; |
129 |
|
my $last_pcnt = 0; |
130 |
|
|
131 |
while (my $row = $sth_backups->fetchrow_hashref()) { |
while (my $row = $sth_backups->fetchrow_hashref()) { |
132 |
|
|
133 |
print "."; |
$curr_backup++; |
134 |
|
my $pcnt = int(($curr_backup * 10) / $total_backups); |
135 |
|
if ($pcnt > $last_pcnt) { |
136 |
|
print " ",(10 - $pcnt); |
137 |
|
$last_pcnt = $pcnt; |
138 |
|
} |
139 |
|
|
140 |
my $sth_files = $dbh->prepare( $files_sql); |
my $sth_files = $dbh->prepare( $files_sql); |
141 |
$sth_files->execute($row->{'backup_id'}); |
$sth_files->execute($row->{'backup_id'}); |
161 |
$writer->endTag("archive"); |
$writer->endTag("archive"); |
162 |
$writer->end(); |
$writer->end(); |
163 |
|
|
164 |
|
rename $filename.'.tmp', $filename || die "can't rename $filename: $!"; |
165 |
|
|
166 |
print "\n"; |
print "\n"; |
167 |
} |
} |
168 |
|
|