ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/xmltv_parser/trunk/libxmltv/Core/XMLTVProgramCollection.cs
(Generate patch)

Comparing trunk/libxmltv/Core/XMLTVProgramCollection.cs (file contents):
Revision 28 by william, Thu Mar 7 12:51:53 2013 UTC vs.
Revision 30 by william, Thu Mar 7 13:36:42 2013 UTC

--- trunk/libxmltv/Core/XMLTVProgramCollection.cs	2013/03/07 12:51:53	28
+++ trunk/libxmltv/Core/XMLTVProgramCollection.cs	2013/03/07 13:36:42	30
@@ -48,33 +48,51 @@ namespace libxmltv.Core
                 Program program = new Program();
 
                 program.Id = index;
-
+                //XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("program_Id: {0}", program.Id);
                 if (c.HasAttributes)
                 {
                     var start = c.Attribute(XMLTV_CONSTANTS.Programs.ProgramStart).Value;
                     program.Start = ParseDate(start);
-                    
+                    //XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\tprogram_start: {0}", start);
                     var stop = c.Attribute(XMLTV_CONSTANTS.Programs.ProgramStop).Value;
                     program.Stop = ParseDate(stop);
-
+                    //XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\tprogram_stop: {0}", stop);
                     var channelid = c.Attribute(XMLTV_CONSTANTS.Programs.ProgramChannelId).Value;
+                    //XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\tprogram_channelid: {0}", channelid);
                     IXMLTVChannel channel = new Channel();
                     try
                     {
                         channel = XMLTV_PARSER.Channels[channelid];
+
                     }
                     catch (KeyNotFoundException)
                     {
                         XMLTV_LOGGER.Log.Verbose.Error.WriteLine(string.Format("Unable to find Channel by id: '{0}' for this program.", channelid));
                     }
                     program.Channel = channel;
+                    //XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\tprogram_channel: {0}", program.Channel.ToString());
+                }
+                try
+                {
+                    var title = c.Descendants(XMLTV_CONSTANTS.Programs.ProgramTitle).FirstOrDefault().Value;
+                    program.Title = title;                    
+                }
+                catch (Exception) { program.Title = string.Empty; }
+                //XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\tprogram_title: {0}", program.Title == string.Empty ? "empty" : program.Title);
+                try
+                {
+                    var subtitle = c.Descendants(XMLTV_CONSTANTS.Programs.ProgramSubTitle).FirstOrDefault().Value;
+                    program.SubTitle = subtitle;                    
+                }
+                catch (Exception) { program.SubTitle = string.Empty; }
+                //XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\tprogram_subtitle: {0}", program.SubTitle == string.Empty ? "empty" : program.SubTitle);
+                try
+                {
+                    var description = c.Descendants(XMLTV_CONSTANTS.Programs.ProgramDescription).FirstOrDefault().Value;
+                    program.Description = description;                    
                 }
-                var title = c.Descendants(XMLTV_CONSTANTS.Programs.ProgramTitle).FirstOrDefault().Value;
-                program.Title = title;
-                var subtitle = c.Descendants(XMLTV_CONSTANTS.Programs.ProgramSubTitle).FirstOrDefault().Value;
-                program.SubTitle = subtitle;
-                var description = c.Descendants(XMLTV_CONSTANTS.Programs.ProgramDescription).FirstOrDefault().Value;
-                program.Description = description;
+                catch (Exception) { program.Description = string.Empty; }
+                //XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\tprogram_description: {0}", program.Description == string.Empty ? "empty" : program.Description);
 
                 entries.Add(program.Id, program);
                 index++;