aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/Resolvers/Audio
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2023-11-09 14:00:29 -0700
committerGitHub <noreply@github.com>2023-11-09 14:00:29 -0700
commit906f701fa81c7cde1a9a01b066f3f29ff98552a5 (patch)
treeefc92ef0ecf4e535a519de4f8e950a77bb2ad5c3 /Emby.Server.Implementations/Library/Resolvers/Audio
parentc7a94d48ae019f41d5f06340bca7efe0788ad5ad (diff)
Convert CollectionType, SpecialFolderType to enum (#9764)
* Convert CollectionType, SpecialFolderType to enum * Hide internal enum CollectionType values * Apply suggestions from code review Co-authored-by: Shadowghost <Shadowghost@users.noreply.github.com> * Fix recent change * Update Jellyfin.Data/Attributes/OpenApiIgnoreEnumAttribute.cs Co-authored-by: Patrick Barron <barronpm@gmail.com> --------- Co-authored-by: Shadowghost <Shadowghost@users.noreply.github.com> Co-authored-by: Patrick Barron <barronpm@gmail.com>
Diffstat (limited to 'Emby.Server.Implementations/Library/Resolvers/Audio')
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs14
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs3
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs3
3 files changed, 11 insertions, 9 deletions
diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
index 862f144e6..ac423ed09 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
@@ -10,11 +10,11 @@ using Emby.Naming.Audio;
using Emby.Naming.AudioBook;
using Emby.Naming.Common;
using Emby.Naming.Video;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Resolvers;
-using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
namespace Emby.Server.Implementations.Library.Resolvers.Audio
@@ -40,7 +40,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
public MultiItemResolverResult ResolveMultiple(
Folder parent,
List<FileSystemMetadata> files,
- string collectionType,
+ CollectionType? collectionType,
IDirectoryService directoryService)
{
var result = ResolveMultipleInternal(parent, files, collectionType);
@@ -59,9 +59,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
private MultiItemResolverResult ResolveMultipleInternal(
Folder parent,
List<FileSystemMetadata> files,
- string collectionType)
+ CollectionType? collectionType)
{
- if (string.Equals(collectionType, CollectionType.Books, StringComparison.OrdinalIgnoreCase))
+ if (collectionType == CollectionType.Books)
{
return ResolveMultipleAudio(parent, files, true);
}
@@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
var collectionType = args.GetCollectionType();
- var isBooksCollectionType = string.Equals(collectionType, CollectionType.Books, StringComparison.OrdinalIgnoreCase);
+ var isBooksCollectionType = collectionType == CollectionType.Books;
if (args.IsDirectory)
{
@@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
return null;
}
- var isMixedCollectionType = string.IsNullOrEmpty(collectionType);
+ var isMixedCollectionType = collectionType is null;
// For conflicting extensions, give priority to videos
if (isMixedCollectionType && VideoResolver.IsVideoFile(args.Path, _namingOptions))
@@ -112,7 +112,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
MediaBrowser.Controller.Entities.Audio.Audio item = null;
- var isMusicCollectionType = string.Equals(collectionType, CollectionType.Music, StringComparison.OrdinalIgnoreCase);
+ var isMusicCollectionType = collectionType == CollectionType.Music;
// Use regular audio type for mixed libraries, owned items and music
if (isMixedCollectionType ||
diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
index bbc70701c..06e292f4c 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
@@ -8,6 +8,7 @@ using System.Threading;
using System.Threading.Tasks;
using Emby.Naming.Audio;
using Emby.Naming.Common;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
@@ -54,7 +55,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
protected override MusicAlbum Resolve(ItemResolveArgs args)
{
var collectionType = args.GetCollectionType();
- var isMusicMediaFolder = string.Equals(collectionType, CollectionType.Music, StringComparison.OrdinalIgnoreCase);
+ var isMusicMediaFolder = collectionType == CollectionType.Music;
// If there's a collection type and it's not music, don't allow it.
if (!isMusicMediaFolder)
diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
index c858dc53d..7d6f97b12 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
@@ -4,6 +4,7 @@ using System;
using System.Linq;
using System.Threading.Tasks;
using Emby.Naming.Common;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
@@ -64,7 +65,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
var collectionType = args.GetCollectionType();
- var isMusicMediaFolder = string.Equals(collectionType, CollectionType.Music, StringComparison.OrdinalIgnoreCase);
+ var isMusicMediaFolder = collectionType == CollectionType.Music;
// If there's a collection type and it's not music, it can't be a music artist
if (!isMusicMediaFolder)