/[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 14:04:31	169
+++ trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs	2013/03/16 14:28:56	170
@@ -304,7 +304,7 @@
             //    return list;
             //}
             //gLog.Warn.WriteLine("FilterProgramsByDateRange has not been implemented");
-
+            
             double total = gbpvr_programs.Count;
             double index = 0;
             double progress = 0;
@@ -315,9 +315,24 @@
                 var channel_oid = program.channel_oid;
                 var channel = this.Channels.Find(s => s.oid == channel_oid);
                 var start_date = program.start_time;
-                var xmltv_entry = xmltv_programs.Find(s => s.ChannelNumber == channel.channel_number && s.Start == start_date.ToDateTimeString());
+                var xmltv_entry_list = xmltv_programs.FindAll(s => s.ChannelNumber == channel.channel_number && s.Start == start_date.ToDateTimeString());
+                IProgramDefinition xmltv_entry = null;
+                if (xmltv_entry_list.Count > 0)
+                {
+                    gLog.Error.WriteLine("Found more than one entry: Matching channel='{0}' and start='{1}'", channel.channel_number, start_date.ToDateTimeString());
+                    if (Debugger.IsAttached)
+                    {
+                        Debugger.Break();
+                    }
+                }
+                else
+                {
+                    xmltv_entry = xmltv_entry_list.FirstOrDefault();
+                }
+
                 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());
                     source_invalid.Add(program);
                 }
                 else
@@ -328,6 +343,8 @@
                     updated_program.name = xmltv_entry.Title;
                     updated_program.start_time = DateTime.Parse(xmltv_entry.Start);                    
                     updated_program.sub_title = xmltv_entry.SubTitle;
+                    gLog.Warn.WriteLine("Updating GB-PVR Program: 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.Warn.WriteLine("    Updated with Program: title='{0}' subtitle='{1}' start='{2}'", updated_program.name,updated_program.sub_title, program.start_time.ToDateTimeString());
                     source_valid.Add(updated_program);
                 }
                 index++;

 

  ViewVC Help
Powered by ViewVC 1.1.22