/[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 163 by william, Fri Mar 15 16:53:40 2013 UTC revision 164 by william, Fri Mar 15 16:57:50 2013 UTC
# Line 15  namespace GBPVRProgramDatabaseFixer Line 15  namespace GBPVRProgramDatabaseFixer
15          List<SQLLITE.IRECORDING_SCHEDULE> Recordings { get; }          List<SQLLITE.IRECORDING_SCHEDULE> Recordings { get; }
16          List<SQLLITE.ICHANNEL> Channels { get; }          List<SQLLITE.ICHANNEL> Channels { get; }
17          IDateTimeRange GetProgramsDateRange(List<SQLLITE.IPROGRAMME> programs);          IDateTimeRange GetProgramsDateRange(List<SQLLITE.IPROGRAMME> programs);
18          List<SQLLITE.IPROGRAMME> FilterProgramsByDateRange(List<SQLLITE.IPROGRAMME> programs, IDateTimeRange range);          List<SQLLITE.IPROGRAMME> FilterProgramsByDateRange(List<SQLLITE.IPROGRAMME> programs, IDateTimeRange range, out List<SQLLITE.IPROGRAMME> removed_programs);
19    
20      }      }
21      public class SQLLITE : ISQLLITE      public class SQLLITE : ISQLLITE
# Line 276  namespace GBPVRProgramDatabaseFixer Line 276  namespace GBPVRProgramDatabaseFixer
276              return range;              return range;
277          }          }
278    
279          public List<SQLLITE.IPROGRAMME> FilterProgramsByDateRange(List<SQLLITE.IPROGRAMME> programs, IDateTimeRange range)          public List<SQLLITE.IPROGRAMME> FilterProgramsByDateRange(List<SQLLITE.IPROGRAMME> programs, IDateTimeRange range, out List<SQLLITE.IPROGRAMME> removed_programs)
280          {          {
281                removed_programs = new List<IPROGRAMME>();
282              List<SQLLITE.IPROGRAMME> list = new List<IPROGRAMME>(programs.ToArray());              List<SQLLITE.IPROGRAMME> list = new List<IPROGRAMME>(programs.ToArray());
283              list = list.OrderBy(s => s.start_time).ToList();              list = list.OrderBy(s => s.start_time).ToList();
284              List<SQLLITE.IPROGRAMME> list2 = new List<IPROGRAMME>();              List<SQLLITE.IPROGRAMME> list2 = new List<IPROGRAMME>();
# Line 290  namespace GBPVRProgramDatabaseFixer Line 291  namespace GBPVRProgramDatabaseFixer
291                        
292              foreach (var program in list)              foreach (var program in list)
293              {              {
294                  if (program.start_time >= range.Start &&                  if (program.start_time >= range.Start &&
295                      program.start_time <= range.End)                      program.start_time <= range.End)
296                  {                  {
297                      list2.Add(program);                      list2.Add(program);
298                  }                  }
299                    else
300                    {
301                        removed_programs.Add(program);
302                    }
303              }              }
304              list2 = list2.OrderBy(s => s.channel_oid).ThenBy(s => s.start_time).ToList();              list2 = list2.OrderBy(s => s.channel_oid).ThenBy(s => s.start_time).ToList();
305                removed_programs = removed_programs.OrderBy(s => s.channel_oid).ThenBy(s => s.start_time).ToList();
306              return list2;              return list2;
307          }          }
308          #endregion          #endregion

Legend:
Removed from v.163  
changed lines
  Added in v.164

  ViewVC Help
Powered by ViewVC 1.1.22