mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-28 03:18:27 +01:00
Merge pull request #458 from EraYaN/code-cleanup
Clean up several minor issues and add TODOs
This commit is contained in:
@@ -67,7 +67,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (string.IsNullOrWhiteSpace(newPasswordHash))
|
||||
{
|
||||
throw new ArgumentNullException("newPasswordHash");
|
||||
throw new ArgumentNullException(nameof(newPasswordHash));
|
||||
}
|
||||
|
||||
user.Password = newPasswordHash;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
@@ -147,13 +147,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// Gets the library items cache.
|
||||
/// </summary>
|
||||
/// <value>The library items cache.</value>
|
||||
private ConcurrentDictionary<Guid, BaseItem> LibraryItemsCache
|
||||
{
|
||||
get
|
||||
{
|
||||
return _libraryItemsCache;
|
||||
}
|
||||
}
|
||||
private ConcurrentDictionary<Guid, BaseItem> LibraryItemsCache => _libraryItemsCache;
|
||||
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
@@ -188,7 +182,6 @@ namespace Emby.Server.Implementations.Library
|
||||
/// Adds the parts.
|
||||
/// </summary>
|
||||
/// <param name="rules">The rules.</param>
|
||||
/// <param name="pluginFolders">The plugin folders.</param>
|
||||
/// <param name="resolvers">The resolvers.</param>
|
||||
/// <param name="introProviders">The intro providers.</param>
|
||||
/// <param name="itemComparers">The item comparers.</param>
|
||||
@@ -277,7 +270,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
throw new ArgumentNullException(nameof(item));
|
||||
}
|
||||
if (item is IItemByName)
|
||||
{
|
||||
@@ -317,7 +310,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
throw new ArgumentNullException(nameof(item));
|
||||
}
|
||||
|
||||
var parent = item.GetOwner() ?? item.GetParent();
|
||||
@@ -329,7 +322,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
throw new ArgumentNullException(nameof(item));
|
||||
}
|
||||
|
||||
if (item.SourceType == SourceType.Channel)
|
||||
@@ -449,7 +442,7 @@ namespace Emby.Server.Implementations.Library
|
||||
ReportItemRemoved(item, parent);
|
||||
}
|
||||
|
||||
private IEnumerable<string> GetMetadataPaths(BaseItem item, IEnumerable<BaseItem> children)
|
||||
private static IEnumerable<string> GetMetadataPaths(BaseItem item, IEnumerable<BaseItem> children)
|
||||
{
|
||||
var list = new List<string>
|
||||
{
|
||||
@@ -502,11 +495,11 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentNullException("key");
|
||||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
throw new ArgumentNullException(nameof(type));
|
||||
}
|
||||
|
||||
if (key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
|
||||
@@ -542,7 +535,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (fileInfo == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileInfo");
|
||||
throw new ArgumentNullException(nameof(fileInfo));
|
||||
}
|
||||
|
||||
var fullPath = fileInfo.FullName;
|
||||
@@ -823,7 +816,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
//_logger.LogInformation("FindByPath {0}", path);
|
||||
@@ -921,7 +914,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (value <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("Years less than or equal to 0 are invalid.");
|
||||
throw new ArgumentOutOfRangeException(nameof(value),"Years less than or equal to 0 are invalid.");
|
||||
}
|
||||
|
||||
var name = value.ToString(CultureInfo.InvariantCulture);
|
||||
@@ -1249,7 +1242,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (id.Equals(Guid.Empty))
|
||||
{
|
||||
throw new ArgumentNullException("id");
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
}
|
||||
|
||||
BaseItem item;
|
||||
@@ -1828,7 +1821,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// Creates the item.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="parent">The parent item.</param>
|
||||
/// <returns>Task.</returns>
|
||||
public void CreateItem(BaseItem item, BaseItem parent)
|
||||
{
|
||||
@@ -2023,7 +2016,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return GetCollectionFoldersInternal(item, allUserRootChildren);
|
||||
}
|
||||
|
||||
private List<Folder> GetCollectionFoldersInternal(BaseItem item, List<Folder> allUserRootChildren)
|
||||
private static List<Folder> GetCollectionFoldersInternal(BaseItem item, List<Folder> allUserRootChildren)
|
||||
{
|
||||
return allUserRootChildren
|
||||
.Where(i => string.Equals(i.Path, item.Path, StringComparison.OrdinalIgnoreCase) || i.PhysicalLocations.Contains(item.Path, StringComparer.OrdinalIgnoreCase))
|
||||
@@ -2247,7 +2240,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (parent == null)
|
||||
{
|
||||
throw new ArgumentNullException("parent");
|
||||
throw new ArgumentNullException(nameof(parent));
|
||||
}
|
||||
|
||||
var name = parent.Name;
|
||||
@@ -2313,7 +2306,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
var parentIdString = parentId.Equals(Guid.Empty) ? null : parentId.ToString("N");
|
||||
@@ -2708,15 +2701,15 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(from))
|
||||
{
|
||||
throw new ArgumentNullException("from");
|
||||
throw new ArgumentNullException(nameof(from));
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(to))
|
||||
{
|
||||
throw new ArgumentNullException("to");
|
||||
throw new ArgumentNullException(nameof(to));
|
||||
}
|
||||
|
||||
from = from.Trim();
|
||||
@@ -2864,7 +2857,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
name = _fileSystem.GetValidFilename(name);
|
||||
@@ -2937,7 +2930,7 @@ namespace Emby.Server.Implementations.Library
|
||||
});
|
||||
}
|
||||
|
||||
private bool ValidateNetworkPath(string path)
|
||||
private static bool ValidateNetworkPath(string path)
|
||||
{
|
||||
//if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
//{
|
||||
@@ -2962,14 +2955,14 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (pathInfo == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
throw new ArgumentNullException(nameof(pathInfo));
|
||||
}
|
||||
|
||||
var path = pathInfo.Path;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
if (!_fileSystem.DirectoryExists(path))
|
||||
@@ -3017,7 +3010,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (pathInfo == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
throw new ArgumentNullException(nameof(pathInfo));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(pathInfo.NetworkPath) && !ValidateNetworkPath(pathInfo.NetworkPath))
|
||||
@@ -3075,7 +3068,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
|
||||
@@ -3116,7 +3109,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
var removeList = new List<NameValuePair>();
|
||||
@@ -3148,7 +3141,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrEmpty(mediaPath))
|
||||
{
|
||||
throw new ArgumentNullException("mediaPath");
|
||||
throw new ArgumentNullException(nameof(mediaPath));
|
||||
}
|
||||
|
||||
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Library;
|
||||
@@ -74,7 +74,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return list;
|
||||
}
|
||||
|
||||
private bool StreamSupportsExternalStream(MediaStream stream)
|
||||
private static bool StreamSupportsExternalStream(MediaStream stream)
|
||||
{
|
||||
if (stream.IsExternal)
|
||||
{
|
||||
@@ -261,7 +261,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
private void SetKeyProperties(IMediaSourceProvider provider, MediaSourceInfo mediaSource)
|
||||
private static void SetKeyProperties(IMediaSourceProvider provider, MediaSourceInfo mediaSource)
|
||||
{
|
||||
var prefix = provider.GetType().FullName.GetMD5().ToString("N") + LiveStreamIdDelimeter;
|
||||
|
||||
@@ -292,7 +292,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
throw new ArgumentNullException(nameof(item));
|
||||
}
|
||||
|
||||
var hasMediaSources = (IHasMediaSources)item;
|
||||
@@ -401,7 +401,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<MediaSourceInfo> SortMediaSources(IEnumerable<MediaSourceInfo> sources)
|
||||
private static IEnumerable<MediaSourceInfo> SortMediaSources(IEnumerable<MediaSourceInfo> sources)
|
||||
{
|
||||
return sources.OrderBy(i =>
|
||||
{
|
||||
@@ -501,7 +501,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}, liveStream as IDirectStreamProvider);
|
||||
}
|
||||
|
||||
private void AddMediaInfo(MediaSourceInfo mediaSource, bool isAudio)
|
||||
private static void AddMediaInfo(MediaSourceInfo mediaSource, bool isAudio)
|
||||
{
|
||||
mediaSource.DefaultSubtitleStreamIndex = null;
|
||||
|
||||
@@ -629,6 +629,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogDebug(ex, "_jsonSerializer.DeserializeFromFile threw an exception.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -759,7 +760,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
throw new ArgumentNullException("id");
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
}
|
||||
|
||||
var info = await GetLiveStreamInfo(id, cancellationToken).ConfigureAwait(false);
|
||||
@@ -770,7 +771,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
throw new ArgumentNullException("id");
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
}
|
||||
|
||||
await _liveStreamSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||
@@ -803,7 +804,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
throw new ArgumentNullException("id");
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
}
|
||||
|
||||
await _liveStreamSemaphore.WaitAsync().ConfigureAwait(false);
|
||||
|
||||
@@ -16,12 +16,12 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
throw new ArgumentNullException("str");
|
||||
throw new ArgumentNullException(nameof(str));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(attrib))
|
||||
{
|
||||
throw new ArgumentNullException("attrib");
|
||||
throw new ArgumentNullException(nameof(attrib));
|
||||
}
|
||||
|
||||
string srch = "[" + attrib + "=";
|
||||
|
||||
@@ -117,15 +117,15 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (fileSystem == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileSystem");
|
||||
throw new ArgumentNullException(nameof(fileSystem));
|
||||
}
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
throw new ArgumentNullException(nameof(item));
|
||||
}
|
||||
if (args == null)
|
||||
{
|
||||
throw new ArgumentNullException("args");
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
}
|
||||
|
||||
// See if a different path came out of the resolver than what went in
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
@@ -30,10 +30,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get { return ResolverPriority.Fourth; }
|
||||
}
|
||||
public override ResolverPriority Priority => ResolverPriority.Fourth;
|
||||
|
||||
public MultiItemResolverResult ResolveMultiple(Folder parent,
|
||||
List<FileSystemMetadata> files,
|
||||
@@ -264,12 +261,12 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
result.Extras.Any(i => ContainsFile(i, file));
|
||||
}
|
||||
|
||||
private bool ContainsFile(AudioBookFileInfo result, FileSystemMetadata file)
|
||||
private static bool ContainsFile(AudioBookFileInfo result, FileSystemMetadata file)
|
||||
{
|
||||
return string.Equals(result.Path, file.FullName, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private bool IsIgnored(string filename)
|
||||
private static bool IsIgnored(string filename)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -36,14 +36,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get
|
||||
{
|
||||
// Behind special folder resolver
|
||||
return ResolverPriority.Second;
|
||||
}
|
||||
}
|
||||
public override ResolverPriority Priority => ResolverPriority.Second;
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
|
||||
@@ -35,14 +35,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get
|
||||
{
|
||||
// Behind special folder resolver
|
||||
return ResolverPriority.Second;
|
||||
}
|
||||
}
|
||||
public override ResolverPriority Priority => ResolverPriority.Second;
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
|
||||
@@ -13,10 +13,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get { return ResolverPriority.Last; }
|
||||
}
|
||||
public override ResolverPriority Priority => ResolverPriority.Last;
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
|
||||
@@ -25,13 +25,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public virtual ResolverPriority Priority
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResolverPriority.First;
|
||||
}
|
||||
}
|
||||
public virtual ResolverPriority Priority => ResolverPriority.First;
|
||||
|
||||
/// <summary>
|
||||
/// Sets initial values on the newly resolved item
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@@ -61,7 +61,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
/// Sets the provider id from path.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
private void SetProviderIdFromPath(BaseItem item)
|
||||
private static void SetProviderIdFromPath(BaseItem item)
|
||||
{
|
||||
//we need to only look at the name of this actual item (not parents)
|
||||
var justName = Path.GetFileName(item.Path);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
@@ -27,17 +27,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get
|
||||
{
|
||||
// Give plugins a chance to catch iso's first
|
||||
// Also since we have to loop through child files looking for videos,
|
||||
// see if we can avoid some of that by letting other resolvers claim folders first
|
||||
// Also run after series resolver
|
||||
return ResolverPriority.Third;
|
||||
}
|
||||
}
|
||||
public override ResolverPriority Priority => ResolverPriority.Third;
|
||||
|
||||
public MultiItemResolverResult ResolveMultiple(Folder parent,
|
||||
List<FileSystemMetadata> files,
|
||||
@@ -176,7 +166,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
return result;
|
||||
}
|
||||
|
||||
private bool IsIgnored(string filename)
|
||||
private static bool IsIgnored(string filename)
|
||||
{
|
||||
// Ignore samples
|
||||
var sampleFilename = " " + filename.Replace(".", " ", StringComparison.OrdinalIgnoreCase)
|
||||
@@ -204,7 +194,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
result.Extras.Any(i => ContainsFile(i, file));
|
||||
}
|
||||
|
||||
private bool ContainsFile(VideoFileInfo result, FileSystemMetadata file)
|
||||
private static bool ContainsFile(VideoFileInfo result, FileSystemMetadata file)
|
||||
{
|
||||
return string.Equals(result.Path, file.FullName, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
@@ -330,7 +320,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
/// Sets the provider id from path.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
private void SetProviderIdsFromPath(Video item)
|
||||
private static void SetProviderIdsFromPath(Video item)
|
||||
{
|
||||
if (item is Movie || item is MusicVideo)
|
||||
{
|
||||
|
||||
@@ -79,13 +79,6 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
return false;
|
||||
}
|
||||
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get
|
||||
{
|
||||
// Behind special folder resolver
|
||||
return ResolverPriority.Second;
|
||||
}
|
||||
}
|
||||
public override ResolverPriority Priority => ResolverPriority.Second;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +26,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get { return ResolverPriority.First; }
|
||||
}
|
||||
public override ResolverPriority Priority => ResolverPriority.First;
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
@@ -28,6 +28,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
/// Initializes a new instance of the <see cref="SeasonResolver"/> class.
|
||||
/// </summary>
|
||||
/// <param name="config">The config.</param>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="localization">The localization</param>
|
||||
/// <param name="logger">The logger</param>
|
||||
public SeasonResolver(IServerConfigurationManager config, ILibraryManager libraryManager, ILocalizationManager localization, ILogger logger)
|
||||
{
|
||||
_config = config;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
@@ -38,13 +38,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResolverPriority.Second;
|
||||
}
|
||||
}
|
||||
public override ResolverPriority Priority => ResolverPriority.Second;
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the specified args.
|
||||
@@ -195,7 +189,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
var extension = Path.GetExtension(path);
|
||||
@@ -236,7 +230,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="path">The path.</param>
|
||||
private void SetProviderIdFromPath(Series item, string path)
|
||||
private static void SetProviderIdFromPath(Series item, string path)
|
||||
{
|
||||
var justName = Path.GetFileName(path);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.Library
|
||||
};
|
||||
}
|
||||
|
||||
private void AddIfMissing(List<string> list, string value)
|
||||
private static void AddIfMissing(List<string> list, string value)
|
||||
{
|
||||
if (!list.Contains(value, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -85,7 +85,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (string.IsNullOrEmpty(searchTerm))
|
||||
{
|
||||
throw new ArgumentNullException("searchTerm");
|
||||
throw new ArgumentNullException(nameof(searchTerm));
|
||||
}
|
||||
|
||||
searchTerm = searchTerm.Trim().RemoveDiacritics();
|
||||
|
||||
@@ -53,11 +53,11 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (userData == null)
|
||||
{
|
||||
throw new ArgumentNullException("userData");
|
||||
throw new ArgumentNullException(nameof(userData));
|
||||
}
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
throw new ArgumentNullException(nameof(item));
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
@@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// Gets the internal key.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
private string GetCacheKey(long internalUserId, Guid itemId)
|
||||
private static string GetCacheKey(long internalUserId, Guid itemId)
|
||||
{
|
||||
return internalUserId.ToString(CultureInfo.InvariantCulture) + "-" + itemId.ToString("N");
|
||||
}
|
||||
@@ -198,7 +198,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
|
||||
return new UserItemDataDto
|
||||
@@ -226,7 +226,7 @@ namespace Emby.Server.Implementations.Library
|
||||
// If a position has been reported, and if we know the duration
|
||||
if (positionTicks > 0 && hasRuntime)
|
||||
{
|
||||
var pctIn = Decimal.Divide(positionTicks, runtimeTicks) * 100;
|
||||
var pctIn = decimal.Divide(positionTicks, runtimeTicks) * 100;
|
||||
|
||||
// Don't track in very beginning
|
||||
if (pctIn < _config.Configuration.MinResumePct)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
@@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// Gets the users.
|
||||
/// </summary>
|
||||
/// <value>The users.</value>
|
||||
public IEnumerable<User> Users { get { return _users; } }
|
||||
public IEnumerable<User> Users => _users;
|
||||
|
||||
private User[] _users;
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (id.Equals(Guid.Empty))
|
||||
{
|
||||
throw new ArgumentNullException("id");
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
}
|
||||
|
||||
return Users.FirstOrDefault(u => u.Id == id);
|
||||
@@ -183,7 +183,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
return Users.FirstOrDefault(u => string.Equals(u.Name, name, StringComparison.OrdinalIgnoreCase));
|
||||
@@ -222,7 +222,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IsValidUsernameCharacter(char i)
|
||||
private static bool IsValidUsernameCharacter(char i)
|
||||
{
|
||||
return !char.Equals(i, '<') && !char.Equals(i, '>');
|
||||
}
|
||||
@@ -251,7 +251,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(username))
|
||||
{
|
||||
throw new ArgumentNullException("username");
|
||||
throw new ArgumentNullException(nameof(username));
|
||||
}
|
||||
|
||||
var user = Users
|
||||
@@ -344,7 +344,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return success ? user : null;
|
||||
}
|
||||
|
||||
private string GetAuthenticationProviderId(IAuthenticationProvider provider)
|
||||
private static string GetAuthenticationProviderId(IAuthenticationProvider provider)
|
||||
{
|
||||
return provider.GetType().FullName;
|
||||
}
|
||||
@@ -526,7 +526,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentNullException("user");
|
||||
throw new ArgumentNullException(nameof(user));
|
||||
}
|
||||
|
||||
var hasConfiguredPassword = GetAuthenticationProvider(user).HasPassword(user).Result;
|
||||
@@ -625,12 +625,12 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentNullException("user");
|
||||
throw new ArgumentNullException(nameof(user));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(newName))
|
||||
{
|
||||
throw new ArgumentNullException("newName");
|
||||
throw new ArgumentNullException(nameof(newName));
|
||||
}
|
||||
|
||||
if (Users.Any(u => u.Id != user.Id && u.Name.Equals(newName, StringComparison.OrdinalIgnoreCase)))
|
||||
@@ -658,7 +658,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentNullException("user");
|
||||
throw new ArgumentNullException(nameof(user));
|
||||
}
|
||||
|
||||
if (user.Id.Equals(Guid.Empty) || !Users.Any(u => u.Id.Equals(user.Id)))
|
||||
@@ -689,7 +689,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
if (!IsValidUsername(name))
|
||||
@@ -737,7 +737,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentNullException("user");
|
||||
throw new ArgumentNullException(nameof(user));
|
||||
}
|
||||
|
||||
var allUsers = Users.ToList();
|
||||
@@ -804,7 +804,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentNullException("user");
|
||||
throw new ArgumentNullException(nameof(user));
|
||||
}
|
||||
|
||||
if (user.ConnectLinkType.HasValue && user.ConnectLinkType.Value == UserLinkType.Guest)
|
||||
@@ -823,7 +823,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentNullException("user");
|
||||
throw new ArgumentNullException(nameof(user));
|
||||
}
|
||||
|
||||
if (newPassword != null)
|
||||
@@ -833,7 +833,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (string.IsNullOrWhiteSpace(newPasswordHash))
|
||||
{
|
||||
throw new ArgumentNullException("newPasswordHash");
|
||||
throw new ArgumentNullException(nameof(newPasswordHash));
|
||||
}
|
||||
|
||||
user.EasyPassword = newPasswordHash;
|
||||
@@ -848,7 +848,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <returns>User.</returns>
|
||||
private User InstantiateNewUser(string name)
|
||||
private static User InstantiateNewUser(string name)
|
||||
{
|
||||
return new User
|
||||
{
|
||||
@@ -861,10 +861,7 @@ namespace Emby.Server.Implementations.Library
|
||||
};
|
||||
}
|
||||
|
||||
private string PasswordResetFile
|
||||
{
|
||||
get { return Path.Combine(ConfigurationManager.ApplicationPaths.ProgramDataPath, "passwordreset.txt"); }
|
||||
}
|
||||
private string PasswordResetFile => Path.Combine(ConfigurationManager.ApplicationPaths.ProgramDataPath, "passwordreset.txt");
|
||||
|
||||
private string _lastPin;
|
||||
private PasswordPinCreationResult _lastPasswordPinCreationResult;
|
||||
@@ -1047,7 +1044,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
private UserPolicy GetDefaultPolicy(User user)
|
||||
private static UserPolicy GetDefaultPolicy(User user)
|
||||
{
|
||||
return new UserPolicy
|
||||
{
|
||||
@@ -1109,12 +1106,12 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
private string GetPolicyFilePath(User user)
|
||||
private static string GetPolicyFilePath(User user)
|
||||
{
|
||||
return Path.Combine(user.ConfigurationDirectoryPath, "policy.xml");
|
||||
}
|
||||
|
||||
private string GetConfigurationFilePath(User user)
|
||||
private static string GetConfigurationFilePath(User user)
|
||||
{
|
||||
return Path.Combine(user.ConfigurationDirectoryPath, "config.xml");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user