示例#1
0
        public override List<Show> Grab(string xmlParameters, ILogger logger)
        {
            logger.WriteEntry("Started CyfrowyPolsat.pl grab", LogType.Info);

            var selectedChannels = new List<Channel>();
            var shows = new List<Show>();
            if (!string.IsNullOrEmpty(xmlParameters))
            {
                var doc = XDocument.Parse(xmlParameters);
                foreach (var c in doc.Descendants("Channel"))
                    selectedChannels.Add((Channel)Enum.Parse(typeof(Channel), c.Value));
            }
            if (selectedChannels.Count == 0) // no channel specified , lets take all available channels
                foreach (Channel c in Enum.GetValues(typeof(Channel)))
                    selectedChannels.Add(c);

            foreach (var c in selectedChannels)
            {
                var p = new GrabParameters();
                p.Channel = c;
                try
                {
                    var channelShows = Grab(p, logger);
                    FixShowsEndTimeByStartTime(channelShows);
                    shows.AddRange(channelShows);
                }
                catch (Exception ex)
                {
                    logger.WriteEntry("Error on grabber " + ex.Message, LogType.Error);
                }
            }

            logger.WriteEntry("Finshed CyfrowyPolsat.pl grab", LogType.Info);
            return shows;
        }
        public override List <Show> Grab(string xmlParameters, ILogger logger)
        {
            logger.WriteEntry("Started CyfrowyPolsat.pl grab", LogType.Info);

            var selectedChannels = new List <Channel>();
            var shows            = new List <Show>();

            if (!string.IsNullOrEmpty(xmlParameters))
            {
                var doc = XDocument.Parse(xmlParameters);
                foreach (var c in doc.Descendants("Channel"))
                {
                    selectedChannels.Add((Channel)Enum.Parse(typeof(Channel), c.Value));
                }
            }
            if (selectedChannels.Count == 0) // no channel specified , lets take all available channels
            {
                foreach (Channel c in Enum.GetValues(typeof(Channel)))
                {
                    selectedChannels.Add(c);
                }
            }

            foreach (var c in selectedChannels)
            {
                var p = new GrabParameters();
                p.Channel = c;
                try
                {
                    var channelShows = Grab(p, logger);
                    FixShowsEndTimeByStartTime(channelShows);
                    shows.AddRange(channelShows);
                }
                catch (Exception ex)
                {
                    logger.WriteEntry("Error on grabber " + ex.Message, LogType.Error);
                }
            }

            logger.WriteEntry("Finshed CyfrowyPolsat.pl grab", LogType.Info);
            return(shows);
        }