Esempio n. 1
0
        private IEnumerable <SelectListItem> GetProfileSelectList(StreamingProfileType type)
        {
            var service          = type == StreamingProfileType.Tv ? Connections.Current.TASStreamControl : Connections.Current.MASStreamControl;
            var defaultProfile   = Configuration.StreamingPlatforms.GetDefaultProfileForPlatform(type, Name);
            var targets          = type == StreamingProfileType.Audio ? StreamTarget.GetAllTargets() : StreamTarget.GetVideoTargets();
            var supportedTargets = Configuration.StreamingPlatforms.GetValidTargetsForPlatform(Name).Intersect(targets.Select(x => x.Name));

            return(ProfileModel.GetProfilesForTargets(service, supportedTargets)
                   .Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.Name, Selected = x.Name == defaultProfile
            })
                   .OrderBy(x => x.Text));
        }
Esempio n. 2
0
        private void SetDefaultProfile(StreamingProfileType type, StreamingPlatform platform, string profile)
        {
            if (platform == null)
            {
                return;
            }

            var methods = new Dictionary <StreamingProfileType, Action <StreamingPlatform, string> >()
            {
                { StreamingProfileType.Audio, (x, y) => x.DefaultAudioProfile = y },
                { StreamingProfileType.Video, (x, y) => x.DefaultVideoProfile = y },
                { StreamingProfileType.Tv, (x, y) => x.DefaultTvProfile = y },
            };

            methods[type].Invoke(platform, profile);
        }
Esempio n. 3
0
        private string GetDefaultProfile(StreamingProfileType type, StreamingPlatform platform)
        {
            if (platform == null)
            {
                return(null);
            }

            var methods = new Dictionary <StreamingProfileType, Func <StreamingPlatform, string> >()
            {
                { StreamingProfileType.Audio, x => x.DefaultAudioProfile },
                { StreamingProfileType.Video, x => x.DefaultVideoProfile },
                { StreamingProfileType.Tv, x => x.DefaultTvProfile },
            };

            return(methods[type].Invoke(platform));
        }
Esempio n. 4
0
 public void SetDefaultProfileForPlatform(StreamingProfileType type, string platform, string profile)
 {
     SetDefaultProfile(type, this.FirstOrDefault(x => x.Name == platform), profile);
 }
Esempio n. 5
0
 public string GetDefaultProfileForPlatform(StreamingProfileType type, string platform)
 {
     return(GetDefaultProfile(type, this.FirstOrDefault(x => x.Name == platform)));
 }
Esempio n. 6
0
 public string GetDefaultProfileForUserAgent(StreamingProfileType type, string userAgent)
 {
     return(GetDefaultProfile(type, this.FirstOrDefault(x => x.MatchesUserAgent(userAgent))));
 }
 private IEnumerable<SelectListItem> GetProfileSelectList(StreamingProfileType type)
 {
     var service = type == StreamingProfileType.Tv ? Connections.Current.TASStreamControl : Connections.Current.MASStreamControl;
     var defaultProfile = Configuration.StreamingPlatforms.GetDefaultProfileForPlatform(type, Name);
     var targets = type == StreamingProfileType.Audio ? StreamTarget.GetAllTargets() : StreamTarget.GetVideoTargets();
     var supportedTargets =  Configuration.StreamingPlatforms.GetValidTargetsForPlatform(Name).Intersect(targets.Select(x => x.Name));
     return ProfileModel.GetProfilesForTargets(service, supportedTargets)
         .Select(x => new SelectListItem() { Text = x.Name, Value = x.Name, Selected = x.Name == defaultProfile })
         .OrderBy(x => x.Text);
 }