Fix warnings in Library

This commit is contained in:
Patrick Barron 2021-10-02 13:59:58 -04:00
parent aa3c33060d
commit 876a902356
12 changed files with 33 additions and 25 deletions

View File

@ -647,7 +647,7 @@ namespace Emby.Server.Implementations.Library
/// Determines whether a path should be ignored based on its contents - called after the contents have been read. /// Determines whether a path should be ignored based on its contents - called after the contents have been read.
/// </summary> /// </summary>
/// <param name="args">The args.</param> /// <param name="args">The args.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
private static bool ShouldResolvePathContents(ItemResolveArgs args) private static bool ShouldResolvePathContents(ItemResolveArgs args)
{ {
// Ignore any folders containing a file called .ignore // Ignore any folders containing a file called .ignore
@ -1266,7 +1266,7 @@ namespace Emby.Server.Implementations.Library
/// </summary> /// </summary>
/// <param name="id">The id.</param> /// <param name="id">The id.</param>
/// <returns>BaseItem.</returns> /// <returns>BaseItem.</returns>
/// <exception cref="ArgumentNullException">id</exception> /// <exception cref="ArgumentNullException"><paramref name="id"/> is <c>null</c>.</exception>
public BaseItem GetItemById(Guid id) public BaseItem GetItemById(Guid id)
{ {
if (id == Guid.Empty) if (id == Guid.Empty)

View File

@ -13,9 +13,9 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Jellyfin.Data.Entities; using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums; using Jellyfin.Data.Enums;
using Jellyfin.Extensions.Json;
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using Jellyfin.Extensions.Json;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;

View File

@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Library
/// <param name="path">The original path.</param> /// <param name="path">The original path.</param>
/// <param name="subPath">The original sub path.</param> /// <param name="subPath">The original sub path.</param>
/// <param name="newSubPath">The new sub path.</param> /// <param name="newSubPath">The new sub path.</param>
/// <param name="newPath">The result of the sub path replacement</param> /// <param name="newPath">The result of the sub path replacement.</param>
/// <returns>The path after replacing the sub path.</returns> /// <returns>The path after replacing the sub path.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path" />, <paramref name="newSubPath" /> or <paramref name="newSubPath" /> is empty.</exception> /// <exception cref="ArgumentNullException"><paramref name="path" />, <paramref name="newSubPath" /> or <paramref name="newSubPath" /> is empty.</exception>
public static bool TryReplaceSubPath( public static bool TryReplaceSubPath(

View File

@ -82,6 +82,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
/// <summary> /// <summary>
/// Determine if the supplied file data points to a music album. /// Determine if the supplied file data points to a music album.
/// </summary> /// </summary>
/// <param name="path">The path to check.</param>
/// <param name="directoryService">The directory service.</param>
/// <returns><c>true</c> if the provided path points to a music album, <c>false</c> otherwise.</returns>
public bool IsMusicAlbum(string path, IDirectoryService directoryService) public bool IsMusicAlbum(string path, IDirectoryService directoryService)
{ {
return ContainsMusic(directoryService.GetFileSystemEntries(path), true, directoryService, _logger, _fileSystem, _libraryManager); return ContainsMusic(directoryService.GetFileSystemEntries(path), true, directoryService, _logger, _fileSystem, _libraryManager);

View File

@ -275,6 +275,10 @@ namespace Emby.Server.Implementations.Library.Resolvers
/// <summary> /// <summary>
/// Determines whether [is DVD directory] [the specified directory name]. /// Determines whether [is DVD directory] [the specified directory name].
/// </summary> /// </summary>
/// <param name="fullPath">The full path of the directory.</param>
/// <param name="directoryName">The name of the directory.</param>
/// <param name="directoryService">The directory service.</param>
/// <returns><c>true</c> if the provided directory is a DVD directory, <c>false</c> otherwise.</returns>
protected bool IsDvdDirectory(string fullPath, string directoryName, IDirectoryService directoryService) protected bool IsDvdDirectory(string fullPath, string directoryName, IDirectoryService directoryService)
{ {
if (!string.Equals(directoryName, "video_ts", StringComparison.OrdinalIgnoreCase)) if (!string.Equals(directoryName, "video_ts", StringComparison.OrdinalIgnoreCase))

View File

@ -49,13 +49,12 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
{ {
var bookFiles = args.FileSystemChildren.Where(f => var bookFiles = args.FileSystemChildren.Where(f =>
{ {
var fileExtension = Path.GetExtension(f.FullName) ?? var fileExtension = Path.GetExtension(f.FullName)
string.Empty; ?? string.Empty;
return _validExtensions.Contains( return _validExtensions.Contains(
fileExtension, fileExtension,
StringComparer StringComparer.OrdinalIgnoreCase);
.OrdinalIgnoreCase);
}).ToList(); }).ToList();
// Don't return a Book if there is more (or less) than one document in the directory // Don't return a Book if there is more (or less) than one document in the directory

View File

@ -24,6 +24,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
/// </summary> /// </summary>
public class MovieResolver : BaseVideoResolver<Video>, IMultiItemResolver public class MovieResolver : BaseVideoResolver<Video>, IMultiItemResolver
{ {
private readonly IImageProcessor _imageProcessor;
private string[] _validCollectionTypes = new[] private string[] _validCollectionTypes = new[]
{ {
CollectionType.Movies, CollectionType.Movies,
@ -33,8 +35,6 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
CollectionType.Photos CollectionType.Photos
}; };
private readonly IImageProcessor _imageProcessor;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="MovieResolver"/> class. /// Initializes a new instance of the <see cref="MovieResolver"/> class.
/// </summary> /// </summary>

View File

@ -67,7 +67,6 @@ namespace Emby.Server.Implementations.Library.Resolvers
return args.FileSystemChildren return args.FileSystemChildren
.Where(i => .Where(i =>
{ {
try try
{ {
return !i.IsDirectory && return !i.IsDirectory &&

View File

@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.Library
/// <param name="query">The query.</param> /// <param name="query">The query.</param>
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
/// <returns>IEnumerable{SearchHintResult}.</returns> /// <returns>IEnumerable{SearchHintResult}.</returns>
/// <exception cref="ArgumentNullException">searchTerm</exception> /// <exception cref="ArgumentException"><c>query.SearchTerm</c> is <c>null</c> or empty.</exception>
private List<SearchHintInfo> GetSearchHints(SearchQuery query, User user) private List<SearchHintInfo> GetSearchHints(SearchQuery query, User user)
{ {
var searchTerm = query.SearchTerm; var searchTerm = query.SearchTerm;

View File

@ -25,8 +25,6 @@ namespace Emby.Server.Implementations.Library
/// </summary> /// </summary>
public class UserDataManager : IUserDataManager public class UserDataManager : IUserDataManager
{ {
public event EventHandler<UserDataSaveEventArgs> UserDataSaved;
private readonly ConcurrentDictionary<string, UserItemData> _userData = private readonly ConcurrentDictionary<string, UserItemData> _userData =
new ConcurrentDictionary<string, UserItemData>(StringComparer.OrdinalIgnoreCase); new ConcurrentDictionary<string, UserItemData>(StringComparer.OrdinalIgnoreCase);
@ -44,6 +42,8 @@ namespace Emby.Server.Implementations.Library
_repository = repository; _repository = repository;
} }
public event EventHandler<UserDataSaveEventArgs> UserDataSaved;
public void SaveUserData(Guid userId, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken) public void SaveUserData(Guid userId, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken)
{ {
var user = _userManager.GetUserById(userId); var user = _userManager.GetUserById(userId);
@ -90,10 +90,9 @@ namespace Emby.Server.Implementations.Library
/// <summary> /// <summary>
/// Save the provided user data for the given user. Batch operation. Does not fire any events or update the cache. /// Save the provided user data for the given user. Batch operation. Does not fire any events or update the cache.
/// </summary> /// </summary>
/// <param name="userId"></param> /// <param name="userId">The user id.</param>
/// <param name="userData"></param> /// <param name="userData">The user item data.</param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public void SaveAllUserData(Guid userId, UserItemData[] userData, CancellationToken cancellationToken) public void SaveAllUserData(Guid userId, UserItemData[] userData, CancellationToken cancellationToken)
{ {
var user = _userManager.GetUserById(userId); var user = _userManager.GetUserById(userId);
@ -104,8 +103,8 @@ namespace Emby.Server.Implementations.Library
/// <summary> /// <summary>
/// Retrieve all user data for the given user. /// Retrieve all user data for the given user.
/// </summary> /// </summary>
/// <param name="userId"></param> /// <param name="userId">The user id.</param>
/// <returns></returns> /// <returns>A <see cref="List{UserItemData}"/> containing all of the user's item data.</returns>
public List<UserItemData> GetAllUserData(Guid userId) public List<UserItemData> GetAllUserData(Guid userId)
{ {
var user = _userManager.GetUserById(userId); var user = _userManager.GetUserById(userId);

View File

@ -348,7 +348,8 @@ namespace Emby.Server.Implementations.Library
nameof(Year), nameof(Year),
nameof(MusicGenre), nameof(MusicGenre),
nameof(Genre) nameof(Genre)
} : Array.Empty<string>(); }
: Array.Empty<string>();
var query = new InternalItemsQuery(user) var query = new InternalItemsQuery(user)
{ {

View File

@ -95,10 +95,13 @@ namespace Emby.Server.Implementations.Library.Validators
_logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N", CultureInfo.InvariantCulture), item.Name, item.GetType().Name); _logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N", CultureInfo.InvariantCulture), item.Name, item.GetType().Name);
_libraryManager.DeleteItem(item, new DeleteOptions _libraryManager.DeleteItem(
item,
new DeleteOptions
{ {
DeleteFileLocation = false DeleteFileLocation = false
}, false); },
false);
} }
progress.Report(100); progress.Report(100);