rework checkboxes for block unrated items

This commit is contained in:
Luke Pulverenti 2014-02-21 10:24:29 -05:00
parent aeb43e229a
commit 6e5d90bafe
17 changed files with 59 additions and 26 deletions

View File

@ -135,7 +135,7 @@ namespace MediaBrowser.Controller.Entities.Audio
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMusic;
return config.BlockUnratedItems.Contains(UnratedItem.Music);
}
public SongInfo GetLookupInfo()

View File

@ -129,7 +129,7 @@ namespace MediaBrowser.Controller.Entities.Audio
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMusic;
return config.BlockUnratedItems.Contains(UnratedItem.Music);
}
public AlbumInfo GetLookupInfo()

View File

@ -123,7 +123,7 @@ namespace MediaBrowser.Controller.Entities.Audio
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMusic;
return config.BlockUnratedItems.Contains(UnratedItem.Music);
}
public async Task RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress<double> progress, CancellationToken cancellationToken)

View File

@ -895,7 +895,7 @@ namespace MediaBrowser.Controller.Entities
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
protected virtual bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockNotRated;
return config.BlockUnratedItems.Contains(UnratedItem.Other);
}
/// <summary>

View File

@ -38,7 +38,7 @@ namespace MediaBrowser.Controller.Entities
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedBooks;
return config.BlockUnratedItems.Contains(UnratedItem.Book);
}
public BookInfo GetLookupInfo()

View File

@ -3,6 +3,7 @@ using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Controller.Entities
{
@ -107,7 +108,7 @@ namespace MediaBrowser.Controller.Entities
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedGames;
return config.BlockUnratedItems.Contains(UnratedItem.Game);
}
public GameInfo GetLookupInfo()

View File

@ -57,7 +57,7 @@ namespace MediaBrowser.Controller.Entities.Movies
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMovies;
return config.BlockUnratedItems.Contains(UnratedItem.Movie);
}
public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)

View File

@ -160,7 +160,7 @@ namespace MediaBrowser.Controller.Entities.Movies
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMovies;
return config.BlockUnratedItems.Contains(UnratedItem.Movie);
}
public MovieInfo GetLookupInfo()

View File

@ -3,6 +3,7 @@ using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System;
using System.Linq;
namespace MediaBrowser.Controller.Entities
{
@ -53,7 +54,7 @@ namespace MediaBrowser.Controller.Entities
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMusic;
return config.BlockUnratedItems.Contains(UnratedItem.Music);
}
public MusicVideoInfo GetLookupInfo()

View File

@ -244,7 +244,7 @@ namespace MediaBrowser.Controller.Entities.TV
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedSeries;
return config.BlockUnratedItems.Contains(UnratedItem.Series);
}
public EpisodeInfo GetLookupInfo()

View File

@ -217,7 +217,7 @@ namespace MediaBrowser.Controller.Entities.TV
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedSeries;
return config.BlockUnratedItems.Contains(UnratedItem.Series);
}
public string PreferredMetadataLanguage { get; set; }

View File

@ -4,6 +4,7 @@ using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Linq;
namespace MediaBrowser.Controller.Entities
{
@ -97,7 +98,7 @@ namespace MediaBrowser.Controller.Entities
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedTrailers;
return config.BlockUnratedItems.Contains(UnratedItem.Trailer);
}
public TrailerInfo GetLookupInfo()

View File

@ -1,5 +1,7 @@
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System.Linq;
namespace MediaBrowser.Controller.LiveTv
{
@ -75,5 +77,10 @@ namespace MediaBrowser.Controller.LiveTv
return false;
}
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram);
}
}
}

View File

@ -1,8 +1,10 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.LiveTv;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Linq;
namespace MediaBrowser.Controller.LiveTv
{
@ -38,6 +40,11 @@ namespace MediaBrowser.Controller.LiveTv
}
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedItems.Contains(UnratedItem.LiveTvChannel);
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>

View File

@ -1,9 +1,11 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.LiveTv;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Linq;
namespace MediaBrowser.Controller.LiveTv
{
@ -196,5 +198,10 @@ namespace MediaBrowser.Controller.LiveTv
// Not great that this class has to know about that, but we'll improve that later.
return ItemRepository.SaveItem(this, cancellationToken);
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram);
}
}
}

View File

@ -1,5 +1,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System.Linq;
namespace MediaBrowser.Controller.LiveTv
{
@ -75,5 +77,10 @@ namespace MediaBrowser.Controller.LiveTv
return false;
}
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram);
}
}
}

View File

@ -12,12 +12,6 @@ namespace MediaBrowser.Model.Configuration
/// <value>The max parental rating.</value>
public int? MaxParentalRating { get; set; }
/// <summary>
/// Gets or sets a value indicating whether items with no rating information should be blocked.
/// </summary>
/// <value><c>true</c> if items with no rating info should be blocked; otherwise, <c>false</c>.</value>
public bool BlockNotRated { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is administrator.
/// </summary>
@ -54,13 +48,6 @@ 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; }
public bool EnableLiveTvManagement { get; set; }
public bool EnableLiveTvAccess { get; set; }
@ -68,6 +55,8 @@ namespace MediaBrowser.Model.Configuration
public string[] BlockedMediaFolders { get; set; }
public UnratedItem[] BlockUnratedItems { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.
/// </summary>
@ -75,13 +64,26 @@ namespace MediaBrowser.Model.Configuration
{
IsAdministrator = true;
EnableRemoteControlOfOtherUsers = true;
BlockNotRated = false;
EnableLiveTvManagement = true;
EnableMediaPlayback = true;
EnableLiveTvAccess = true;
BlockedMediaFolders = new string[] { };
BlockUnratedItems = new UnratedItem[] { };
}
}
public enum UnratedItem
{
Movie,
Trailer,
Series,
Music,
Game,
Book,
LiveTvChannel,
LiveTvProgram,
Other
}
}