internal static WebChannelDetailed ChannelDetailed(IChannel channel)
        {
            IProgramInfoAsync programInfo = ServiceRegistration.Get <ITvProvider>() as IProgramInfoAsync;

            var             programs        = programInfo.GetNowNextProgramAsync(channel).Result;
            WebChannelBasic webChannelBasic = BaseChannelBasic.ChannelBasic(channel);

            WebChannelDetailed webChannelDetailed = new WebChannelDetailed
            {
                // From Basic
                Id      = webChannelBasic.Id,
                IsRadio = webChannelBasic.IsRadio,
                IsTv    = webChannelBasic.IsTv,
                Title   = webChannelBasic.Title,

                CurrentProgram   = ProgramDetailed(programs.Result[0]),
                NextProgram      = ProgramDetailed(programs.Result[1]),
                EpgHasGaps       = channel.EpgHasGaps,
                ExternalId       = channel.ExternalId,
                GrabEpg          = channel.GrapEpg,
                GroupNames       = channel.GroupNames,
                LastGrabTime     = channel.LastGrabTime ?? DateTime.Now,
                TimesWatched     = channel.TimesWatched,
                TotalTimeWatched = channel.TotalTimeWatched ?? DateTime.Now,
                VisibleInGuide   = channel.VisibleInGuide,
            };

            return(webChannelDetailed);
        }
Beispiel #2
0
        public TVGuideChannelViewModel(WebChannelDetailed channel, DateTime guideStart, DateTime guideEnd)
        {
            Id          = channel.Id;
            DisplayName = channel.Title;

            programList = Connections.Current.TAS.GetProgramsDetailedForChannel(Id, guideStart, guideEnd);
            Programs    = programList.Select(x => new TVGuideProgramViewModel(x, guideStart, guideEnd));
        }
Beispiel #3
0
        public override string GetVideoUrl(VideoInfo video)
        {
            var    type       = MpExtendedStreamingService.WebMediaType.File;
            int    providerId = 0;
            String itemId     = null;
            bool   live       = false;

            if (video.Other is WebMovieBasic)
            {
                WebMovieBasic movie = video.Other as WebMovieBasic;
                type       = MpExtendedStreamingService.WebMediaType.Movie;
                providerId = movie.PID;
                itemId     = movie.Id;
            }
            else if (video.Other is WebTVEpisodeBasic)
            {
                WebTVEpisodeBasic ep = video.Other as WebTVEpisodeBasic;
                type       = MpExtendedStreamingService.WebMediaType.TVEpisode;
                providerId = ep.PID;
                itemId     = ep.Id;
            }
            else if (video.Other is WebChannelDetailed)
            {
                WebChannelDetailed channel = video.Other as WebChannelDetailed;
                type       = MpExtendedStreamingService.WebMediaType.TV;
                providerId = 0;
                itemId     = channel.Id.ToString();
                live       = true;
            }

            if (mediaStreaming.AuthorizeStreaming().Result == true)
            {
                video.PlaybackOptions = new Dictionary <string, string>();
                foreach (var profile in mediaStreaming.GetTranscoderProfilesForTarget("pc-flash-video"))
                {
                    video.PlaybackOptions.Add(profile.Name, new MPUrlSourceFilter.HttpUrl(
                                                  string.Format("http://{0}:{1}/MPExtended/StreamingService/stream/DoStream?type={2}&provider={3}&itemId={4}&clientDescription={5}&profileName={6}&startPosition={7}",
                                                                mServer,
                                                                mPort,
                                                                (int)type,
                                                                providerId,
                                                                HttpUtility.UrlEncode(itemId),
                                                                HttpUtility.UrlEncode("OnlineVideos client"),
                                                                HttpUtility.UrlEncode(profile.Name), 0))
                                              /*{ LiveStream = live }*/.ToString());
                }
                return(video.PlaybackOptions.Select(p => p.Value).FirstOrDefault());
            }

            throw new OnlineVideosException("No authorization");
        }
Beispiel #4
0
 public Channel(WebChannelDetailed ch)
     : this(ch.IdChannel, ch.DisplayName, ch.DisplayName, ch.IsTv, ch.IsRadio)
 {
 }