Added MetadataResult.QueriedById property
This commit is contained in:
parent
896cc59936
commit
9f5cf9de0c
|
@ -21,6 +21,7 @@ namespace MediaBrowser.Controller.Providers
|
|||
public bool HasMetadata { get; set; }
|
||||
public T Item { get; set; }
|
||||
public string ResultLanguage { get; set; }
|
||||
public bool QueriedById { get; set; }
|
||||
public void AddPerson(PersonInfo p)
|
||||
{
|
||||
if (People == null)
|
||||
|
|
|
@ -696,7 +696,7 @@ namespace MediaBrowser.Providers.Manager
|
|||
// prioritize results with matching ResultLanguage
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -212,13 +212,15 @@ namespace MediaBrowser.Providers.Omdb
|
|||
{
|
||||
var result = new MetadataResult<Series>
|
||||
{
|
||||
Item = new Series()
|
||||
Item = new Series(),
|
||||
QueriedById = true
|
||||
};
|
||||
|
||||
var imdbId = info.GetProviderId(MetadataProviders.Imdb);
|
||||
if (string.IsNullOrWhiteSpace(imdbId))
|
||||
{
|
||||
imdbId = await GetSeriesImdbId(info, cancellationToken).ConfigureAwait(false);
|
||||
result.QueriedById = false;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(imdbId))
|
||||
|
@ -251,13 +253,15 @@ namespace MediaBrowser.Providers.Omdb
|
|||
{
|
||||
var result = new MetadataResult<T>
|
||||
{
|
||||
Item = new T()
|
||||
Item = new T(),
|
||||
QueriedById = true
|
||||
};
|
||||
|
||||
var imdbId = info.GetProviderId(MetadataProviders.Imdb);
|
||||
if (string.IsNullOrWhiteSpace(imdbId))
|
||||
{
|
||||
imdbId = await GetMovieImdbId(info, cancellationToken).ConfigureAwait(false);
|
||||
result.QueriedById = false;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(imdbId))
|
||||
|
|
|
@ -43,7 +43,8 @@ namespace MediaBrowser.Providers.TV
|
|||
{
|
||||
var result = new MetadataResult<Episode>()
|
||||
{
|
||||
Item = new Episode()
|
||||
Item = new Episode(),
|
||||
QueriedById = true
|
||||
};
|
||||
|
||||
// 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);
|
||||
|
||||
result.HasMetadata = true;
|
||||
result.QueriedById = true;
|
||||
|
||||
if (!string.IsNullOrEmpty(response.overview))
|
||||
{
|
||||
|
|
|
@ -119,6 +119,7 @@ namespace MediaBrowser.Providers.TV
|
|||
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = new MetadataResult<Series>();
|
||||
result.QueriedById = true;
|
||||
|
||||
var tmdbId = info.GetProviderId(MetadataProviders.Tmdb);
|
||||
|
||||
|
@ -154,6 +155,7 @@ namespace MediaBrowser.Providers.TV
|
|||
|
||||
if (string.IsNullOrEmpty(tmdbId))
|
||||
{
|
||||
result.QueriedById = false;
|
||||
var searchResults = await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(info, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var searchResult = searchResults.FirstOrDefault();
|
||||
|
@ -194,7 +196,7 @@ namespace MediaBrowser.Providers.TV
|
|||
tmdbId = seriesInfo.id.ToString(_usCulture);
|
||||
|
||||
dataFilePath = GetDataFilePath(tmdbId, language);
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
|
||||
_jsonSerializer.SerializeToFile(seriesInfo, dataFilePath);
|
||||
|
||||
await EnsureSeriesInfo(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
||||
|
@ -326,7 +328,7 @@ namespace MediaBrowser.Providers.TV
|
|||
|
||||
var dataFilePath = GetDataFilePath(id, preferredMetadataLanguage);
|
||||
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
|
||||
|
||||
_jsonSerializer.SerializeToFile(mainResult, dataFilePath);
|
||||
}
|
||||
|
|
|
@ -108,6 +108,7 @@ namespace MediaBrowser.Providers.TV
|
|||
public async Task<MetadataResult<Episode>> GetMetadata(EpisodeInfo searchInfo, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = new MetadataResult<Episode>();
|
||||
result.QueriedById = true;
|
||||
|
||||
if (TvdbSeriesProvider.IsValidSeries(searchInfo.SeriesProviderIds) &&
|
||||
(searchInfo.IndexNumber.HasValue || searchInfo.PremiereDate.HasValue))
|
||||
|
|
|
@ -93,9 +93,11 @@ namespace MediaBrowser.Providers.TV
|
|||
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo itemId, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = new MetadataResult<Series>();
|
||||
result.QueriedById = true;
|
||||
|
||||
if (!IsValidSeries(itemId.ProviderIds))
|
||||
{
|
||||
result.QueriedById = false;
|
||||
await Identify(itemId).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user