Minor cleanup
This commit is contained in:
parent
63d943aab9
commit
5036afd691
|
@ -365,11 +365,7 @@ namespace Emby.Server.Implementations.AppBase
|
|||
validatingStore.Validate(currentConfiguration, configuration);
|
||||
}
|
||||
|
||||
NamedConfigurationUpdating?.Invoke(this, new ConfigurationUpdateEventArgs
|
||||
{
|
||||
Key = key,
|
||||
NewConfiguration = configuration
|
||||
});
|
||||
NamedConfigurationUpdating?.Invoke(this, new ConfigurationUpdateEventArgs(key, configuration));
|
||||
|
||||
_configurations.AddOrUpdate(key, configuration, (_, _) => configuration);
|
||||
|
||||
|
@ -391,11 +387,7 @@ namespace Emby.Server.Implementations.AppBase
|
|||
/// <param name="configuration">The old configuration.</param>
|
||||
protected virtual void OnNamedConfigurationUpdated(string key, object configuration)
|
||||
{
|
||||
NamedConfigurationUpdated?.Invoke(this, new ConfigurationUpdateEventArgs
|
||||
{
|
||||
Key = key,
|
||||
NewConfiguration = configuration
|
||||
});
|
||||
NamedConfigurationUpdated?.Invoke(this, new ConfigurationUpdateEventArgs(key, configuration));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
@ -25,11 +25,6 @@ namespace Jellyfin.Api.Attributes
|
|||
/// <param name="template">The route template. May not be null.</param>
|
||||
public HttpSubscribeAttribute(string template)
|
||||
: base(_supportedMethods, template)
|
||||
{
|
||||
if (template == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(template));
|
||||
}
|
||||
}
|
||||
=> ArgumentNullException.ThrowIfNull(template, nameof(template));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,6 @@ namespace Jellyfin.Api.Attributes
|
|||
/// <param name="template">The route template. May not be null.</param>
|
||||
public HttpUnsubscribeAttribute(string template)
|
||||
: base(_supportedMethods, template)
|
||||
{
|
||||
if (template == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(template));
|
||||
}
|
||||
}
|
||||
=> ArgumentNullException.ThrowIfNull(template, nameof(template));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,12 +89,9 @@ namespace Jellyfin.Api.Controllers
|
|||
|
||||
// Load all custom display preferences
|
||||
var customDisplayPreferences = _displayPreferencesManager.ListCustomItemDisplayPreferences(displayPreferences.UserId, itemId, displayPreferences.Client);
|
||||
if (customDisplayPreferences != null)
|
||||
foreach (var (key, value) in customDisplayPreferences)
|
||||
{
|
||||
foreach (var (key, value) in customDisplayPreferences)
|
||||
{
|
||||
dto.CustomPrefs.TryAdd(key, value);
|
||||
}
|
||||
dto.CustomPrefs.TryAdd(key, value);
|
||||
}
|
||||
|
||||
// This will essentially be a noop if no changes have been made, but new prefs must be saved at least.
|
||||
|
|
|
@ -145,9 +145,11 @@ namespace Jellyfin.Drawing.Skia
|
|||
/// <exception cref="SkiaCodecException">The file at the specified path could not be used to generate a codec.</exception>
|
||||
public string GetImageBlurHash(int xComp, int yComp, string path)
|
||||
{
|
||||
if (path == null)
|
||||
ArgumentNullException.ThrowIfNull(path, nameof(path));
|
||||
|
||||
if (path.Length == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
throw new ArgumentException("String can't be empty", nameof(path));
|
||||
}
|
||||
|
||||
var extension = Path.GetExtension(path.AsSpan()).TrimStart('.');
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace Jellyfin.Server.Implementations.Users
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetCustomItemDisplayPreferences(Guid userId, Guid itemId, string client, Dictionary<string, string> customPreferences)
|
||||
public void SetCustomItemDisplayPreferences(Guid userId, Guid itemId, string client, Dictionary<string, string?> customPreferences)
|
||||
{
|
||||
var existingPrefs = _dbContext.CustomItemDisplayPreferences
|
||||
.AsQueryable()
|
||||
|
|
|
@ -69,15 +69,8 @@ namespace Jellyfin.Server.Infrastructure
|
|||
/// <inheritdoc />
|
||||
protected override Task WriteFileAsync(ActionContext context, PhysicalFileResult result, RangeItemHeaderValue? range, long rangeLength)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(result));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(context, nameof(context));
|
||||
ArgumentNullException.ThrowIfNull(result, nameof(result));
|
||||
|
||||
if (range != null && rangeLength == 0)
|
||||
{
|
||||
|
|
|
@ -1,22 +1,33 @@
|
|||
#nullable disable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Common.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// <see cref="EventArgs" /> for the ConfigurationUpdated event.
|
||||
/// </summary>
|
||||
public class ConfigurationUpdateEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the key.
|
||||
/// Initializes a new instance of the <see cref="ConfigurationUpdateEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <value>The key.</value>
|
||||
public string Key { get; set; }
|
||||
/// <param name="key">The configuration key.</param>
|
||||
/// <param name="newConfiguration">The new configuration.</param>
|
||||
public ConfigurationUpdateEventArgs(string key, object newConfiguration)
|
||||
{
|
||||
Key = key;
|
||||
NewConfiguration = newConfiguration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the new configuration.
|
||||
/// Gets the key.
|
||||
/// </summary>
|
||||
/// <value>The key.</value>
|
||||
public string Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the new configuration.
|
||||
/// </summary>
|
||||
/// <value>The new configuration.</value>
|
||||
public object NewConfiguration { get; set; }
|
||||
public object NewConfiguration { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#nullable disable
|
||||
|
||||
namespace MediaBrowser.Common.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
@ -13,7 +11,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
public abstract class BasePluginFolder : Folder, ICollectionFolder
|
||||
{
|
||||
[JsonIgnore]
|
||||
public virtual string CollectionType => null;
|
||||
public virtual string? CollectionType => null;
|
||||
|
||||
[JsonIgnore]
|
||||
public override bool SupportsInheritedParentImages => false;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Jellyfin.Extensions;
|
||||
|
@ -19,9 +17,11 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <param name="url">Trailer URL.</param>
|
||||
public static void AddTrailerUrl(this BaseItem item, string url)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url))
|
||||
ArgumentNullException.ThrowIfNull(url, nameof(url));
|
||||
|
||||
if (url.Length == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(url));
|
||||
throw new ArgumentException("String can't be empty", nameof(url));
|
||||
}
|
||||
|
||||
var current = item.RemoteTrailers.FirstOrDefault(i => string.Equals(i.Url, url, StringComparison.OrdinalIgnoreCase));
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Entities;
|
||||
|
@ -50,7 +48,7 @@ namespace MediaBrowser.Controller
|
|||
/// <param name="itemId">The item id.</param>
|
||||
/// <param name="client">The client string.</param>
|
||||
/// <returns>The dictionary of custom item display preferences.</returns>
|
||||
Dictionary<string, string> ListCustomItemDisplayPreferences(Guid userId, Guid itemId, string client);
|
||||
Dictionary<string, string?> ListCustomItemDisplayPreferences(Guid userId, Guid itemId, string client);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the custom item display preference for the user and client.
|
||||
|
@ -59,7 +57,7 @@ namespace MediaBrowser.Controller
|
|||
/// <param name="itemId">The item id.</param>
|
||||
/// <param name="client">The client id.</param>
|
||||
/// <param name="customPreferences">A dictionary of custom item display preferences.</param>
|
||||
void SetCustomItemDisplayPreferences(Guid userId, Guid itemId, string client, Dictionary<string, string> customPreferences);
|
||||
void SetCustomItemDisplayPreferences(Guid userId, Guid itemId, string client, Dictionary<string, string?> customPreferences);
|
||||
|
||||
/// <summary>
|
||||
/// Saves changes made to the database.
|
||||
|
|
Loading…
Reference in New Issue
Block a user