/[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 216 by william, Sun Mar 17 01:15:17 2013 UTC revision 217 by william, Sun Mar 17 01:23:45 2013 UTC
# Line 824  namespace GBPVRProgramDatabaseFixer Line 824  namespace GBPVRProgramDatabaseFixer
824    
825          public void RemoveOldGBPVRPrograms(List<SQLLITE.IPROGRAMME> programs)          public void RemoveOldGBPVRPrograms(List<SQLLITE.IPROGRAMME> programs)
826          {                      {            
827              //gLog.Info.WriteLine("Removing {0} gbpvr programs.", programs.Count);              gLog.Info.WriteLine("Removing {0} gbpvr programs.", programs.Count);
828              //double total = programs.Count;              int ChunkSize = 1;
             //double index = 0;  
             //double progress = 0;  
             //Stopwatch st = new Stopwatch();  
             //st.Start();  
             //foreach (var program in programs)  
             //{  
             //    progress = 100.0 * (index / total);  
             //    gLog.ReportProgress(this, new ReportProgressEventArgs((int)progress, string.Format("Removing GBPVR Program ({0:00}%) oid='{1}'", (int)progress, program.oid)));  
             //    if (!RemoveProgramDatabaseEntry(program))  
             //    {  
             //        gLog.Error.WriteLine("Failed to remove program with oid: {0}", program.oid);  
             //    }  
             //    index++;  
             //}  
             ////Stopwatch st = new Stopwatch();  
             ////st.Start();  
             ////if (!RemoveAllProgramDatabaseEntries())  
             ////{  
             ////    gLog.Error.WriteLine("Failed to remove one or more program(s)");  
             ////}  
             //st.Stop();  
             //gLog.Warn.WriteLine("    operation took: {0:0.00000} seconds", st.Elapsed.TotalSeconds);  
   
             int ChunkSize = 1024;  
829              var ChunkList = programs.Chunk<IPROGRAMME>(ChunkSize);              var ChunkList = programs.Chunk<IPROGRAMME>(ChunkSize);
   
830              double total = programs.Count;              double total = programs.Count;
831              double index = 0;              double index = 0;
832              double progress = 0;              double progress = 0;
# Line 872  namespace GBPVRProgramDatabaseFixer Line 847  namespace GBPVRProgramDatabaseFixer
847          }          }
848          public void UpdateGBPVRPrograms(List<IOldNewProgram> programs)          public void UpdateGBPVRPrograms(List<IOldNewProgram> programs)
849          {          {
850              int ChunkSize = 1024;              gLog.Info.WriteLine("Updating {0} gbpvr programs.", programs.Count);
851                int ChunkSize = 1;
852              var ChunkList = programs.Chunk<IOldNewProgram>(ChunkSize);              var ChunkList = programs.Chunk<IOldNewProgram>(ChunkSize);
853    
854              double total = programs.Count;              double total = programs.Count;
# Line 882  namespace GBPVRProgramDatabaseFixer Line 858  namespace GBPVRProgramDatabaseFixer
858              st1.Start();              st1.Start();
859              foreach (var p in ChunkList)              foreach (var p in ChunkList)
860              {              {
                 //Stopwatch st2 = new Stopwatch();  
                 //st2.Start();  
861                  progress = 100.0 * (index / total);                  progress = 100.0 * (index / total);
                 //gLog.Warn.WriteLine("Inserting {0} gbpvr programs ({1} of {2})", p.Count(), index, total);    
862                  if (!UpdateProgramEntryDatabase(p))                  if (!UpdateProgramEntryDatabase(p))
863                  {                  {
864                      gLog.Error.WriteLine("Failed to update one or more program(s)");                      gLog.Error.WriteLine("Failed to update one or more program(s)");
865                  }                  }
                 //st2.Stop();  
                 //gLog.Warn.WriteLine("    operation took: {0:0.00000} seconds", st2.Elapsed.TotalSeconds);  
                 //gLog.Warn.WriteLine(System.Environment.NewLine);  
866                  gLog.ReportProgress(this, new ReportProgressEventArgs((int)progress, string.Format("Updating {0} gbpvr programs ({1} of {2}) {3:00}%", p.Count(), index, total, (int)progress)));                  gLog.ReportProgress(this, new ReportProgressEventArgs((int)progress, string.Format("Updating {0} gbpvr programs ({1} of {2}) {3:00}%", p.Count(), index, total, (int)progress)));
867                  index += (double)p.Count();                                  index += (double)p.Count();                
868              }              }

Legend:
Removed from v.216  
changed lines
  Added in v.217

  ViewVC Help
Powered by ViewVC 1.1.22