Пример #1
0
        public List <DetailVideoInfo> GetVideoChoices(VideoInfo video)
        {
            List <DetailVideoInfo> clips = new List <DetailVideoInfo>();

            TitleDetails title = IMDbAPI.GetTitle(apiSession, video.VideoUrl as string);

            video.Other       = title;
            video.Title       = title.Title;
            video.Description = title.Plot;
            if (!string.IsNullOrEmpty(title.Image))
            {
                video.Thumb = getResizedImage(title.Image);
            }

            List <VideoReference> videos = title.GetVideos();

            if (videos != null)
            {
                foreach (VideoReference clip in videos)
                {
                    if (clip.Description == null)
                    {
                        clip.Description = video.Description;
                    }

                    DetailVideoInfo vid = new DetailVideoInfo();
                    vid.Other       = clip;
                    vid.Title       = title.Title + " - " + clip.Title;
                    vid.Title2      = clip.Title;
                    vid.Description = clip.Description;

                    vid.Thumb    = clip.Image;
                    vid.VideoUrl = clip.ID;
                    vid.Length   = clip.Duration.ToString();
                    clips.Add(vid);
                }
            }

            return(clips);
        }
Пример #2
0
        public override List <SearchResultItem> Search(string query, string category = null)
        {
            var videos = new List <SearchResultItem>();

            // check if we have an IMDb in the search query
            string id = IMDbAPI.ParseTitleConst(query);

            if (id != null)
            {
                // we found an IMDb id so we do a details request
                TitleDetails title = IMDbAPI.GetTitle(apiSession, id);
                VideoInfo    video = new VideoInfo();
                video.Other       = title;
                video.Title       = title.Title;
                video.Description = title.Plot;
                video.Thumb       = getResizedImage(title.Image);
                video.VideoUrl    = title.ID;

                videos.Add(video);

                // return the result
                return(videos);
            }

            SearchResults results = IMDbAPI.Search(apiSession, query);

            foreach (ResultType key in results.Titles.Keys)
            {
                var titles = results.Titles[key];
                foreach (TitleReference title in titles)
                {
                    VideoInfo video = createVideoInfoFromTitleReference(title);
                    videos.Add(video);
                }
            }

            return(videos);
        }
Пример #3
0
 public virtual TitleDetails GetDetails()
 {
     return(IMDbAPI.GetTitle(this.session, this.ID));
 }