コード例 #1
0
        public override List <Show> Grab(string xmlParameters, ILogger logger)
        {
            logger.WriteEntry("Started sky.it 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;
                var channelShows = Grab(p, logger).OrderBy(x => x.StartTime).ToList();
                FixShowsEndTimeByStartTime(channelShows);
                shows.AddRange(channelShows);
            }

            logger.WriteEntry("Finshed sky.it grab", LogType.Info);
            return(shows);
        }
コード例 #2
0
        public override List<Show> Grab(string xmlParameters, ILogger logger)
        {
            logger.WriteEntry("Started sky.it 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;
                var channelShows = Grab(p, logger).OrderBy(x => x.StartTime).ToList() ;
                FixShowsEndTimeByStartTime(channelShows);
                shows.AddRange(channelShows);
            }

            logger.WriteEntry("Finshed sky.it grab", LogType.Info);
            return shows;
        }