Beispiel #1
0
        public VideoDetails GetDetails()
        {
            VideoDetails details = IMDbAPI.GetVideo(this.session, this.ID);

            if (details.Image == null)
            {
                details.Image = this.Image;
            }

            return(details);
        }
Beispiel #2
0
        public override string GetVideoUrl(VideoInfo video)
        {
            string       videoUrl = string.Empty;
            VideoDetails clip     = video.Other as VideoDetails;

            if (clip == null)
            {
                clip        = IMDbAPI.GetVideo(apiSession, video.VideoUrl);
                video.Other = clip;
            }

            Dictionary <string, string> files = new Dictionary <string, string>();

            foreach (KeyValuePair <VideoFormat, string> file in clip.Files)
            {
                // todo: how can I resolve the actual video url on playback instead of here?
                files[file.Key.ToString()] = IMDbAPI.GetVideoFile(apiSession, file.Value);
            }

            // no files
            if (files.Count == 0)
            {
                return(videoUrl);
            }

            if (AlwaysPlaybackPreferredQuality)
            {
                if (files.Count > 0 && !files.TryGetValue(PreferredVideoQuality.ToString(), out videoUrl))
                {
                    video.PlaybackOptions = files;
                    videoUrl = files.Values.ToArray()[files.Count - 1];
                }
            }
            else
            {
                video.PlaybackOptions = files;
                if (files.Count > 0 && !files.TryGetValue(PreferredVideoQuality.ToString(), out videoUrl))
                {
                    videoUrl = files.Values.ToArray()[files.Count - 1];
                }
            }

            return(videoUrl);
        }