diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 10b3aa7228..ac8688f77e 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1072,6 +1072,11 @@ namespace MediaBrowser.Controller.Entities return true; } + if (user.Configuration.BlockNotRated && string.IsNullOrEmpty(CustomRating ?? OfficialRating)) + { + return false; + } + return Ratings.Level(CustomRating ?? OfficialRating) <= user.Configuration.MaxParentalRating.Value; } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index b327756559..2033130937 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -120,6 +120,21 @@ namespace MediaBrowser.Controller.Entities await LibraryManager.SaveChildren(Id, newChildren, cancellationToken).ConfigureAwait(false); } + /// + /// Never want folders to be blocked by "BlockNotRated" + /// + public override string OfficialRating + { + get + { + return !string.IsNullOrEmpty(base.OfficialRating) ? base.OfficialRating : "None"; + } + set + { + base.OfficialRating = value; + } + } + /// /// Removes the child. /// diff --git a/MediaBrowser.Model/Configuration/UserConfiguration.cs b/MediaBrowser.Model/Configuration/UserConfiguration.cs index deb6fdb3d2..792ef574fa 100644 --- a/MediaBrowser.Model/Configuration/UserConfiguration.cs +++ b/MediaBrowser.Model/Configuration/UserConfiguration.cs @@ -12,6 +12,12 @@ namespace MediaBrowser.Model.Configuration /// The max parental rating. public int? MaxParentalRating { get; set; } + /// + /// Gets or sets a value indicating whether items with no rating information should be blocked. + /// + /// true if items with no rating info should be blocked; otherwise, false. + public bool BlockNotRated { get; set; } + /// /// Gets or sets a value indicating whether [use custom library]. /// @@ -48,6 +54,7 @@ namespace MediaBrowser.Model.Configuration public UserConfiguration() { IsAdministrator = true; + BlockNotRated = true; } } } diff --git a/MediaBrowser.ServerApplication/App.config b/MediaBrowser.ServerApplication/App.config index ca35b353c6..06fe8b439b 100644 --- a/MediaBrowser.ServerApplication/App.config +++ b/MediaBrowser.ServerApplication/App.config @@ -10,7 +10,7 @@ - +