mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 13:57:14 -04:00
fixes #553 - Support locking OfficialRating field
This commit is contained in:
parent
831c412ecf
commit
b54240f679
@ -202,6 +202,18 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
return NeedsRefreshInternal(item, data);
|
return NeedsRefreshInternal(item, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether [enforce dont fetch metadata].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [enforce dont fetch metadata]; otherwise, <c>false</c>.</value>
|
||||||
|
public virtual bool EnforceDontFetchMetadata
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Needses the refresh internal.
|
/// Needses the refresh internal.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -37,6 +37,10 @@ namespace MediaBrowser.Model.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The runtime
|
/// The runtime
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Runtime
|
Runtime,
|
||||||
|
/// <summary>
|
||||||
|
/// The official rating
|
||||||
|
/// </summary>
|
||||||
|
OfficialRating
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -383,10 +383,13 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
var officialRating = GetDictionaryValue(data.format.tags, "WM/ParentalRating");
|
var officialRating = GetDictionaryValue(data.format.tags, "WM/ParentalRating");
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(officialRating))
|
if (!string.IsNullOrWhiteSpace(officialRating))
|
||||||
|
{
|
||||||
|
if (!video.LockedFields.Contains(MetadataFields.OfficialRating))
|
||||||
{
|
{
|
||||||
video.OfficialRating = officialRating;
|
video.OfficialRating = officialRating;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (force || video.People.Count == 0)
|
if (force || video.People.Count == 0)
|
||||||
{
|
{
|
||||||
|
@ -586,6 +586,9 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
var ourRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals(ConfigurationManager.Configuration.MetadataCountryCode, StringComparison.OrdinalIgnoreCase)) ?? new Country();
|
var ourRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals(ConfigurationManager.Configuration.MetadataCountryCode, StringComparison.OrdinalIgnoreCase)) ?? new Country();
|
||||||
var usRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals("US", StringComparison.OrdinalIgnoreCase)) ?? new Country();
|
var usRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals("US", StringComparison.OrdinalIgnoreCase)) ?? new Country();
|
||||||
var minimunRelease = movieData.releases.countries.OrderBy(c => c.release_date).FirstOrDefault() ?? new Country();
|
var minimunRelease = movieData.releases.countries.OrderBy(c => c.release_date).FirstOrDefault() ?? new Country();
|
||||||
|
|
||||||
|
if (!movie.LockedFields.Contains(MetadataFields.OfficialRating))
|
||||||
|
{
|
||||||
var ratingPrefix = ConfigurationManager.Configuration.MetadataCountryCode.Equals("us", StringComparison.OrdinalIgnoreCase) ? "" : ConfigurationManager.Configuration.MetadataCountryCode + "-";
|
var ratingPrefix = ConfigurationManager.Configuration.MetadataCountryCode.Equals("us", StringComparison.OrdinalIgnoreCase) ? "" : ConfigurationManager.Configuration.MetadataCountryCode + "-";
|
||||||
movie.OfficialRating = !string.IsNullOrEmpty(ourRelease.certification)
|
movie.OfficialRating = !string.IsNullOrEmpty(ourRelease.certification)
|
||||||
? ratingPrefix + ourRelease.certification
|
? ratingPrefix + ourRelease.certification
|
||||||
@ -594,6 +597,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
: !string.IsNullOrEmpty(minimunRelease.certification)
|
: !string.IsNullOrEmpty(minimunRelease.certification)
|
||||||
? minimunRelease.iso_3166_1 + "-" + minimunRelease.certification
|
? minimunRelease.iso_3166_1 + "-" + minimunRelease.certification
|
||||||
: null;
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
if (ourRelease.release_date != default(DateTime))
|
if (ourRelease.release_date != default(DateTime))
|
||||||
{
|
{
|
||||||
@ -632,7 +636,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if that didn't find a rating and we are a boxset, use the one from our first child
|
//if that didn't find a rating and we are a boxset, use the one from our first child
|
||||||
if (movie.OfficialRating == null && movie is BoxSet)
|
if (movie.OfficialRating == null && movie is BoxSet && !movie.LockedFields.Contains(MetadataFields.OfficialRating))
|
||||||
{
|
{
|
||||||
var boxset = movie as BoxSet;
|
var boxset = movie as BoxSet;
|
||||||
Logger.Info("MovieDbProvider - Using rating of first child of boxset...");
|
Logger.Info("MovieDbProvider - Using rating of first child of boxset...");
|
||||||
|
@ -153,6 +153,15 @@ namespace MediaBrowser.Providers.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool EnforceDontFetchMetadata
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// Other providers depend on the xml downloaded here
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override DateTime CompareDate(BaseItem item)
|
protected override DateTime CompareDate(BaseItem item)
|
||||||
{
|
{
|
||||||
var seriesId = item.GetProviderId(MetadataProviders.Tvdb);
|
var seriesId = item.GetProviderId(MetadataProviders.Tvdb);
|
||||||
@ -439,9 +448,12 @@ namespace MediaBrowser.Providers.TV
|
|||||||
var val = reader.ReadElementContentAsString();
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(val))
|
if (!string.IsNullOrWhiteSpace(val))
|
||||||
|
{
|
||||||
|
if (!item.LockedFields.Contains(MetadataFields.OfficialRating))
|
||||||
{
|
{
|
||||||
item.OfficialRating = val;
|
item.OfficialRating = val;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ namespace MediaBrowser.Server.Implementations.Providers
|
|||||||
|
|
||||||
// Put this check below the await because the needs refresh of the next tier of providers may depend on the previous ones running
|
// Put this check below the await because the needs refresh of the next tier of providers may depend on the previous ones running
|
||||||
// This is the case for the fan art provider which depends on the movie and tv providers having run before them
|
// This is the case for the fan art provider which depends on the movie and tv providers having run before them
|
||||||
if (provider.RequiresInternet && item.DontFetchMeta)
|
if (provider.RequiresInternet && item.DontFetchMeta && provider.EnforceDontFetchMetadata)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user