Exemple #1
0
        private bool ProcessPage(string input, string id, bool skipImages, string link, string title, string originalTitle)
        {
            bool _result = false;

            if (!string.IsNullOrEmpty(input))
            {
                MovieInfo _movieInfo = GetMovieInfo(input);

                if (!string.IsNullOrEmpty(this.IMDBID) && !string.IsNullOrEmpty(_movieInfo.IMDBID) && this.IMDBID != _movieInfo.IMDBID)
                {
                    return(false);
                }

                // extra for torec... eliminate duplicates
                var _items = from c in ResultsList
                             where c.MovieInfo.IMDBID == _movieInfo.IMDBID
                             select c;
                if (_items != null && _items.Count() != 0)
                {
                    return(false);
                }


                string _imageUrl = string.Format("{0}{1}", Host, GetCoverLink(input));

                if (string.IsNullOrEmpty(_movieInfo.Name))
                {
                    _movieInfo.Name = title;
                }
                if (string.IsNullOrEmpty(_movieInfo.OriginalTitle))
                {
                    _movieInfo.OriginalTitle = originalTitle;
                }

                if (!string.IsNullOrEmpty(_movieInfo.Name))
                {
                    ResultMovieItem _movieItem = new ResultMovieItem(id, _movieInfo.Name, _imageUrl, this.CollectorName);
                    _movieItem.MovieInfo         = _movieInfo;
                    _movieItem.CollectorMovieUrl = link;
                    ResultsList.Add(_movieItem);
                    _result = true;
                }

                if (!skipImages && !string.IsNullOrEmpty(VisualSectionRegex))
                {
                    // process the VisualSection if any
                    bool _res = ProcessVisualSection(GetItem(input, VisualSectionRegex, 1), _movieInfo, id);
                    if (_res)
                    {
                        _result = true;
                    }
                }
            }

            return(_result);
        }
Exemple #2
0
        public override bool GetResults(string keywords, string imdbID, bool skipImages)
        {
            bool result = false;

            try
            {
                var api  = new AlloCineApi();
                var feed = api.Search(keywords);
                if (feed.Error == null)
                {
                    foreach (var movie in feed.MovieList)
                    {
                        if (FileManager.CancellationPending)
                        {
                            return(ResultsList.Count != 0);
                        }
                        try
                        {
                            string id            = movie.Code;
                            string originalTitle = movie.OriginalTitle;
                            string title         = movie.Title;
                            title = string.IsNullOrEmpty(title) ? originalTitle : title;
                            MovieInfo movieInfo  = GetMovieInfo(id);
                            string    posterPath = movie.Poster.Href;
                            string    imageUrl   = string.IsNullOrEmpty(posterPath) ? null : posterPath;

                            var movieItem = new ResultMovieItem(id, title, imageUrl, CollectorName);
                            movieItem.CollectorMovieUrl = id != null?GetMovieUrl(id) : null;

                            movieItem.MovieInfo = movieInfo;
                            ResultsList.Add(movieItem);
                            result = true;
                        }
                        catch (Exception ex)
                        {
                            Loggy.Logger.DebugException("Allocine iteration: ", ex);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Loggy.Logger.DebugException("Allocine results: ", ex);
            }

            return(result);
        }