从电影数据库中获取电影的英文作品

时间:2016-09-19 18:17:58

标签: c#

我正在尝试从电影数据库https://www.themoviedb.org/下载电影海报以获取电影列表。对于某些电影,下载的艺术品不是英文版。如何确保下载的每件艺术品都是英文的?

我正在使用TMDbLib。

我的代码目前如下:

WebClient webClient = new WebClient();
SearchContainer<SearchMovie> results = client.SearchMovie("Guardians of the Galaxy");
string year = "2014";

TMDbConfig cfg = new TMDbConfig();
Movie movie = new Movie();
string uri = "";
foreach (SearchMovie result in results.Results)
{
     movie = client.GetMovie(result.Id, MovieMethods.Credits | MovieMethods.Keywords | MovieMethods.Images | MovieMethods.Videos | MovieMethods.Reviews | MovieMethods.Releases);
     DateTime value = Convert.ToDateTime(movie.ReleaseDate);

     uri = GetMediaInformation.FetchImage(result.Id).ToString();
     Console.WriteLine(uri);
     if (year == value.Year.ToString())
         break;
 }
 byte[] bytes = webClient.DownloadData(uri);
 MemoryStream ms = new MemoryStream(bytes);
 Image artWork = Image.FromStream(ms);

返回以下图片: enter image description here

1 个答案:

答案 0 :(得分:1)

您应该只能将默认语言设置为英语,如下所示:

client.DefaultLanguage = "en";

请注意,根据this issue

,这是区分大小写的