From 776bcb699d4cf382ebebdd173ca4dde3b2a3ac3b Mon Sep 17 00:00:00 2001 From: dpavlin Date: Fri, 14 Oct 2005 16:46:33 +0000 Subject: [PATCH] r8522@llin: dpavlin | 2005-10-14 18:46:27 +0200 countdown while creating filelist, create filelist in temporary file (to prevent partial files) git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@204 8392b6e1-25fa-0310-8288-cc32f8e212ea --- bin/BackupPC_burnArchiveCLI | 20 ++++++++++++++++---- doc/Search.pm | 2 ++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/bin/BackupPC_burnArchiveCLI b/bin/BackupPC_burnArchiveCLI index 2c442ed..c5f52d2 100755 --- a/bin/BackupPC_burnArchiveCLI +++ b/bin/BackupPC_burnArchiveCLI @@ -67,11 +67,12 @@ sub curr_time { sub dumpArchive2XML($$$) { my ($dbh, $dvd_nr, $filename) = @_; - my %archive; - my $output = new IO::File(">$filename"); + my %archive; + + my $output = new IO::File('> '.$filename.'.tmp'); my $writer = new XML::Writer(OUTPUT=>$output, NEWLINES => 1); - print "Dumping file list for DVD $dvd_nr"; + print "Dumping file list for DVD $dvd_nr, countdown:"; $writer->pi('xml-stylesheet', 'href="archive.css" type="text/css"'); @@ -123,9 +124,18 @@ sub dumpArchive2XML($$$) my $sth_backups = $dbh->prepare( $backups_sql ); $sth_backups->execute( $row_h->{'id'} ); + my $total_backups = $sth_backups->rows; + my $curr_backup = 0; + my $last_pcnt = 0; + while (my $row = $sth_backups->fetchrow_hashref()) { - print "."; + $curr_backup++; + my $pcnt = int(($curr_backup * 10) / $total_backups); + if ($pcnt > $last_pcnt) { + print " ",(10 - $pcnt); + $last_pcnt = $pcnt; + } my $sth_files = $dbh->prepare( $files_sql); $sth_files->execute($row->{'backup_id'}); @@ -151,6 +161,8 @@ sub dumpArchive2XML($$$) $writer->endTag("archive"); $writer->end(); + rename $filename.'.tmp', $filename || die "can't rename $filename: $!"; + print "\n"; } diff --git a/doc/Search.pm b/doc/Search.pm index 641fab1..63908a6 100644 --- a/doc/Search.pm +++ b/doc/Search.pm @@ -186,6 +186,8 @@ Or equivavalent utility, on Debian you might want to use C. =item eject +Please make a symlink from C to you CD/DVD burner. + =item split =back -- 2.20.1