added more options for block unrated

This commit is contained in:
Luke Pulverenti 2013-12-26 11:53:23 -05:00
parent 1fe08c083a
commit a0e6c0422b
15 changed files with 107 additions and 10 deletions

View File

@ -1,4 +1,5 @@
using System;
using MediaBrowser.Model.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
@ -131,5 +132,10 @@ namespace MediaBrowser.Controller.Entities.Audio
return base.GetUserDataKey();
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMusic;
}
}
}

View File

@ -1,4 +1,5 @@
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
@ -109,6 +110,11 @@ namespace MediaBrowser.Controller.Entities.Audio
return base.GetUserDataKey();
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMusic;
}
}
public class MusicAlbumDisc : Folder

View File

@ -1,4 +1,5 @@
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
@ -107,5 +108,10 @@ namespace MediaBrowser.Controller.Entities.Audio
return "Artist-" + item.Name;
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMusic;
}
}
}

View File

@ -7,6 +7,7 @@ using MediaBrowser.Controller.Localization;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using System;
@ -985,7 +986,7 @@ namespace MediaBrowser.Controller.Entities
if (string.IsNullOrEmpty(rating))
{
return !user.Configuration.BlockNotRated;
return !GetBlockUnratedValue(user.Configuration);
}
var value = localizationManager.GetRatingLevel(rating);
@ -999,6 +1000,16 @@ namespace MediaBrowser.Controller.Entities
return value.Value <= maxAllowedRating.Value;
}
/// <summary>
/// Gets the block unrated value.
/// </summary>
/// <param name="config">The configuration.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
protected virtual bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockNotRated;
}
/// <summary>
/// Determines if this folder should be visible to a given user.
/// Default is just parental allowed. Can be overridden for more functionality.

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using MediaBrowser.Model.Configuration;
using System.Collections.Generic;
namespace MediaBrowser.Controller.Entities
{
@ -42,5 +43,10 @@ namespace MediaBrowser.Controller.Entities
{
Tags = new List<string>();
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedBooks;
}
}
}

View File

@ -1,4 +1,5 @@
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
@ -129,5 +130,10 @@ namespace MediaBrowser.Controller.Entities
return base.GetDeletePaths();
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedGames;
}
}
}

View File

@ -1,4 +1,5 @@
using System;
using MediaBrowser.Model.Configuration;
using System;
namespace MediaBrowser.Controller.Entities
{
@ -38,5 +39,11 @@ namespace MediaBrowser.Controller.Entities
}
return base.GetUserDataKey();
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
// Don't block. Determine by game
return false;
}
}
}

View File

@ -1,5 +1,6 @@
using System;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
namespace MediaBrowser.Controller.Entities.Movies
@ -29,5 +30,10 @@ namespace MediaBrowser.Controller.Entities.Movies
/// </summary>
/// <value>The tags.</value>
public List<string> Tags { get; set; }
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMovies;
}
}
}

View File

@ -1,4 +1,5 @@
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.IO;
@ -180,5 +181,9 @@ namespace MediaBrowser.Controller.Entities.Movies
});
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMovies;
}
}
}

View File

@ -1,4 +1,5 @@
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System;
@ -48,5 +49,10 @@ namespace MediaBrowser.Controller.Entities
{
return this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? base.GetUserDataKey();
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMusic;
}
}
}

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Controller.Entities.TV
{
@ -292,5 +293,10 @@ namespace MediaBrowser.Controller.Entities.TV
{
return new[] { Path };
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedSeries;
}
}
}

View File

@ -1,5 +1,6 @@
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Localization;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using System;
@ -260,5 +261,11 @@ namespace MediaBrowser.Controller.Entities.TV
{
return GetEpisodes(user);
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
// Don't block. Let either the entire series rating or episode rating determine it
return false;
}
}
}

View File

@ -1,5 +1,6 @@
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Localization;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using System;
@ -217,5 +218,10 @@ namespace MediaBrowser.Controller.Entities.TV
return false;
});
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedSeries;
}
}
}

View File

@ -1,4 +1,5 @@
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
@ -113,5 +114,10 @@ namespace MediaBrowser.Controller.Entities
return base.GetUserDataKey();
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedTrailers;
}
}
}

View File

@ -60,6 +60,13 @@ namespace MediaBrowser.Model.Configuration
public bool DisplayUnairedEpisodes { get; set; }
public bool EnableRemoteControlOfOtherUsers { get; set; }
public bool BlockUnratedMovies { get; set; }
public bool BlockUnratedTrailers { get; set; }
public bool BlockUnratedSeries { get; set; }
public bool BlockUnratedMusic { get; set; }
public bool BlockUnratedGames { get; set; }
public bool BlockUnratedBooks { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.
/// </summary>