/[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 13:57:41	168
+++ trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs	2013/03/16 14:04:31	169
@@ -293,9 +293,9 @@
             return range;
         }
 
-        public List<SQLLITE.IPROGRAMME> CreateUpdatedProgramsList(List<SQLLITE.IPROGRAMME> gbpvr_programs, List<libxmltv.Interfaces.IProgramDefinition> xmltv_programs, out List<SQLLITE.IPROGRAMME> gbpvr_programs_not_found)
+        public List<SQLLITE.IPROGRAMME> CreateUpdatedProgramsList(List<SQLLITE.IPROGRAMME> gbpvr_programs, List<libxmltv.Interfaces.IProgramDefinition> xmltv_programs, out List<SQLLITE.IPROGRAMME> source_invalid)
         {
-            gbpvr_programs_not_found = new List<IPROGRAMME>();
+            source_invalid = new List<IPROGRAMME>();
             gbpvr_programs = gbpvr_programs.OrderBy(s => s.start_time).ToList();            
             List<SQLLITE.IPROGRAMME> source_valid = new List<IPROGRAMME>();
             //if (range == null)
@@ -309,35 +309,16 @@
             double index = 0;
             double progress = 0;
             foreach (var program in gbpvr_programs)
-            {
-                ////if (program.start_time >= range.Start &&
-                ////    program.start_time <= range.End)
-                ////{
-                ////    list2.Add(program);
-                ////}
-                ////else
-                ////{
-                ////    removed_programs.Add(program);
-                ////}   
-                //progress = 100.0 * (index / total);
-                //gLog.ReportProgress(this, new ReportProgressEventArgs((int)progress, string.Format("Filtering GBPVR Programs: {0:00}%", (int)progress)));
-                //var xmltv_entry = program.AsXMLTVProgramDefinition(this);
-                //if (xmltv_programs.Contains(xmltv_entry))
-                //{
-                //    source_valid.Add(program);
-                //}
-                //else
-                //{
-                //    gbpvr_programs_not_found.Add(program);
-                //}
-                //index++;
+            {  
+                progress = 100.0 * (index / total);
+                gLog.ReportProgress(this, new ReportProgressEventArgs((int)progress, string.Format("Filtering GBPVR Programs: {0:00}%", (int)progress)));                
                 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());
                 if (xmltv_entry == null)
                 {
-                    gbpvr_programs_not_found.Add(program);
+                    source_invalid.Add(program);
                 }
                 else
                 {
@@ -349,6 +330,7 @@
                     updated_program.sub_title = xmltv_entry.SubTitle;
                     source_valid.Add(updated_program);
                 }
+                index++;
             }
 
             //for (int i = 0; i < programs.Count(); i++)
@@ -362,12 +344,12 @@
             //}
 
             source_valid = source_valid.OrderBy(s => s.channel_oid).ThenBy(s => s.start_time).ToList();
-            gbpvr_programs_not_found = gbpvr_programs_not_found.OrderBy(s => s.channel_oid).ThenBy(s => s.start_time).ToList();
+            source_invalid = source_invalid.OrderBy(s => s.channel_oid).ThenBy(s => s.start_time).ToList();
 
             gLog.Info.WriteLine("Total XMLTV Programs: 0x{0:x8}", xmltv_programs.Count);
             gLog.Info.WriteLine("Updated: 0x{0:x8} GB-PVR Programs", source_valid.Count);
-            gLog.Info.WriteLine("Could not find: 0x{0:x8} GB-PVR Programs", gbpvr_programs_not_found.Count);
-            gLog.Info.WriteLine("Total GB-PVR Programs: 0x{0:x8}", source_valid.Count + gbpvr_programs_not_found.Count);
+            gLog.Info.WriteLine("Removed: 0x{0:x8} GB-PVR Programs", source_invalid.Count);
+            gLog.Info.WriteLine("Total GB-PVR Programs (Updated & Removed): 0x{0:x8}", source_valid.Count + source_invalid.Count);
 
             return source_valid;
         }

 

  ViewVC Help
Powered by ViewVC 1.1.22