/[BackupPC]/trunk/bin/BackupPC_burnArchiveCLI
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/BackupPC_burnArchiveCLI

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 203 by dpavlin, Fri Oct 14 15:53:54 2005 UTC revision 204 by dpavlin, Fri Oct 14 16:46:33 2005 UTC
# Line 67  sub curr_time { Line 67  sub curr_time {
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    
# Line 123  sub dumpArchive2XML($$$) Line 124  sub dumpArchive2XML($$$)
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'});
# Line 151  sub dumpArchive2XML($$$) Line 161  sub dumpArchive2XML($$$)
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    

Legend:
Removed from v.203  
changed lines
  Added in v.204

  ViewVC Help
Powered by ViewVC 1.1.26