aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Playlists/PlaylistManager.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2023-05-13 12:44:31 -0600
committerCody Robibero <cody@robibe.ro>2023-10-10 15:57:15 -0600
commit2920611ffc206d845563637c4a865bf3f02d1374 (patch)
treec69c43264165df71866220966929e7a07a907d20 /Emby.Server.Implementations/Playlists/PlaylistManager.cs
parent74f61fbd79ef2e2ad4a986f5f886581b2827de07 (diff)
Convert string MediaType to enum MediaType
Diffstat (limited to 'Emby.Server.Implementations/Playlists/PlaylistManager.cs')
-rw-r--r--Emby.Server.Implementations/Playlists/PlaylistManager.cs15
1 files changed, 8 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
index 649c49924..c783f2b01 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
@@ -10,6 +10,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
+using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@@ -74,7 +75,7 @@ namespace Emby.Server.Implementations.Playlists
throw new ArgumentException(nameof(parentFolder));
}
- if (string.IsNullOrEmpty(options.MediaType))
+ if (options.MediaType is null || options.MediaType == MediaType.Unknown)
{
foreach (var itemId in options.ItemIdList)
{
@@ -84,7 +85,7 @@ namespace Emby.Server.Implementations.Playlists
throw new ArgumentException("No item exists with the supplied Id");
}
- if (!string.IsNullOrEmpty(item.MediaType))
+ if (item.MediaType == MediaType.Unknown)
{
options.MediaType = item.MediaType;
}
@@ -102,20 +103,20 @@ namespace Emby.Server.Implementations.Playlists
{
options.MediaType = folder.GetRecursiveChildren(i => !i.IsFolder && i.SupportsAddingToPlaylist)
.Select(i => i.MediaType)
- .FirstOrDefault(i => !string.IsNullOrEmpty(i));
+ .FirstOrDefault(i => i != MediaType.Unknown);
}
}
- if (!string.IsNullOrEmpty(options.MediaType))
+ if (options.MediaType is null || options.MediaType == MediaType.Unknown)
{
break;
}
}
}
- if (string.IsNullOrEmpty(options.MediaType))
+ if (options.MediaType is null || options.MediaType == MediaType.Unknown)
{
- options.MediaType = "Audio";
+ options.MediaType = MediaType.Audio;
}
var user = _userManager.GetUserById(options.UserId);
@@ -168,7 +169,7 @@ namespace Emby.Server.Implementations.Playlists
return path;
}
- private List<BaseItem> GetPlaylistItems(IEnumerable<Guid> itemIds, string playlistMediaType, User user, DtoOptions options)
+ private List<BaseItem> GetPlaylistItems(IEnumerable<Guid> itemIds, MediaType playlistMediaType, User user, DtoOptions options)
{
var items = itemIds.Select(i => _libraryManager.GetItemById(i)).Where(i => i is not null);