/[xmltv_parser]/trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs
ViewVC logotype

Diff of /trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs

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

revision 202 by william, Sat Mar 16 22:36:18 2013 UTC revision 203 by william, Sat Mar 16 22:44:28 2013 UTC
# Line 300  namespace GBPVRProgramDatabaseFixer Line 300  namespace GBPVRProgramDatabaseFixer
300              public const string PROGRAMME = "PROGRAMME";              public const string PROGRAMME = "PROGRAMME";
301              public const string CHANNEL = "CHANNEL";              public const string CHANNEL = "CHANNEL";
302          }          }
303            private string DATABASE_BACKUP_FILE = string.Empty;
304          //public SQLLite() { }          //public SQLLite() { }
305          protected SQLLITE(string database, EventHandler<EventArgs> OnInstanceCreated)          protected SQLLITE(string database, EventHandler<EventArgs> OnInstanceCreated)
306          {          {
# Line 658  namespace GBPVRProgramDatabaseFixer Line 658  namespace GBPVRProgramDatabaseFixer
658                  gLog.Info.WriteLine("\tDestination: {0}", backup_file);                  gLog.Info.WriteLine("\tDestination: {0}", backup_file);
659    
660                  System.IO.File.Copy(this.Database, backup_file);                  System.IO.File.Copy(this.Database, backup_file);
661                    DATABASE_BACKUP_FILE = backup_file;
662                  return true;                  return true;
663              }              }
664              catch (Exception ex)              catch (Exception ex)
# Line 852  namespace GBPVRProgramDatabaseFixer Line 853  namespace GBPVRProgramDatabaseFixer
853    
854              double total = programs.Count;              double total = programs.Count;
855              double index = 0;              double index = 0;
856              double progress = 0;              //double progress = 0;
857              Stopwatch st1 = new Stopwatch();              Stopwatch st1 = new Stopwatch();
858              st1.Start();              st1.Start();
859              foreach (var p in ChunkList)              foreach (var p in ChunkList)
860              {              {
861                  Stopwatch st2 = new Stopwatch();                  //Stopwatch st2 = new Stopwatch();
862                  st2.Start();                  //st2.Start();
863                  progress = 100.0 * (index / total);                  //progress = 100.0 * (index / total);
864                  gLog.Warn.WriteLine("Inserting {0} gbpvr programs ({1} of {2})", p.Count(), index, total);                    gLog.Warn.WriteLine("Inserting {0} gbpvr programs ({1} of {2})", p.Count(), index, total);  
865                  if (!InsertProgramEntryDatabase(p))                  if (!InsertProgramEntryDatabase(p))
866                  {                  {
867                      gLog.Error.WriteLine("Failed to insert one or more program(s)");                      gLog.Error.WriteLine("Failed to insert one or more program(s)");
868                  }                  }
869                  st2.Stop();                  //st2.Stop();
870                  gLog.Warn.WriteLine("    operation took: {0:0.00000} seconds", st2.Elapsed.TotalSeconds);                  //gLog.Warn.WriteLine("    operation took: {0:0.00000} seconds", st2.Elapsed.TotalSeconds);
871                  gLog.Warn.WriteLine(System.Environment.NewLine);                  //gLog.Warn.WriteLine(System.Environment.NewLine);
872                  gLog.ReportProgress(this, new ReportProgressEventArgs((int)progress, string.Format("Inserting GBPVR Programs: {0:00}%", (int)progress)));                  //gLog.ReportProgress(this, new ReportProgressEventArgs((int)progress, string.Format("Inserting GBPVR Programs: {0:00}%", (int)progress)));
873                  index += (double)p.Count();                                  index += (double)p.Count();                
874              }              }
875              st1.Stop();              st1.Stop();

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

  ViewVC Help
Powered by ViewVC 1.1.22