Added MetadataResult.QueriedById property

pull/702/head
softworkz 8 years ago
parent 896cc59936
commit 9f5cf9de0c

@ -21,6 +21,7 @@ namespace MediaBrowser.Controller.Providers
public bool HasMetadata { get; set; } public bool HasMetadata { get; set; }
public T Item { get; set; } public T Item { get; set; }
public string ResultLanguage { get; set; } public string ResultLanguage { get; set; }
public bool QueriedById { get; set; }
public void AddPerson(PersonInfo p) public void AddPerson(PersonInfo p)
{ {
if (People == null) if (People == null)

@ -696,7 +696,7 @@ namespace MediaBrowser.Providers.Manager
// prioritize results with matching ResultLanguage // prioritize results with matching ResultLanguage
foreach (var result in results) foreach (var result in results)
{ {
if (!string.IsNullOrEmpty(result.ResultLanguage) && result.ResultLanguage == id.MetadataLanguage) if (!string.IsNullOrEmpty(result.ResultLanguage) && result.ResultLanguage == id.MetadataLanguage && result.QueriedById)
{ {
orderedResults.Add(result); orderedResults.Add(result);
} }

@ -212,13 +212,15 @@ namespace MediaBrowser.Providers.Omdb
{ {
var result = new MetadataResult<Series> var result = new MetadataResult<Series>
{ {
Item = new Series() Item = new Series(),
QueriedById = true
}; };
var imdbId = info.GetProviderId(MetadataProviders.Imdb); var imdbId = info.GetProviderId(MetadataProviders.Imdb);
if (string.IsNullOrWhiteSpace(imdbId)) if (string.IsNullOrWhiteSpace(imdbId))
{ {
imdbId = await GetSeriesImdbId(info, cancellationToken).ConfigureAwait(false); imdbId = await GetSeriesImdbId(info, cancellationToken).ConfigureAwait(false);
result.QueriedById = false;
} }
if (!string.IsNullOrEmpty(imdbId)) if (!string.IsNullOrEmpty(imdbId))
@ -251,13 +253,15 @@ namespace MediaBrowser.Providers.Omdb
{ {
var result = new MetadataResult<T> var result = new MetadataResult<T>
{ {
Item = new T() Item = new T(),
QueriedById = true
}; };
var imdbId = info.GetProviderId(MetadataProviders.Imdb); var imdbId = info.GetProviderId(MetadataProviders.Imdb);
if (string.IsNullOrWhiteSpace(imdbId)) if (string.IsNullOrWhiteSpace(imdbId))
{ {
imdbId = await GetMovieImdbId(info, cancellationToken).ConfigureAwait(false); imdbId = await GetMovieImdbId(info, cancellationToken).ConfigureAwait(false);
result.QueriedById = false;
} }
if (!string.IsNullOrEmpty(imdbId)) if (!string.IsNullOrEmpty(imdbId))

@ -43,7 +43,8 @@ namespace MediaBrowser.Providers.TV
{ {
var result = new MetadataResult<Episode>() var result = new MetadataResult<Episode>()
{ {
Item = new Episode() Item = new Episode(),
QueriedById = true
}; };
// Allowing this will dramatically increase scan times // Allowing this will dramatically increase scan times

@ -91,6 +91,7 @@ namespace MediaBrowser.Providers.TV
var response = await GetEpisodeInfo(seriesTmdbId, seasonNumber.Value, episodeNumber.Value, info.MetadataLanguage, cancellationToken).ConfigureAwait(false); var response = await GetEpisodeInfo(seriesTmdbId, seasonNumber.Value, episodeNumber.Value, info.MetadataLanguage, cancellationToken).ConfigureAwait(false);
result.HasMetadata = true; result.HasMetadata = true;
result.QueriedById = true;
if (!string.IsNullOrEmpty(response.overview)) if (!string.IsNullOrEmpty(response.overview))
{ {

@ -119,6 +119,7 @@ namespace MediaBrowser.Providers.TV
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken) public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
{ {
var result = new MetadataResult<Series>(); var result = new MetadataResult<Series>();
result.QueriedById = true;
var tmdbId = info.GetProviderId(MetadataProviders.Tmdb); var tmdbId = info.GetProviderId(MetadataProviders.Tmdb);
@ -154,6 +155,7 @@ namespace MediaBrowser.Providers.TV
if (string.IsNullOrEmpty(tmdbId)) if (string.IsNullOrEmpty(tmdbId))
{ {
result.QueriedById = false;
var searchResults = await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(info, cancellationToken).ConfigureAwait(false); var searchResults = await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(info, cancellationToken).ConfigureAwait(false);
var searchResult = searchResults.FirstOrDefault(); var searchResult = searchResults.FirstOrDefault();

@ -108,6 +108,7 @@ namespace MediaBrowser.Providers.TV
public async Task<MetadataResult<Episode>> GetMetadata(EpisodeInfo searchInfo, CancellationToken cancellationToken) public async Task<MetadataResult<Episode>> GetMetadata(EpisodeInfo searchInfo, CancellationToken cancellationToken)
{ {
var result = new MetadataResult<Episode>(); var result = new MetadataResult<Episode>();
result.QueriedById = true;
if (TvdbSeriesProvider.IsValidSeries(searchInfo.SeriesProviderIds) && if (TvdbSeriesProvider.IsValidSeries(searchInfo.SeriesProviderIds) &&
(searchInfo.IndexNumber.HasValue || searchInfo.PremiereDate.HasValue)) (searchInfo.IndexNumber.HasValue || searchInfo.PremiereDate.HasValue))

@ -93,9 +93,11 @@ namespace MediaBrowser.Providers.TV
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo itemId, CancellationToken cancellationToken) public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo itemId, CancellationToken cancellationToken)
{ {
var result = new MetadataResult<Series>(); var result = new MetadataResult<Series>();
result.QueriedById = true;
if (!IsValidSeries(itemId.ProviderIds)) if (!IsValidSeries(itemId.ProviderIds))
{ {
result.QueriedById = false;
await Identify(itemId).ConfigureAwait(false); await Identify(itemId).ConfigureAwait(false);
} }

Loading…
Cancel
Save