/[xmltv_parser]/trunk/GBPVRProgramDatabaseFixer/Program.cs
ViewVC logotype

Diff of /trunk/GBPVRProgramDatabaseFixer/Program.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/GBPVRProgramDatabaseFixer/Program.cs	2013/03/17 00:56:37	212
+++ trunk/GBPVRProgramDatabaseFixer/Program.cs	2013/03/17 05:35:32	232
@@ -99,91 +99,18 @@
             Console.SetCursorPosition(0, Console.CursorTop - 1);
         }
 
-        static void gLog_ReportProgress(object sender, ReportProgressEventArgs e) 
+        static void gLog_ReportProgress(object sender, ReportProgressEventArgs e)
         {
-            //if (!XMLTV_INSTANCE_CREATED && LOADING_XMLTV_FILE)
-            //{
-            //    if (LAST_REPORTED_XMLTV_PROGRESS != e.Progress)
-            //    {
-            //        ConsoleOverwritePreviosLine("XMLTV: {0} Loading: {1:00}%", fi_XMLTVFILE.Name, e.Progress);
-            //        LAST_REPORTED_XMLTV_PROGRESS = e.Progress;
-            //        if (e.Progress == 100)
-            //        {
-            //            Console.WriteLine("XMLTV: {0} Loading: {1:00}%", fi_XMLTVFILE.Name, e.Progress);
-            //        }
-            //    }
-            //}
-            //if (!SQLLIST_INSTANCE_CREATED && LOADING_GBPVR_DATABASE)
-            //{
-            //    if (LAST_REPORTED_SQLLITE_PROGRESS != e.Progress)
-            //    {
-            //        ConsoleOverwritePreviosLine("SQLLITE: {0} Loading: {1:00}%", fi_XMLTVFILE.Name, e.Progress);
-            //        LAST_REPORTED_SQLLITE_PROGRESS = e.Progress;
-            //        if (e.Progress == 100)
-            //        {
-            //            Console.WriteLine("SQLLITE: {0} Loading: {1:00}%", fi_XMLTVFILE.Name, e.Progress);
-            //        }
-            //    }
-            //}
-
             object k = e.UserState; // we will assum that is a status message
             if (k == null) // assume we do not have a user status message (ie: is only a progress message)
             {
-                if (sender == null)
-                {
-                    //if (LAST_REPORTED_PROGRESS != e.Progress)
-                    //{
-                    //    ConsoleOverwritePreviosLine("Progress: {0} ", e.Progress);
-                    //    LAST_REPORTED_PROGRESS = e.Progress;
-                    //    if (e.Progress == 100)
-                    //    {
-                    //        Console.WriteLine("Progress: {0} ", e.Progress);
-                    //    }
-                    //}
-                    ConsoleOverwritePreviosLine("Progress: {0} ", e.Progress);
-                }
-                else
-                {
-                    //if (LAST_REPORTED_PROGRESS != e.Progress)
-                    //{
-                    //    ConsoleOverwritePreviosLine("{0}: Progress: {1:00}%", sender.GetType().Name, e.Progress);
-                    //    LAST_REPORTED_PROGRESS = e.Progress;
-                    //    if (e.Progress == 100)
-                    //    {
-                    //        Console.WriteLine("{0}: Progress: {1:00}%", sender.GetType().Name, e.Progress);
-                    //    }
-                    //}
-                    ConsoleOverwritePreviosLine("{0}: Progress: {1:00}%", sender.GetType().Name, e.Progress);
-                }
+                if (sender == null) { ConsoleOverwritePreviosLine("Progress: {0} ", e.Progress); }
+                else { ConsoleOverwritePreviosLine("{0}: Progress: {1:00}%", sender.GetType().Name, e.Progress); }
             }
             else // assume we have a user status message
             {
-                if (sender == null)
-                {
-                    //if (LAST_REPORTED_PROGRESS != e.Progress)
-                    //{
-                    //    ConsoleOverwritePreviosLine("Progress: {0} ", k.ToString());
-                    //    LAST_REPORTED_PROGRESS = e.Progress;
-                    //    if (e.Progress == 100)
-                    //    {
-                    //        Console.WriteLine("Progress: {0} ", k.ToString());
-                    //    }
-                    //}
-                    ConsoleOverwritePreviosLine("{0} ", k.ToString());
-                }
-                else
-                {
-                    //if (LAST_REPORTED_PROGRESS != e.Progress)
-                    //{
-                    //    ConsoleOverwritePreviosLine("{0}: {1}", sender.GetType().Name, k.ToString());
-                    //    LAST_REPORTED_PROGRESS = e.Progress;
-                    //    if (e.Progress == 100)
-                    //    {
-                    //        Console.WriteLine("{0}: {1}", sender.GetType().Name, k.ToString());
-                    //    }
-                    //}
-                    ConsoleOverwritePreviosLine("{0}: {1}", sender.GetType().Name, k.ToString());
-                }
+                if (sender == null) { ConsoleOverwritePreviosLine("{0} ", k.ToString()); }
+                else { ConsoleOverwritePreviosLine("{0}: {1}", sender.GetType().Name, k.ToString()); }
             }
         }
         static void LoadXMLTVFile()
@@ -231,12 +158,6 @@
         }
         static void SQLLITE_OnInstanceCreated(object sender, EventArgs e) { SQLLIST_INSTANCE_CREATED = true; }
 
-
-        //static List<SQLLITE.IPROGRAMME> gbpvr_invalid_programs;
-        //static List<SQLLITE.IPROGRAMME> gbpvr_valid_programs;
-        //static List<SQLLITE.ICHANNEL> gbpvr_channels;
-        //static List<SQLLITE.IRECORDING_SCHEDULE> gbpvr_recordings;
-        //static List<libxmltv.Interfaces.IProgramDefinition> xmltv_programs;
         static void PerformDatabaseProcessing()
         {
             var sqllite_channels = sqlite.Channels;
@@ -248,16 +169,7 @@
             var sqllite_programs_startdate_range = sqlite.GetProgramsDateRange(sqllite_programs);
             var xmltv_programs_startdate_range = GetXMLTVProgramStartDateRange(xmltv_programs);
             var gbpvr_invalid_programs = new List<SQLLITE.IPROGRAMME>();
-            var gbpvr_valid_programs = sqlite.FixGBPVRProgramsDatabase(sqllite_programs, xmltv_programs, out gbpvr_invalid_programs);
-            //xmltv_programs = xmltv_programs.OrderBy(s => s.ChannelNumber).ThenBy(s => DateTime.Parse(s.Start)).ToList();
-            //sqllite_channels.TrimExcess();
-            //gbpvr_invalid_programs.TrimExcess();
-            //gbpvr_valid_programs.TrimExcess();
-            //sqllite_programs.TrimExcess();
-            //xmltv_programs.TrimExcess();
-            //CheckScheduledRecordingsForDiscrepancies(sqllite_recordings);
-            //CheckProgramsForDiscrepancies(gbpvr_valid_programs, xmltv_programs);
-
+            var gbpvr_valid_programs = sqlite.FixGBPVRProgramsDatabase(sqllite_programs, xmltv_programs, out gbpvr_invalid_programs);     
             sqlite.RemoveOldGBPVRPrograms(gbpvr_invalid_programs);
             sqlite.UpdateGBPVRPrograms(gbpvr_valid_programs);
 
@@ -279,61 +191,7 @@
 
         static void CheckScheduledRecordingsForDiscrepancies(List<SQLLITE.IRECORDING_SCHEDULE> gbpvr)
         {
-            ////gLog.Warn.WriteLine("CheckScheduledRecordingsForDiscrepancies() has not been implemented");
-            //var manual_gbpvr_recordings = gbpvr.FindAll(p => p.recording_type == 0).ToList();
-
-            //foreach (var manual_recording in manual_gbpvr_recordings)
-            //{
-            //    string title = manual_recording.filename;
-            //    DateTime start = manual_recording.manual_start_time;
-            //    DateTime end = manual_recording.manual_end_time;
-            //    long channel_oid = manual_recording.manual_channel_oid;
-            //    var found_channel = gbpvr_channels.Find(p => p.oid == channel_oid);
-            //    var channel_number = found_channel.channel_number;
-            //    var found_program = xmltv_programs.ToList().Find(p => 
-            //        p.Title.ToLower() == title.ToLower() && 
-            //        p.Start == start.ToDateTimeString() &&
-            //        p.Stop == end.ToDateTimeString() &&
-            //        p.ChannelNumber == channel_number
-            //        );
-            //    if (found_program != null)
-            //    {
-            //        gLog.Info.WriteLine("Recording might be valid: oid='{0}' programme_oid='{1}' title='{2}' start='{3}', end='{4}'", manual_recording.oid, manual_recording.programme_oid, title, start.ToDateTimeString(), end.ToDateTimeString());
-            //    }
-            //    else
-            //    {
-            //        gLog.Warn.WriteLine("Recording may not be valid: oid='{0}' programme_oid='{1}' title='{2}' start='{3}', end='{4}'", manual_recording.oid, manual_recording.programme_oid, title, start.ToDateTimeString(), end.ToDateTimeString());
-            //        // find the program on the channel at the start time
-            //        var correct_program = xmltv_programs.ToList().Find(p => 
-            //            p.ChannelNumber == channel_number &&
-            //            p.Start == start.ToDateTimeString()
-            //            );
-            //        if (correct_program != null)
-            //        {
-            //            gLog.Warn.WriteLine("\tThis will be recorded: {0}", correct_program.ToString());
-            //        }
-            //    }
-            //}
-        }
-
-        static void CheckProgramsForDiscrepancies(List<SQLLITE.IPROGRAMME> list_gbpvr, List<libxmltv.Interfaces.IProgramDefinition> list_xmltv)
-        {
-            ////gLog.Warn.WriteLine("CheckProgramsForDiscrepancies() has not been implemented");
-            //var gbpvr = list_gbpvr.ToArray();
-            //var xmltv = list_xmltv.ToArray();
-            ////if (gbpvr.Count() != xmltv.Count())
-            ////{
-            ////    throw new ArgumentOutOfRangeException("gbpvr.Count/xmltv.Count", string.Format("gbpvr.Count: '0x{0:x8}' != xmltv.Count: '0x{1:x8}'", gbpvr.Count(),xmltv.Count()));
-            ////}
-            ////for (int i = 0; i < gbpvr.Count(); i++)
-            ////{
-            ////    var gbpvr_entry = gbpvr[i];
-            ////    var xmltv_entry = gbpvr_entry.AsXMLTVProgramDefinition(sqlite);
-            ////    if (!xmltv[i].Equals(xmltv_entry))
-            ////    {
-            ////        gLog.Warn.WriteLine("Warning GBPVR Program oid: {0} might be invalid", gbpvr_entry.oid);
-            ////    }
-            ////}
         }
+
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22