Example #1
0
 public override string GetVideoUrl(OnlineVideos.VideoInfo video)
 {
     if (video.VideoUrl.Contains("/vp/"))
     {
         return(String.Format(videoUrlFormatString, video.VideoUrl.Substring(video.VideoUrl.LastIndexOf("#") + 1)));
     }
     else
     {
         return(String.Format(videoUrlFormatString, new Uri(video.VideoUrl).Segments.Last().Trim('/')));
     }
 }
Example #2
0
        public override string GetVideoUrl(OnlineVideos.VideoInfo video)
        {
            video.PlaybackOptions = new Dictionary <string, string>();
            var    tokenDataJson  = GetWebData <JToken>(string.Format(tokenUrl, video.VideoUrl), headers: customHeader);
            var    token          = tokenDataJson["token"];
            var    sig            = tokenDataJson["sig"];
            string hlsPlaylistUrl = string.Format(playlistUrl, video.VideoUrl, HttpUtility.UrlEncode(token.ToString()), sig);
            var    m3u8Data       = GetWebData(hlsPlaylistUrl);

            video.PlaybackOptions = HlsPlaylistParser.GetPlaybackOptions(m3u8Data, hlsPlaylistUrl);
            return(video.GetPreferredUrl(false));
        }
Example #3
0
        public override string GetVideoUrl(OnlineVideos.VideoInfo video)
        {
            video.PlaybackOptions = new Dictionary <string, string>();
            var    tokenDataJson  = GetWebData <JToken>(string.Format(tokenUrl, video.VideoUrl), headers: customHeader);
            var    token          = tokenDataJson["token"];
            var    sig            = tokenDataJson["sig"];
            string hlsPlaylistUrl = string.Format(playlistUrl, video.VideoUrl, HttpUtility.UrlEncode(token.ToString()), sig);
            var    m3u8Data       = GetWebData(hlsPlaylistUrl);

            foreach (Match match in Regex.Matches(m3u8Data, m3u8Regex))
            {
                video.PlaybackOptions.Add(
                    string.Format("{0} - {1} kbps", match.Groups["quality"].Value, int.Parse(match.Groups["bitrate"].Value) / 1000),
                    match.Groups["url"].Value);
            }

            return(video.PlaybackOptions.Select(p => p.Value).FirstOrDefault());
        }
Example #4
0
        public Video(OnlineVideos.VideoInfo videoInfo, bool useTitle2 = false)
        {
            Model = videoInfo;

            videoInfo.CleanDescriptionAndTitle();

            Name           = useTitle2 ? ((OnlineVideos.DetailVideoInfo)videoInfo).Title2 : videoInfo.Title;
            Description    = videoInfo.Description;
            ThumbnailImage = videoInfo.ThumbnailImage;
            Length         = videoInfo.Length;
            Airdate        = videoInfo.Airdate;

            // we cannot attach directly to the PropertyChanged event of the Model as it is in another domain and PropertyChangedEventArgs is not serializable
            eventDelegator = OnlineVideosAppDomain.Domain.CreateInstanceAndUnwrap(typeof(PropertyChangedDelegator).Assembly.FullName, typeof(PropertyChangedDelegator).FullName) as PropertyChangedDelegator;
            eventDelegator.InvokeTarget = new PropertyChangedExecutor()
            {
                InvokeHandler = ModelPropertyChanged
            };
            Model.PropertyChanged += eventDelegator.EventDelegate;
        }
Example #5
0
 public PlayListItem(OnlineVideos.VideoInfo video, OnlineVideos.Sites.SiteUtilBase util)
 {
     Video = video;
     Util  = util;
 }
Example #6
0
 public override ContextMenuExecutionResult ExecuteContextMenuEntry(Category selectedCategory, OnlineVideos.VideoInfo selectedItem, ContextMenuEntry choice)
 {
     if (choice != null && choice.DisplayText.StartsWith("Mehr "))
     {
         currentVideoTitle = choice.DisplayText;
         return(new ContextMenuExecutionResult()
         {
             ResultItems =
                 GetVideosFromApiUrl(GetApiUrl("myvideo.videos.list_by_user", new NameValueCollection()
             {
                 { "user", choice.Other as string }
             }))
                 .ConvertAll <SearchResultItem>(v => v as SearchResultItem)
         });
     }
     return(null);
 }
Example #7
0
        public override List <ContextMenuEntry> GetContextMenuEntries(Category selectedCategory, OnlineVideos.VideoInfo selectedItem)
        {
            List <ContextMenuEntry> result = new List <ContextMenuEntry>();

            if (selectedItem != null && !string.IsNullOrEmpty(selectedItem.Other as string))
            {
                result.Add(new ContextMenuEntry()
                {
                    DisplayText = "Mehr " + selectedItem.Description, Other = selectedItem.Other
                });
            }
            return(result);
        }