/[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 168 by william, Sat Mar 16 13:57:41 2013 UTC revision 169 by william, Sat Mar 16 14:04:31 2013 UTC
# Line 293  namespace GBPVRProgramDatabaseFixer Line 293  namespace GBPVRProgramDatabaseFixer
293              return range;              return range;
294          }          }
295    
296          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)
297          {          {
298              gbpvr_programs_not_found = new List<IPROGRAMME>();              source_invalid = new List<IPROGRAMME>();
299              gbpvr_programs = gbpvr_programs.OrderBy(s => s.start_time).ToList();                          gbpvr_programs = gbpvr_programs.OrderBy(s => s.start_time).ToList();            
300              List<SQLLITE.IPROGRAMME> source_valid = new List<IPROGRAMME>();              List<SQLLITE.IPROGRAMME> source_valid = new List<IPROGRAMME>();
301              //if (range == null)              //if (range == null)
# Line 309  namespace GBPVRProgramDatabaseFixer Line 309  namespace GBPVRProgramDatabaseFixer
309              double index = 0;              double index = 0;
310              double progress = 0;              double progress = 0;
311              foreach (var program in gbpvr_programs)              foreach (var program in gbpvr_programs)
312              {              {  
313                  ////if (program.start_time >= range.Start &&                  progress = 100.0 * (index / total);
314                  ////    program.start_time <= range.End)                  gLog.ReportProgress(this, new ReportProgressEventArgs((int)progress, string.Format("Filtering GBPVR Programs: {0:00}%", (int)progress)));                
                 ////{  
                 ////    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++;  
315                  var channel_oid = program.channel_oid;                  var channel_oid = program.channel_oid;
316                  var channel = this.Channels.Find(s => s.oid == channel_oid);                  var channel = this.Channels.Find(s => s.oid == channel_oid);
317                  var start_date = program.start_time;                  var start_date = program.start_time;
318                  var xmltv_entry = xmltv_programs.Find(s => s.ChannelNumber == channel.channel_number && s.Start == start_date.ToDateTimeString());                  var xmltv_entry = xmltv_programs.Find(s => s.ChannelNumber == channel.channel_number && s.Start == start_date.ToDateTimeString());
319                  if (xmltv_entry == null)                  if (xmltv_entry == null)
320                  {                  {
321                      gbpvr_programs_not_found.Add(program);                      source_invalid.Add(program);
322                  }                  }
323                  else                  else
324                  {                  {
# Line 349  namespace GBPVRProgramDatabaseFixer Line 330  namespace GBPVRProgramDatabaseFixer
330                      updated_program.sub_title = xmltv_entry.SubTitle;                      updated_program.sub_title = xmltv_entry.SubTitle;
331                      source_valid.Add(updated_program);                      source_valid.Add(updated_program);
332                  }                  }
333                    index++;
334              }              }
335    
336              //for (int i = 0; i < programs.Count(); i++)              //for (int i = 0; i < programs.Count(); i++)
# Line 362  namespace GBPVRProgramDatabaseFixer Line 344  namespace GBPVRProgramDatabaseFixer
344              //}              //}
345    
346              source_valid = source_valid.OrderBy(s => s.channel_oid).ThenBy(s => s.start_time).ToList();              source_valid = source_valid.OrderBy(s => s.channel_oid).ThenBy(s => s.start_time).ToList();
347              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();
348    
349              gLog.Info.WriteLine("Total XMLTV Programs: 0x{0:x8}", xmltv_programs.Count);              gLog.Info.WriteLine("Total XMLTV Programs: 0x{0:x8}", xmltv_programs.Count);
350              gLog.Info.WriteLine("Updated: 0x{0:x8} GB-PVR Programs", source_valid.Count);              gLog.Info.WriteLine("Updated: 0x{0:x8} GB-PVR Programs", source_valid.Count);
351              gLog.Info.WriteLine("Could not find: 0x{0:x8} GB-PVR Programs", gbpvr_programs_not_found.Count);              gLog.Info.WriteLine("Removed: 0x{0:x8} GB-PVR Programs", source_invalid.Count);
352              gLog.Info.WriteLine("Total GB-PVR Programs: 0x{0:x8}", source_valid.Count + gbpvr_programs_not_found.Count);              gLog.Info.WriteLine("Total GB-PVR Programs (Updated & Removed): 0x{0:x8}", source_valid.Count + source_invalid.Count);
353    
354              return source_valid;              return source_valid;
355          }          }

Legend:
Removed from v.168  
changed lines
  Added in v.169

  ViewVC Help
Powered by ViewVC 1.1.22