Example #1
0
        public override async Task <AsyncResult <IList <IChannel> > > GetChannelsAsync(IChannelGroup group)
        {
            await _initComplete.Task;

            List <IChannel> channels;

            if (group.ChannelGroupId < 0)
            {
                var radioGroup    = RadioChannelGroup.Retrieve(-group.ChannelGroupId);
                var radioChannels = radioGroup.ReferringRadioGroupMap().OrderBy(rgm => rgm.SortOrder).Select(rgm => rgm.ReferencedChannel());
                channels = radioChannels
                           .Where(c => c.VisibleInGuide)
                           .Select(c => c.ToChannel())
                           .Where(c => c != null)
                           .ToList();
            }
            else
            {
                channels = _tvBusiness.GetChannelsInGroup(TvDatabase.ChannelGroup.Retrieve(group.ChannelGroupId))
                           .Where(c => c != null)
                           // Bug? SortOrder contains logical channel number, not the group sort order?
                           // .OrderBy(c => c.SortOrder)
                           .Where(c => c.VisibleInGuide)
                           .Select(c => c.ToChannel())
                           .ToList();
            }
            return(new AsyncResult <IList <IChannel> >(true, channels));
        }
Example #2
0
        public List <WebMiniEPG> GetRadioMiniEPGForGroup(int idGroup)
        {
            List <WebMiniEPG> ret = new List <WebMiniEPG>();

            if (!ConnectToDatabase())
            {
                return(ret);
            }
            RadioChannelGroup group = null;

            try
            {
                group = RadioChannelGroup.Retrieve(idGroup);
            }
            catch (Exception)
            {
            }
            if (group == null)
            {
                return(ret);
            }

            IList <RadioGroupMap> maps = group.ReferringRadioGroupMap();

            foreach (RadioGroupMap map in maps)
            {
                ret.Add(new WebMiniEPG(map.ReferencedChannel()));
            }
            return(ret);
        }
Example #3
0
        public List <WebChannel> GetChannelsInRadioGroup(int idGroup)
        {
            List <WebChannel> channels = new List <WebChannel>();

            if (!ConnectToDatabase())
            {
                return(channels);
            }
            RadioChannelGroup group = null;

            try
            {
                group = RadioChannelGroup.Retrieve(idGroup);
            }
            catch (Exception)
            {
            }
            if (group == null)
            {
                return(channels);
            }
            IList <RadioGroupMap> maps = group.ReferringRadioGroupMap();

            foreach (RadioGroupMap map in maps)
            {
                channels.Add(new WebChannel(map.ReferencedChannel()));
            }
            return(channels);
        }
Example #4
0
        public static RadioChannelGroup ToRadioChannelGroup(this WebChannelGroup group)
        {
            if (group == null)
            {
                return(null);
            }

            return(RadioChannelGroup.Retrieve(group.Id));
        }
Example #5
0
 public override bool GetChannels(IChannelGroup group, out IList <IChannel> channels)
 {
     if (group.ChannelGroupId < 0)
     {
         var radioGroup    = RadioChannelGroup.Retrieve(-group.ChannelGroupId);
         var radioChannels = radioGroup.ReferringRadioGroupMap().OrderBy(rgm => rgm.SortOrder).Select(rgm => rgm.ReferencedChannel());
         channels = radioChannels
                    .Where(c => c.VisibleInGuide)
                    .Select(c => c.ToChannel())
                    .ToList();
     }
     else
     {
         channels = _tvBusiness.GetChannelsInGroup(TvDatabase.ChannelGroup.Retrieve(group.ChannelGroupId))
                    // Bug? SortOrder contains logical channel number, not the group sort order?
                    // .OrderBy(c => c.SortOrder)
                    .Where(c => c.VisibleInGuide)
                    .Select(c => c.ToChannel())
                    .ToList();
     }
     return(true);
 }
Example #6
0
 public WebChannelGroup GetRadioGroupById(int groupId)
 {
     return(RadioChannelGroup.Retrieve(groupId).ToWebChannelGroup());
 }