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); } }
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); }
protected override MovieInfo GetMovieInfo(string input) { // input is the id of the movie var _result = new MovieInfo(); if (string.IsNullOrEmpty(input)) { return(_result); } var id = -1; if (!int.TryParse(input, out id)) { return(_result); } var api = new AlloCineApi(); var movie = api.MovieGetInfo(id); if (movie.Error != null) { return(_result); } try { _result.OriginalTitle = movie.OriginalTitle; string _title = movie.Title; _result.Name = string.IsNullOrEmpty(_title) ? _result.OriginalTitle : _title; _result.Year = movie.ProductionYear; if (movie.Release != null) { _result.ReleaseDate = movie.Release.ReleaseDate; } if (movie.Trailer != null) { _result.Trailer = movie.Trailer.Href; } _result.Countries = movie.NationalityList.Select(x => x.Value).ToList(); _result.Genre = movie.GenreList.Select(x => x.Value).ToList(); //_result.Cast = movie.CastMemberList.Take(Math.Max(movie.CastMemberList.Count, 5)).Select(x => x.Person.Name).ToList(); _result.Cast = movie.CastingShort.Actors.Split(',').ToTrimmedList(); _result.Director = movie.CastingShort.Directors.Split(',').ToTrimmedList(); int _minutes = 0; Int32.TryParse(movie.Runtime, out _minutes); _result.Runtime = Math.Abs(_minutes / 60).ToString(); if (movie.Statistics != null) { string _r = movie.Statistics.UserRating; if (!string.IsNullOrEmpty(_r)) { _result.Rating = _r; _result.Rating = (_result.dRating * 2).ToString(); } } _result.Overview = movie.SynopsisShort; if (string.IsNullOrEmpty(_result.Overview)) { _result.Overview = movie.Synopsis; } else { _result.Comments = movie.Synopsis; } // backdrops movie.MediaList .Where(x => x.Type != null && x.Type.Code == "31006" && x.Thumbnail != null) .Select(x => x.Thumbnail.Href).ToList() .ForEach(x => { var _bi = new BackdropItem(input, null, this.CollectorName, x, x); BackdropsList.Add(_bi); }); } catch (Exception ex) { Loggy.Logger.DebugException("Allocine: ", ex); } return(_result); }