Example #1
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);
        }
Example #2
0
        private void buttonVariousCalls_Click(object sender, EventArgs e)
        {
            textBox1.Clear();

            //"ah si j'etais riche" = 42346
            var api = new AlloCineApi();

            textBox1.AppendText("//Look for anything in Allocine that contains 'riche'");
            var alFeed = api.Search("riche", new[] { TypeFilters.Movie }, 8, 1);

            if (alFeed.Error != null)
            {
                textBox1.AppendText("\r\n" + alFeed.Error.Value);
            }
            else
            {
                foreach (var mov in alFeed.MovieList)
                {
                    textBox1.AppendText("\r\n" + mov.Code + "\t" + mov.OriginalTitle + "\t");
                }
            }

            textBox1.AppendText("\r\n\r\n\r\n//Retrieve the details of the Movie 'Ah si j'etais riche");
            var alMovie = api.MovieGetInfo(42346, ResponseProfiles.Large, new[] { TypeFilters.Movie, TypeFilters.News }, new[] { "synopsis" }, new[] { MediaFormat.Mpeg2 });

            if (alMovie.Error != null)
            {
                textBox1.AppendText("\r\n" + alMovie.Error.Value);
            }
            else
            {
                textBox1.AppendText("\r\n" + alMovie.Code + "\t" + alMovie.OriginalTitle + "\t" + alMovie.MovieType.Code);
            }

            textBox1.AppendText("\r\n\r\n\r\n//Retrieve the details about the TvSeries 'Lost'");
            var alTvSeries = api.TvSeriesGetInfo(223, ResponseProfiles.Large, new[] { "synopsis" }, null);

            if (alTvSeries.Error != null)
            {
                textBox1.AppendText("\r\n" + alTvSeries.Error.Value);
            }
            else
            {
                textBox1.AppendText("\r\n" + alTvSeries.Code + "\t" + alTvSeries.OriginalTitle + "\t" + alTvSeries.Title + "\t" + alTvSeries.OriginalBroadcast.DateStart);
            }
        }
Example #3
0
        public static FilmInfo GetFromTitleLight(string title, int index)
        {
            FilmInfo ans        = new FilmInfo();
            string   hexedTitle = TitleManipulator.HexIt(title);

            ans.HexedTitle = hexedTitle;
            ans.Key        = title;


            var alFeed = api.Search(hexedTitle, new[] { TypeFilters.Movie });

            if (alFeed.MovieList != null && alFeed.MovieList.Count >= index)
            {
                currCount = alFeed.MovieList.Count;

                Movie apiMovie = alFeed.MovieList[index - 1];

                apiMovie = api.MovieGetInfo(int.Parse(apiMovie.Code), ResponseProfiles.Large, new[] { TypeFilters.Movie }, new[] { "synopsis" }, new[] { MediaFormat.Mpeg2 });

                if (apiMovie.Error != null)
                {
                    throw new Exception(apiMovie.Error.Value);
                }

                ans.titre = apiMovie.Title;

                currMovie = apiMovie;
            }
            else
            {
                currCount = 0;

                if (alFeed.Error != null)
                {
                    throw new Exception(alFeed.Error.Value);
                }
            }

            return(ans);
        }