diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.cs
index b34d0f21ef..e414792ba0 100644
--- a/Emby.Server.Implementations/Collections/CollectionManager.cs
+++ b/Emby.Server.Implementations/Collections/CollectionManager.cs
@@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.Collections
var name = _localizationManager.GetLocalizedString("Collections");
- await _libraryManager.AddVirtualFolder(name, CollectionTypeOptions.BoxSets, libraryOptions, true).ConfigureAwait(false);
+ await _libraryManager.AddVirtualFolder(name, CollectionTypeOptions.boxsets, libraryOptions, true).ConfigureAwait(false);
return FindFolders(path).First();
}
diff --git a/MediaBrowser.Model/Entities/CollectionTypeOptions.cs b/MediaBrowser.Model/Entities/CollectionTypeOptions.cs
index e1894d84ad..fc4cfdd66c 100644
--- a/MediaBrowser.Model/Entities/CollectionTypeOptions.cs
+++ b/MediaBrowser.Model/Entities/CollectionTypeOptions.cs
@@ -1,16 +1,49 @@
-#pragma warning disable CS1591
+#pragma warning disable SA1300 // Lowercase required for backwards compat.
-namespace MediaBrowser.Model.Entities
+namespace MediaBrowser.Model.Entities;
+
+///
+/// The collection type options.
+///
+public enum CollectionTypeOptions
{
- public enum CollectionTypeOptions
- {
- Movies = 0,
- TvShows = 1,
- Music = 2,
- MusicVideos = 3,
- HomeVideos = 4,
- BoxSets = 5,
- Books = 6,
- Mixed = 7
- }
+ ///
+ /// Movies.
+ ///
+ movies = 0,
+
+ ///
+ /// TV Shows.
+ ///
+ tvshows = 1,
+
+ ///
+ /// Music.
+ ///
+ music = 2,
+
+ ///
+ /// Music Videos.
+ ///
+ musicvideos = 3,
+
+ ///
+ /// Home Videos (and Photos).
+ ///
+ homevideos = 4,
+
+ ///
+ /// Box Sets.
+ ///
+ boxsets = 5,
+
+ ///
+ /// Books.
+ ///
+ books = 6,
+
+ ///
+ /// Mixed Movies and TV Shows.
+ ///
+ mixed = 7
}
diff --git a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs
index 2b2bda12c3..89bb72c3c8 100644
--- a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs
+++ b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs
@@ -37,7 +37,6 @@ namespace MediaBrowser.Model.Entities
/// Gets or sets the type of the collection.
///
/// The type of the collection.
- [JsonConverter(typeof(JsonLowerCaseConverter))]
public CollectionTypeOptions? CollectionType { get; set; }
public LibraryOptions LibraryOptions { get; set; }
diff --git a/src/Jellyfin.Extensions/Json/Converters/JsonLowerCaseConverter.cs b/src/Jellyfin.Extensions/Json/Converters/JsonLowerCaseConverter.cs
deleted file mode 100644
index cd582ced64..0000000000
--- a/src/Jellyfin.Extensions/Json/Converters/JsonLowerCaseConverter.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-
-namespace Jellyfin.Extensions.Json.Converters
-{
- ///
- /// Converts an object to a lowercase string.
- ///
- /// The object type.
- public class JsonLowerCaseConverter : JsonConverter
- {
- ///
- public override T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
- {
- return JsonSerializer.Deserialize(ref reader, options);
- }
-
- ///
- public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
- {
- writer.WriteStringValue(value?.ToString()?.ToLowerInvariant());
- }
- }
-}
diff --git a/src/Jellyfin.LiveTv/Recordings/RecordingsManager.cs b/src/Jellyfin.LiveTv/Recordings/RecordingsManager.cs
index 92605a1eb9..2f4caa3867 100644
--- a/src/Jellyfin.LiveTv/Recordings/RecordingsManager.cs
+++ b/src/Jellyfin.LiveTv/Recordings/RecordingsManager.cs
@@ -159,7 +159,7 @@ public sealed class RecordingsManager : IRecordingsManager, IDisposable
{
Locations = [customPath],
Name = "Recorded Movies",
- CollectionType = CollectionTypeOptions.Movies
+ CollectionType = CollectionTypeOptions.movies
};
}
@@ -172,7 +172,7 @@ public sealed class RecordingsManager : IRecordingsManager, IDisposable
{
Locations = [customPath],
Name = "Recorded Shows",
- CollectionType = CollectionTypeOptions.TvShows
+ CollectionType = CollectionTypeOptions.tvshows
};
}
}
diff --git a/tests/Jellyfin.Extensions.Tests/Json/Converters/JsonLowerCaseConverterTests.cs b/tests/Jellyfin.Extensions.Tests/Json/Converters/JsonLowerCaseConverterTests.cs
deleted file mode 100644
index 16c69ca489..0000000000
--- a/tests/Jellyfin.Extensions.Tests/Json/Converters/JsonLowerCaseConverterTests.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System.Text.Json;
-using System.Text.Json.Serialization;
-using Jellyfin.Extensions.Json.Converters;
-using MediaBrowser.Model.Entities;
-using Xunit;
-
-namespace Jellyfin.Extensions.Tests.Json.Converters
-{
- public class JsonLowerCaseConverterTests
- {
- private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions()
- {
- Converters =
- {
- new JsonStringEnumConverter()
- }
- };
-
- [Theory]
- [InlineData(null, "{\"CollectionType\":null}")]
- [InlineData(CollectionTypeOptions.Movies, "{\"CollectionType\":\"movies\"}")]
- [InlineData(CollectionTypeOptions.MusicVideos, "{\"CollectionType\":\"musicvideos\"}")]
- public void Serialize_CollectionTypeOptions_Correct(CollectionTypeOptions? collectionType, string expected)
- {
- Assert.Equal(expected, JsonSerializer.Serialize(new TestContainer(collectionType), _jsonOptions));
- }
-
- [Theory]
- [InlineData("{\"CollectionType\":null}", null)]
- [InlineData("{\"CollectionType\":\"movies\"}", CollectionTypeOptions.Movies)]
- [InlineData("{\"CollectionType\":\"musicvideos\"}", CollectionTypeOptions.MusicVideos)]
- public void Deserialize_CollectionTypeOptions_Correct(string json, CollectionTypeOptions? result)
- {
- var res = JsonSerializer.Deserialize(json, _jsonOptions);
- Assert.NotNull(res);
- Assert.Equal(result, res!.CollectionType);
- }
-
- [Theory]
- [InlineData(null)]
- [InlineData(CollectionTypeOptions.Movies)]
- [InlineData(CollectionTypeOptions.MusicVideos)]
- public void RoundTrip_CollectionTypeOptions_Correct(CollectionTypeOptions? value)
- {
- var res = JsonSerializer.Deserialize(JsonSerializer.Serialize(new TestContainer(value), _jsonOptions), _jsonOptions);
- Assert.NotNull(res);
- Assert.Equal(value, res!.CollectionType);
- }
-
- [Theory]
- [InlineData("{\"CollectionType\":null}")]
- [InlineData("{\"CollectionType\":\"movies\"}")]
- [InlineData("{\"CollectionType\":\"musicvideos\"}")]
- public void RoundTrip_String_Correct(string json)
- {
- var res = JsonSerializer.Serialize(JsonSerializer.Deserialize(json, _jsonOptions), _jsonOptions);
- Assert.Equal(json, res);
- }
-
- private sealed class TestContainer
- {
- public TestContainer(CollectionTypeOptions? collectionType)
- {
- CollectionType = collectionType;
- }
-
- [JsonConverter(typeof(JsonLowerCaseConverter))]
- public CollectionTypeOptions? CollectionType { get; set; }
- }
- }
-}