mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 22:17:25 -04:00
grab more info from the movie db for tv
This commit is contained in:
parent
a66ebdaa7c
commit
cc1ba34b4f
3 changed files with 50 additions and 12 deletions
|
@ -37,7 +37,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
private readonly ILocalizationManager _localization;
|
||||
|
||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
|
||||
|
||||
public MovieDbProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILogger logger, ILocalizationManager localization)
|
||||
{
|
||||
_jsonSerializer = jsonSerializer;
|
||||
|
@ -90,7 +90,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
remoteResult.ProductionYear = remoteResult.PremiereDate.Value.Year;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
remoteResult.SetProviderId(MetadataProviders.Tmdb, obj.id.ToString(_usCulture));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(obj.imdb_id))
|
||||
|
@ -286,8 +286,9 @@ namespace MediaBrowser.Providers.Movies
|
|||
url += string.Format("&language={0}", language);
|
||||
}
|
||||
|
||||
var includeImageLanguageParam = string.Join(",", imageLanguages.ToArray());
|
||||
// Get images in english and with no language
|
||||
url += "&include_image_language=" + string.Join(",", imageLanguages.ToArray());
|
||||
url += "&include_image_language=" + includeImageLanguageParam;
|
||||
|
||||
CompleteMovieData mainResult;
|
||||
|
||||
|
@ -312,7 +313,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
{
|
||||
_logger.Info("MovieDbProvider couldn't find meta for language " + language + ". Trying English...");
|
||||
|
||||
url = string.Format(GetMovieInfo3, id, ApiKey) + "&include_image_language=en,null&language=en";
|
||||
url = string.Format(GetMovieInfo3, id, ApiKey) + "&include_image_language=" + includeImageLanguageParam + "&language=en";
|
||||
|
||||
using (var json = await GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
|
@ -324,14 +325,9 @@ namespace MediaBrowser.Providers.Movies
|
|||
{
|
||||
mainResult = _jsonSerializer.DeserializeFromStream<CompleteMovieData>(json);
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(mainResult.overview))
|
||||
{
|
||||
_logger.Error("MovieDbProvider - Unable to find information for (id:" + id + ")");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mainResult;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ namespace MediaBrowser.Providers.TV
|
|||
}
|
||||
|
||||
result.Item.PremiereDate = seasonInfo.air_date;
|
||||
result.Item.ProductionYear = result.Item.PremiereDate.Value.Year;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace MediaBrowser.Providers.TV
|
|||
{
|
||||
public class MovieDbSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>, IHasOrder
|
||||
{
|
||||
private const string GetTvInfo3 = @"http://api.themoviedb.org/3/tv/{0}?api_key={1}&append_to_response=casts,images,keywords,external_ids";
|
||||
private const string GetTvInfo3 = @"http://api.themoviedb.org/3/tv/{0}?api_key={1}&append_to_response=credits,images,keywords,external_ids,videos";
|
||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
|
||||
internal static MovieDbSeriesProvider Current { get; private set; }
|
||||
|
@ -349,7 +349,7 @@ namespace MediaBrowser.Providers.TV
|
|||
if (fileInfo.Exists)
|
||||
{
|
||||
// If it's recent or automatic updates are enabled, don't re-download
|
||||
if ((DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(fileInfo)).TotalDays <= 7)
|
||||
if ((DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(fileInfo)).TotalDays <= 3)
|
||||
{
|
||||
return _cachedTask;
|
||||
}
|
||||
|
@ -464,10 +464,37 @@ namespace MediaBrowser.Providers.TV
|
|||
public class Season
|
||||
{
|
||||
public string air_date { get; set; }
|
||||
public int id { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public int season_number { get; set; }
|
||||
}
|
||||
|
||||
public class Cast
|
||||
{
|
||||
public string character { get; set; }
|
||||
public string credit_id { get; set; }
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
public int order { get; set; }
|
||||
}
|
||||
|
||||
public class Crew
|
||||
{
|
||||
public string credit_id { get; set; }
|
||||
public string department { get; set; }
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string job { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
}
|
||||
|
||||
public class Credits
|
||||
{
|
||||
public List<Cast> cast { get; set; }
|
||||
public List<Crew> crew { get; set; }
|
||||
}
|
||||
|
||||
public class Backdrop
|
||||
{
|
||||
public double aspect_ratio { get; set; }
|
||||
|
@ -484,6 +511,7 @@ namespace MediaBrowser.Providers.TV
|
|||
public double aspect_ratio { get; set; }
|
||||
public string file_path { get; set; }
|
||||
public int height { get; set; }
|
||||
public string id { get; set; }
|
||||
public string iso_639_1 { get; set; }
|
||||
public double vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
|
@ -496,6 +524,11 @@ namespace MediaBrowser.Providers.TV
|
|||
public List<Poster> posters { get; set; }
|
||||
}
|
||||
|
||||
public class Keywords
|
||||
{
|
||||
public List<object> results { get; set; }
|
||||
}
|
||||
|
||||
public class ExternalIds
|
||||
{
|
||||
public string imdb_id { get; set; }
|
||||
|
@ -505,6 +538,11 @@ namespace MediaBrowser.Providers.TV
|
|||
public int tvrage_id { get; set; }
|
||||
}
|
||||
|
||||
public class Videos
|
||||
{
|
||||
public List<object> results { get; set; }
|
||||
}
|
||||
|
||||
public class RootObject
|
||||
{
|
||||
public string backdrop_path { get; set; }
|
||||
|
@ -530,8 +568,11 @@ namespace MediaBrowser.Providers.TV
|
|||
public string status { get; set; }
|
||||
public double vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
public Credits credits { get; set; }
|
||||
public Images images { get; set; }
|
||||
public Keywords keywords { get; set; }
|
||||
public ExternalIds external_ids { get; set; }
|
||||
public Videos videos { get; set; }
|
||||
}
|
||||
|
||||
public int Order
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue