From 79413d9f33aad2aae933e79ad22a8a01ae3b6807 Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Fri, 13 Mar 2020 23:11:59 +0100 Subject: [PATCH] Add a configuration flag to allow/disallow duplicates in playlists --- .../ConfigurationOptions.cs | 3 ++- .../Extensions/ConfigurationExtensions.cs | 25 ++++++++++++++----- .../MediaBrowser.Controller.csproj | 1 + 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Emby.Server.Implementations/ConfigurationOptions.cs b/Emby.Server.Implementations/ConfigurationOptions.cs index d0f3d6723..31fb5ca58 100644 --- a/Emby.Server.Implementations/ConfigurationOptions.cs +++ b/Emby.Server.Implementations/ConfigurationOptions.cs @@ -9,7 +9,8 @@ namespace Emby.Server.Implementations { { "HttpListenerHost:DefaultRedirectPath", "web/index.html" }, { FfmpegProbeSizeKey, "1G" }, - { FfmpegAnalyzeDurationKey, "200M" } + { FfmpegAnalyzeDurationKey, "200M" }, + { PlaylistsAllowDuplicatesKey, bool.TrueString } }; } } diff --git a/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs b/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs index 76c9b4b26..48316499a 100644 --- a/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs +++ b/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs @@ -13,24 +13,37 @@ namespace MediaBrowser.Controller.Extensions public const string FfmpegProbeSizeKey = "FFmpeg:probesize"; /// - /// The key for the FFmpeg analyse duration option. + /// The key for the FFmpeg analyze duration option. /// public const string FfmpegAnalyzeDurationKey = "FFmpeg:analyzeduration"; /// - /// Retrieves the FFmpeg probe size from the . + /// The key for a setting that indicates whether playlists should allow duplicate entries. /// - /// This configuration. + public const string PlaylistsAllowDuplicatesKey = "playlists:allowDuplicates"; + + /// + /// Gets the FFmpeg probe size from the . + /// + /// The configuration to read the setting from. /// The FFmpeg probe size option. public static string GetFFmpegProbeSize(this IConfiguration configuration) => configuration[FfmpegProbeSizeKey]; /// - /// Retrieves the FFmpeg analyse duration from the . + /// Gets the FFmpeg analyze duration from the . /// - /// This configuration. - /// The FFmpeg analyse duration option. + /// The configuration to read the setting from. + /// The FFmpeg analyze duration option. public static string GetFFmpegAnalyzeDuration(this IConfiguration configuration) => configuration[FfmpegAnalyzeDurationKey]; + + /// + /// Gets a value indicating whether playlists should allow duplicate entries from the . + /// + /// The configuration to read the setting from. + /// True if playlists should allow duplicates, otherwise false. + public static bool DoPlaylistsAllowDuplicates(this IConfiguration configuration) + => configuration.GetValue(PlaylistsAllowDuplicatesKey); } } diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 88e9055e8..bcca9e4a1 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -9,6 +9,7 @@ +