Exemple #1
0
        public imdbdata GetImdbData(string imdbId)
        {
            imdbdata _result = null;

            if (FileManager.DisableOpenSubtitles)
            {
                return(null);
            }

            imdbId = FixImdbId(imdbId);

            if (!string.IsNullOrEmpty(imdbId))
            {
                imdbheader _header = null;
                try
                {
                    _header = m_osdbProxy.GetIMDBMovieDetails(m_Token, imdbId);
                }
                catch { }
                if (_header != null)
                {
                    _result = _header.data;
                }
            }

            return(_result);
        }
Exemple #2
0
        public static MovieInfo GetIMDbData(string movieFilename, string imdbId)
        {
            MovieInfo _result = new MovieInfo();

            if (FileManager.DisableOpenSubtitles)
            {
                return(null);
            }

            imdbId = FixImdbId(imdbId);
            using (SubtitlesManager _subMan = new SubtitlesManager())
            {
                string _imdbId = string.IsNullOrEmpty(imdbId) ? _subMan.GetImdbIdByMovieHash(movieFilename) : imdbId;
                if (!string.IsNullOrEmpty(_imdbId))
                {
                    imdbdata _data = _subMan.GetImdbData(_imdbId);
                    if (_data != null)
                    {
                        if (_data.cast != null && _data.cast.Count > 0)
                        {
                            _result.Cast = _data.cast.Values.Cast <string>().ToList <string>();
                        }
                        if (_data.directors != null && _data.directors.Count > 0)
                        {
                            _result.Director = _data.directors.Values.Cast <string>().ToList <string>();
                        }
                        if (_data.genres != null && _data.genres.Length > 0)
                        {
                            _result.Genre = _data.genres.ToList <string>();
                        }
                        if (_data.country != null && _data.country.Length > 0)
                        {
                            _result.Countries = _data.country.ToList <string>();
                        }
                        if (!string.IsNullOrEmpty(_data.id))
                        {
                            _result.IMDBID = "tt" + _data.id.PadLeft(7, '0');
                        }
                        _result.Name = _data.title;

                        _result.Overview    = _data.plot.Replace("full summary | add synopsis", "").Trim();
                        _result.Rating      = _data.rating;
                        _result.ReleaseDate = _data.year;
                        _result.Runtime     = _data.duration;
                        _result.Year        = _data.year;
                    }
                }
            }
            return(_result);
        }