/[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

--- trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs	2013/03/16 16:22:43	176
+++ trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs	2013/03/16 16:52:43	177
@@ -353,55 +353,55 @@
 
                 if (xmltv_entry == null)
                 {
-                    gLog.Warn.WriteLine("Invalidating GB-PVR Program: oid='{0}' channel_oid='{1}' title='{2}' start='{3}'", program.oid, program.channel_oid, program.name, program.start_time.ToDateTimeString());
+                    gLog.Verbose.Warn.WriteLine("Invalidating GB-PVR Program: oid='{0}' channel_oid='{1}' title='{2}' start='{3}'", program.oid, program.channel_oid, program.name, program.start_time.ToDateTimeString());
                     source_invalid.Add(program);                   
                 }
                 else
                 {
-                    gLog.Warn.WriteLine("Updating GB-PVR Program (if needed): oid='{0}' channel_oid='{1}' title='{2}' subtitle='{3}' start='{4}'", program.oid, program.channel_oid, program.name, program.sub_title, program.start_time.ToDateTimeString());
+                    gLog.Verbose.Warn.WriteLine("Updating GB-PVR Program (if needed): oid='{0}' channel_oid='{1}' title='{2}' subtitle='{3}' start='{4}'", program.oid, program.channel_oid, program.name, program.sub_title, program.start_time.ToDateTimeString());
                     var updated_program = program;
                     bool needsupdate = false;
                     if (xmltv_entry.Title != program.name)
                     {
-                        gLog.Warn.WriteLine("    Updating:");
-                        gLog.Warn.WriteLine("        Old Title: {0}", program.name);
-                        gLog.Warn.WriteLine("        New Title: {0}", xmltv_entry.Title);
+                        gLog.Verbose.Warn.WriteLine("    Updating:");
+                        gLog.Verbose.Warn.WriteLine("        Old Title: {0}", program.name);
+                        gLog.Verbose.Warn.WriteLine("        New Title: {0}", xmltv_entry.Title);
                         updated_program.name = xmltv_entry.Title;
                         needsupdate = true;
                     }
                     if (xmltv_entry.SubTitle != program.sub_title)
                     {
-                        gLog.Warn.WriteLine("    Updating:");
-                        gLog.Warn.WriteLine("        Old SubTile: {0}", program.sub_title);
-                        gLog.Warn.WriteLine("        New SubTile: {0}", xmltv_entry.SubTitle);
+                        gLog.Verbose.Warn.WriteLine("    Updating:");
+                        gLog.Verbose.Warn.WriteLine("        Old SubTile: {0}", program.sub_title);
+                        gLog.Verbose.Warn.WriteLine("        New SubTile: {0}", xmltv_entry.SubTitle);
                         updated_program.sub_title = xmltv_entry.SubTitle;
                         needsupdate = true;
                     }
                     if (xmltv_entry.Description != program.description)
                     {
-                        gLog.Warn.WriteLine("    Updating:");
-                        gLog.Warn.WriteLine("        Old Descption: {0}", program.description);
-                        gLog.Warn.WriteLine("        New Descption: {0}", xmltv_entry.Description);
+                        gLog.Verbose.Warn.WriteLine("    Updating:");
+                        gLog.Verbose.Warn.WriteLine("        Old Descption: {0}", program.description);
+                        gLog.Verbose.Warn.WriteLine("        New Descption: {0}", xmltv_entry.Description);
                         updated_program.description = xmltv_entry.Description;
                         needsupdate = true;
                     }
                     if (DateTime.Parse(xmltv_entry.Start) != program.start_time)
                     {
-                        gLog.Warn.WriteLine("    Updating:");
-                        gLog.Warn.WriteLine("        Old StartTime: {0}", program.start_time.ToDateTimeString());
-                        gLog.Warn.WriteLine("        New StartTime: {0}", DateTime.Parse(xmltv_entry.Start).ToDateTimeString());
+                        gLog.Verbose.Warn.WriteLine("    Updating:");
+                        gLog.Verbose.Warn.WriteLine("        Old StartTime: {0}", program.start_time.ToDateTimeString());
+                        gLog.Verbose.Warn.WriteLine("        New StartTime: {0}", DateTime.Parse(xmltv_entry.Start).ToDateTimeString());
                         updated_program.start_time = DateTime.Parse(xmltv_entry.Start);
                         needsupdate = true;
                     }
                     if (DateTime.Parse(xmltv_entry.Stop) != program.end_time)
                     {
-                        gLog.Warn.WriteLine("    Updating:");
-                        gLog.Warn.WriteLine("        Old EndTime: {0}", program.end_time.ToDateTimeString());
-                        gLog.Warn.WriteLine("        New EndTime: {0}", DateTime.Parse(xmltv_entry.Stop).ToDateTimeString());
+                        gLog.Verbose.Warn.WriteLine("    Updating:");
+                        gLog.Verbose.Warn.WriteLine("        Old EndTime: {0}", program.end_time.ToDateTimeString());
+                        gLog.Verbose.Warn.WriteLine("        New EndTime: {0}", DateTime.Parse(xmltv_entry.Stop).ToDateTimeString());
                         updated_program.end_time = DateTime.Parse(xmltv_entry.Stop);
                         needsupdate = true;
                     }
-                    source_valid.Add(updated_program);
+                    
                     if (needsupdate)
                     {
                         //// update database entry
@@ -414,7 +414,7 @@
                         p.NewProgram = updated_program;
                         source_update.Add(p);
                     }
-                   
+                    source_valid.Add(updated_program);
                 }
                 index++;
             }
@@ -425,8 +425,13 @@
 
             if (source_invalid.Count > 0)
             {
+                double source_invalid_count = source_valid.Count;
+                double source_invalid_index = 0;
+                double source_invalid_progress = 0;
                 foreach (var old_program in source_invalid)
                 {
+                    source_invalid_progress = 100.0 * (source_invalid_index / source_invalid_count);
+                    gLog.ReportProgress(this, new ReportProgressEventArgs((int)progress, string.Format("Removing old GBPVR Programs: {0:00}%", (int)source_invalid_progress)));    
                     // remove database entry
                     if (!RemoveProgramDatabaseEntry(old_program))
                     {
@@ -434,8 +439,9 @@
                     }
                     else
                     {
-                        gLog.Info.WriteLine("Removed program with oid: '{0}'", old_program.oid);
+                        gLog.Verbose.Info.WriteLine("Removed program with oid: '{0}'", old_program.oid);
                     }
+                    source_invalid_index++;
                 }
             }
             else
@@ -445,8 +451,13 @@
 
             if (source_update.Count > 0)
             {
+                double source_update_count = source_valid.Count;
+                double source_update_index = 0;
+                double source_update_progress = 0;
                 foreach (var p in source_update)
                 {
+                    source_update_progress = 100.0 * (source_update_index / source_update_count);
+                    gLog.ReportProgress(this, new ReportProgressEventArgs((int)progress, string.Format("Updating GBPVR Programs: {0:00}%", (int)source_update_progress)));    
                     // remove database entry
                     if (!UpdateProgramDatabaseEntry(p.OldProgram,p.NewProgram))
                     {
@@ -454,8 +465,9 @@
                     }
                     else
                     {
-                        gLog.Info.WriteLine("Upated program with oid: '{0}'", p.OldProgram.oid);
+                        gLog.Verbose.Info.WriteLine("Upated program with oid: '{0}'", p.OldProgram.oid);
                     }
+                    source_update_index++;
                 }
             }
             else

 

  ViewVC Help
Powered by ViewVC 1.1.22