aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS.md1
-rw-r--r--Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs5
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/BaseItem/BaseItemKindTests.cs62
3 files changed, 68 insertions, 0 deletions
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index b44961bf8..59addc7fa 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -212,3 +212,4 @@
- [Tim Hobbs](https://github.com/timhobbs)
- [SvenVandenbrande](https://github.com/SvenVandenbrande)
- [olsh](https://github.com/olsh)
+ - [lbenini] (https://github.com/lbenini)
diff --git a/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs b/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs
index 358606b0d..4160f3a50 100644
--- a/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs
+++ b/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs
@@ -49,5 +49,10 @@ namespace Emby.Server.Implementations.Playlists
query.Parent = null;
return LibraryManager.GetItemsResult(query);
}
+
+ public override string GetClientTypeName()
+ {
+ return "ManualPlaylistsFolder";
+ }
}
}
diff --git a/tests/Jellyfin.Server.Implementations.Tests/BaseItem/BaseItemKindTests.cs b/tests/Jellyfin.Server.Implementations.Tests/BaseItem/BaseItemKindTests.cs
new file mode 100644
index 000000000..3f56c82f4
--- /dev/null
+++ b/tests/Jellyfin.Server.Implementations.Tests/BaseItem/BaseItemKindTests.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using MediaBrowser.Controller.Entities;
+using Xunit;
+
+namespace Jellyfin.Server.Implementations.Tests.BaseItem
+{
+ public class BaseItemKindTests
+ {
+ [Theory]
+ [ClassData(typeof(GetBaseItemDescendant))]
+ public void BaseKindEnumTest(Type baseItemDescendantType)
+ {
+ var defaultConstructor = baseItemDescendantType.GetConstructor(Type.EmptyTypes);
+
+ Assert.NotNull(defaultConstructor);
+ if (defaultConstructor != null)
+ {
+ var instance = (MediaBrowser.Controller.Entities.BaseItem)defaultConstructor.Invoke(null);
+ var exception = Record.Exception(() => instance.GetBaseItemKind());
+ Assert.Null(exception);
+ }
+ }
+
+ private static bool IsProjectAssemblyName(string? name)
+ {
+ if (name == null)
+ {
+ return false;
+ }
+
+ return name.Contains("Jellyfin", StringComparison.InvariantCulture)
+ || name.Contains("Emby", StringComparison.InvariantCulture)
+ || name.Contains("MediaBrowser", StringComparison.InvariantCulture)
+ || name.Contains("RSSDP", StringComparison.InvariantCulture);
+ }
+
+ private class GetBaseItemDescendant : IEnumerable<object?[]>
+ {
+ public IEnumerator<object?[]> GetEnumerator()
+ {
+ var projectAssemblies = AppDomain.CurrentDomain.GetAssemblies()
+ .Where(x => IsProjectAssemblyName(x.FullName));
+
+ foreach (var projectAssembly in projectAssemblies)
+ {
+ var baseItemDescendantTypes = projectAssembly.GetTypes()
+ .Where(targetType => targetType.IsClass && !targetType.IsAbstract && targetType.IsSubclassOf(typeof(MediaBrowser.Controller.Entities.BaseItem)));
+
+ foreach (var descendantType in baseItemDescendantTypes)
+ {
+ yield return new object?[] { descendantType };
+ }
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
+ }
+ }
+}