From 3bfc2e6e94782c2fd7d9fb99e93271648e9ab02d Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Mon, 25 Mar 2024 17:27:13 -0600 Subject: [PATCH] 10.9 --- .../Common/BookFileNameParser.cs | 5 ++-- .../Jellyfin.Plugin.Bookshelf.csproj | 8 +++--- .../PluginServiceRegistrator.cs | 5 ++-- .../Providers/ComicBookImageProvider.cs | 2 +- .../ComicBookInfo/ComicBookInfoProvider.cs | 13 +++++++++- .../ComicInfo/ComicInfoXmlUtilities.cs | 13 +++++----- .../ComicInfo/ExternalComicInfoProvider.cs | 2 +- .../ComicInfo/InternalComicInfoProvider.cs | 2 +- .../ComicVine/BaseComicVineProvider.cs | 12 ++++----- .../ComicVine/ComicVineMetadataProvider.cs | 25 ++++++++++--------- .../GoogleBooks/GoogleBooksProvider.cs | 3 ++- .../Providers/OpfReader.cs | 3 ++- build.yaml | 20 ++------------- jellyfin.ruleset | 2 ++ .../BookFileNameParserTests.cs | 23 +++++++++-------- .../ComicBookInfoProviderTest.cs | 15 +++++------ .../ComicInfoXmlUtilitiesTest.cs | 15 +++++------ .../ComicVineProviderTests.cs | 11 ++++---- .../GoogleBooksProviderTests.cs | 5 ++-- .../Jellyfin.Plugin.Bookshelf.Tests.csproj | 10 ++++---- 20 files changed, 101 insertions(+), 93 deletions(-) diff --git a/Jellyfin.Plugin.Bookshelf/Common/BookFileNameParser.cs b/Jellyfin.Plugin.Bookshelf/Common/BookFileNameParser.cs index cf3ac52..d7d1362 100644 --- a/Jellyfin.Plugin.Bookshelf/Common/BookFileNameParser.cs +++ b/Jellyfin.Plugin.Bookshelf/Common/BookFileNameParser.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.Linq; using System.Text; using System.Text.RegularExpressions; +using Jellyfin.Data.Enums; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; @@ -39,7 +40,7 @@ namespace Jellyfin.Plugin.Bookshelf.Common new Regex(@"(?.*)") }; - private static readonly Dictionary _replaceEndNumerals = new () + private static readonly Dictionary _replaceEndNumerals = new() { { " i", " 1" }, { " ii", " 2" }, @@ -102,7 +103,7 @@ namespace Jellyfin.Plugin.Bookshelf.Common // If the book is in a folder, the folder's name will be set as the series name // If it's not in a folder, the series name will be set to the name of the collection // So if we couldn't find the series name in the book name, use the folder name instead - if (string.IsNullOrWhiteSpace(result.SeriesName) && seriesName != CollectionType.Books) + if (string.IsNullOrWhiteSpace(result.SeriesName) && !string.Equals(seriesName, "books", StringComparison.OrdinalIgnoreCase)) { result.SeriesName = seriesName; } diff --git a/Jellyfin.Plugin.Bookshelf/Jellyfin.Plugin.Bookshelf.csproj b/Jellyfin.Plugin.Bookshelf/Jellyfin.Plugin.Bookshelf.csproj index ee4043c..05f5063 100644 --- a/Jellyfin.Plugin.Bookshelf/Jellyfin.Plugin.Bookshelf.csproj +++ b/Jellyfin.Plugin.Bookshelf/Jellyfin.Plugin.Bookshelf.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 Jellyfin.Plugin.Bookshelf true true @@ -12,8 +12,8 @@ - - + + @@ -23,7 +23,7 @@ - + diff --git a/Jellyfin.Plugin.Bookshelf/PluginServiceRegistrator.cs b/Jellyfin.Plugin.Bookshelf/PluginServiceRegistrator.cs index c1e7bcf..3f7367a 100644 --- a/Jellyfin.Plugin.Bookshelf/PluginServiceRegistrator.cs +++ b/Jellyfin.Plugin.Bookshelf/PluginServiceRegistrator.cs @@ -2,7 +2,8 @@ using Jellyfin.Plugin.Bookshelf.Providers; using Jellyfin.Plugin.Bookshelf.Providers.ComicBookInfo; using Jellyfin.Plugin.Bookshelf.Providers.ComicInfo; using Jellyfin.Plugin.Bookshelf.Providers.ComicVine; -using MediaBrowser.Common.Plugins; +using MediaBrowser.Controller; +using MediaBrowser.Controller.Plugins; using Microsoft.Extensions.DependencyInjection; namespace Jellyfin.Plugin.Bookshelf @@ -13,7 +14,7 @@ namespace Jellyfin.Plugin.Bookshelf public class PluginServiceRegistrator : IPluginServiceRegistrator { /// - public void RegisterServices(IServiceCollection serviceCollection) + public void RegisterServices(IServiceCollection serviceCollection, IServerApplicationHost applicationHost) { // register the proxy local metadata provider for comic files serviceCollection.AddSingleton(); diff --git a/Jellyfin.Plugin.Bookshelf/Providers/ComicBookImageProvider.cs b/Jellyfin.Plugin.Bookshelf/Providers/ComicBookImageProvider.cs index b5cfcb6..b2ca613 100644 --- a/Jellyfin.Plugin.Bookshelf/Providers/ComicBookImageProvider.cs +++ b/Jellyfin.Plugin.Bookshelf/Providers/ComicBookImageProvider.cs @@ -108,7 +108,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers /// /// The archive to search. /// The search result. - private (ZipArchiveEntry coverEntry, ImageFormat imageFormat)? FindCoverEntryInZip(ZipArchive archive) + private (ZipArchiveEntry CoverEntry, ImageFormat ImageFormat)? FindCoverEntryInZip(ZipArchive archive) { foreach (ImageFormat imageFormat in Enum.GetValues(typeof(ImageFormat))) { diff --git a/Jellyfin.Plugin.Bookshelf/Providers/ComicBookInfo/ComicBookInfoProvider.cs b/Jellyfin.Plugin.Bookshelf/Providers/ComicBookInfo/ComicBookInfoProvider.cs index 424fb3b..89fee20 100644 --- a/Jellyfin.Plugin.Bookshelf/Providers/ComicBookInfo/ComicBookInfoProvider.cs +++ b/Jellyfin.Plugin.Bookshelf/Providers/ComicBookInfo/ComicBookInfoProvider.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Jellyfin.Data.Enums; using Jellyfin.Extensions.Json; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; @@ -185,7 +186,17 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicBookInfo person.Person = name[1].Trim(' ') + " " + name[0].Trim(' '); } - var personInfo = new PersonInfo { Name = person.Person, Type = person.Role }; + if (!Enum.TryParse(person.Role, out PersonKind personKind)) + { + personKind = PersonKind.Unknown; + } + + if (string.Equals("Colorer", person.Role, StringComparison.OrdinalIgnoreCase)) + { + personKind = PersonKind.Colorist; + } + + var personInfo = new PersonInfo { Name = person.Person, Type = personKind }; metadataResult.AddPerson(personInfo); } } diff --git a/Jellyfin.Plugin.Bookshelf/Providers/ComicInfo/ComicInfoXmlUtilities.cs b/Jellyfin.Plugin.Bookshelf/Providers/ComicInfo/ComicInfoXmlUtilities.cs index 97b8694..9ae9437 100644 --- a/Jellyfin.Plugin.Bookshelf/Providers/ComicInfo/ComicInfoXmlUtilities.cs +++ b/Jellyfin.Plugin.Bookshelf/Providers/ComicInfo/ComicInfoXmlUtilities.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.Linq; using System.Xml.Linq; using System.Xml.XPath; +using Jellyfin.Data.Enums; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; @@ -70,7 +71,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicInfo { foreach (var author in authors) { - var person = new PersonInfo { Name = author, Type = "Author" }; + var person = new PersonInfo { Name = author, Type = PersonKind.Author }; metadataResult.AddPerson(person); } }); @@ -78,7 +79,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicInfo { foreach (var penciller in pencilers) { - var person = new PersonInfo { Name = penciller, Type = "Penciller" }; + var person = new PersonInfo { Name = penciller, Type = PersonKind.Penciller }; metadataResult.AddPerson(person); } }); @@ -86,7 +87,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicInfo { foreach (var inker in inkers) { - var person = new PersonInfo { Name = inker, Type = "Inker" }; + var person = new PersonInfo { Name = inker, Type = PersonKind.Inker }; metadataResult.AddPerson(person); } }); @@ -94,7 +95,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicInfo { foreach (var letterer in letterers) { - var person = new PersonInfo { Name = letterer, Type = "Letterer" }; + var person = new PersonInfo { Name = letterer, Type = PersonKind.Letterer }; metadataResult.AddPerson(person); } }); @@ -102,7 +103,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicInfo { foreach (var coverartist in coverartists) { - var person = new PersonInfo { Name = coverartist, Type = "Cover Artist" }; + var person = new PersonInfo { Name = coverartist, Type = PersonKind.CoverArtist }; metadataResult.AddPerson(person); } }); @@ -110,7 +111,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicInfo { foreach (var colourist in colourists) { - var person = new PersonInfo { Name = colourist, Type = "Colourist" }; + var person = new PersonInfo { Name = colourist, Type = PersonKind.Colorist }; metadataResult.AddPerson(person); } }); diff --git a/Jellyfin.Plugin.Bookshelf/Providers/ComicInfo/ExternalComicInfoProvider.cs b/Jellyfin.Plugin.Bookshelf/Providers/ComicInfo/ExternalComicInfoProvider.cs index 60da14e..6bf2386 100644 --- a/Jellyfin.Plugin.Bookshelf/Providers/ComicInfo/ExternalComicInfoProvider.cs +++ b/Jellyfin.Plugin.Bookshelf/Providers/ComicInfo/ExternalComicInfoProvider.cs @@ -21,7 +21,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicInfo private readonly IFileSystem _fileSystem; private readonly ILogger _logger; - private readonly IComicInfoXmlUtilities _utilities = new ComicInfoXmlUtilities(); + private readonly ComicInfoXmlUtilities _utilities = new ComicInfoXmlUtilities(); /// /// Initializes a new instance of the class. diff --git a/Jellyfin.Plugin.Bookshelf/Providers/ComicInfo/InternalComicInfoProvider.cs b/Jellyfin.Plugin.Bookshelf/Providers/ComicInfo/InternalComicInfoProvider.cs index cff34cb..2652fc5 100644 --- a/Jellyfin.Plugin.Bookshelf/Providers/ComicInfo/InternalComicInfoProvider.cs +++ b/Jellyfin.Plugin.Bookshelf/Providers/ComicInfo/InternalComicInfoProvider.cs @@ -17,7 +17,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicInfo { private readonly IFileSystem _fileSystem; private readonly ILogger _logger; - private readonly IComicInfoXmlUtilities _utilities = new ComicInfoXmlUtilities(); + private readonly ComicInfoXmlUtilities _utilities = new ComicInfoXmlUtilities(); /// /// Initializes a new instance of the class. diff --git a/Jellyfin.Plugin.Bookshelf/Providers/ComicVine/BaseComicVineProvider.cs b/Jellyfin.Plugin.Bookshelf/Providers/ComicVine/BaseComicVineProvider.cs index 71e7e88..795d9d2 100644 --- a/Jellyfin.Plugin.Bookshelf/Providers/ComicVine/BaseComicVineProvider.cs +++ b/Jellyfin.Plugin.Bookshelf/Providers/ComicVine/BaseComicVineProvider.cs @@ -161,7 +161,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicVine var results = GetFromApiResponse(apiResponse); - if (results.Count() != 1) + if (results.Count != 1) { _logger.LogError("Unexpected number of results in Comic Vine API response."); return default; @@ -176,25 +176,25 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicVine /// Type of the results. /// API response. /// The results. - protected IEnumerable GetFromApiResponse(BaseApiResponse response) + protected IReadOnlyList GetFromApiResponse(BaseApiResponse response) { if (response.IsError) { _logger.LogError("Comic Vine API response received with error code {ErrorCode} : {ErrorMessage}", response.StatusCode, response.Error); - return Enumerable.Empty(); + return Array.Empty(); } if (response is SearchApiResponse searchResponse) { - return searchResponse.Results; + return searchResponse.Results.ToList(); } else if (response is ItemApiResponse itemResponse) { - return itemResponse.Results == null ? Enumerable.Empty() : new[] { itemResponse.Results }; + return itemResponse.Results == null ? Array.Empty() : [itemResponse.Results]; } else { - return Enumerable.Empty(); + return Array.Empty(); } } diff --git a/Jellyfin.Plugin.Bookshelf/Providers/ComicVine/ComicVineMetadataProvider.cs b/Jellyfin.Plugin.Bookshelf/Providers/ComicVine/ComicVineMetadataProvider.cs index e8deee6..62e4761 100644 --- a/Jellyfin.Plugin.Bookshelf/Providers/ComicVine/ComicVineMetadataProvider.cs +++ b/Jellyfin.Plugin.Bookshelf/Providers/ComicVine/ComicVineMetadataProvider.cs @@ -7,6 +7,7 @@ using System.Net.Http; using System.Net.Http.Json; using System.Threading; using System.Threading.Tasks; +using Jellyfin.Data.Enums; using Jellyfin.Plugin.Bookshelf.Common; using Jellyfin.Plugin.Bookshelf.Providers.ComicVine.Models; using MediaBrowser.Common.Net; @@ -142,7 +143,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicVine var personInfo = new PersonInfo { Name = person.Name, - Type = person.Roles.Any() ? GetPersonKindFromRole(person.Roles.First()) : "Unknown" + Type = person.Roles.Any() ? GetPersonKindFromRole(person.Roles.First()) : PersonKind.Unknown }; personInfo.SetProviderId(ComicVineConstants.ProviderId, GetProviderIdFromSiteDetailUrl(person.SiteDetailUrl)); @@ -151,24 +152,24 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicVine } } - private string GetPersonKindFromRole(PersonCreditRole role) + private PersonKind GetPersonKindFromRole(PersonCreditRole role) { return role switch { - PersonCreditRole.Artist => "Artist", - PersonCreditRole.Colorist => "Colorist", - PersonCreditRole.Cover => "CoverArtist", - PersonCreditRole.Editor => "Editor", - PersonCreditRole.Inker => "Inker", - PersonCreditRole.Letterer => "Letterer", - PersonCreditRole.Penciler => "Penciller", - PersonCreditRole.Translator => "Translator", - PersonCreditRole.Writer => "Writer", + PersonCreditRole.Artist => PersonKind.Artist, + PersonCreditRole.Colorist => PersonKind.Colorist, + PersonCreditRole.Cover => PersonKind.CoverArtist, + PersonCreditRole.Editor => PersonKind.Editor, + PersonCreditRole.Inker => PersonKind.Inker, + PersonCreditRole.Letterer => PersonKind.Letterer, + PersonCreditRole.Penciler => PersonKind.Penciller, + PersonCreditRole.Translator => PersonKind.Translator, + PersonCreditRole.Writer => PersonKind.Writer, PersonCreditRole.Assistant or PersonCreditRole.Designer or PersonCreditRole.Journalist or PersonCreditRole.Production - or PersonCreditRole.Other => "Unknown", + or PersonCreditRole.Other => PersonKind.Unknown, _ => throw new ArgumentException($"Unknown role: {role}"), }; } diff --git a/Jellyfin.Plugin.Bookshelf/Providers/GoogleBooks/GoogleBooksProvider.cs b/Jellyfin.Plugin.Bookshelf/Providers/GoogleBooks/GoogleBooksProvider.cs index 29c20a6..7b85836 100644 --- a/Jellyfin.Plugin.Bookshelf/Providers/GoogleBooks/GoogleBooksProvider.cs +++ b/Jellyfin.Plugin.Bookshelf/Providers/GoogleBooks/GoogleBooksProvider.cs @@ -6,6 +6,7 @@ using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; +using Jellyfin.Data.Enums; using Jellyfin.Plugin.Bookshelf.Common; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Entities; @@ -292,7 +293,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks metadataResult.AddPerson(new PersonInfo { Name = author, - Type = "Author", + Type = PersonKind.Author, }); } diff --git a/Jellyfin.Plugin.Bookshelf/Providers/OpfReader.cs b/Jellyfin.Plugin.Bookshelf/Providers/OpfReader.cs index bb6fed1..09b77e2 100644 --- a/Jellyfin.Plugin.Bookshelf/Providers/OpfReader.cs +++ b/Jellyfin.Plugin.Bookshelf/Providers/OpfReader.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Xml; +using Jellyfin.Data.Enums; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; @@ -105,7 +106,7 @@ namespace Jellyfin.Plugin.Bookshelf.Providers var bookResult = new MetadataResult { Item = book, HasMetadata = true }; ReadStringInto("//dc:creator", author => { - var person = new PersonInfo { Name = author, Type = "Author" }; + var person = new PersonInfo { Name = author, Type = PersonKind.Author }; bookResult.AddPerson(person); }); diff --git a/build.yaml b/build.yaml index eea7ee9..2deff6c 100644 --- a/build.yaml +++ b/build.yaml @@ -2,8 +2,8 @@ name: "Bookshelf" guid: "9c4e63f1-031b-4f25-988b-4f7d78a8b53e" version: 10 -targetAbi: "10.8.13.0" -framework: "net6.0" +targetAbi: "10.9.0.0" +framework: "net8.0" owner: "jellyfin" overview: "Manage your books" description: > @@ -13,19 +13,3 @@ category: "Metadata" artifacts: - "Jellyfin.Plugin.Bookshelf.dll" changelog: |- - - Add Unit tests for ComicInfo and ComicBookInfo formats (#70) @carif - - ### New features and improvements ### - - Add Comic Vine metadata provider (#81) @Pithaya - - Add Google Books external id (#80) @Pithaya - - Add unit tests for the Google Books providers (#78) @Pithaya - - Improve title handling of epub files (#75) @carif - - ### Bug Fixes ### - - Update EpubMetadataImageProvider.cs (#66) @wuyu8512 - - ### Documentation updates ### - - Fix typo and improve README formatting (#74) @carif - - ### Dependency updates ### - - Update xunit-dotnet monorepo to v2.5.3 (#82) @renovate diff --git a/jellyfin.ruleset b/jellyfin.ruleset index e7bc7ec..efd612f 100644 --- a/jellyfin.ruleset +++ b/jellyfin.ruleset @@ -114,5 +114,7 @@ + + diff --git a/tests/Jellyfin.Plugin.Bookshelf.Tests/BookFileNameParserTests.cs b/tests/Jellyfin.Plugin.Bookshelf.Tests/BookFileNameParserTests.cs index 9d1285a..a4599a1 100644 --- a/tests/Jellyfin.Plugin.Bookshelf.Tests/BookFileNameParserTests.cs +++ b/tests/Jellyfin.Plugin.Bookshelf.Tests/BookFileNameParserTests.cs @@ -1,3 +1,4 @@ +using Jellyfin.Data.Enums; using Jellyfin.Plugin.Bookshelf.Common; using MediaBrowser.Model.Entities; @@ -15,7 +16,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests Name = "Children of Time" }; - var result = BookFileNameParser.Parse("Children of Time", CollectionType.Books); + var result = BookFileNameParser.Parse("Children of Time", "books"); Assert.Equal(expected, result); } @@ -29,7 +30,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests Year = 2015 }; - var result = BookFileNameParser.Parse("Children of Time (2015)", CollectionType.Books); + var result = BookFileNameParser.Parse("Children of Time (2015)", "books"); Assert.Equal(expected, result); } @@ -43,7 +44,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests Index = 1 }; - var result = BookFileNameParser.Parse("1 - Children of Time", CollectionType.Books); + var result = BookFileNameParser.Parse("1 - Children of Time", "books"); Assert.Equal(expected, result); } @@ -73,7 +74,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests Index = 1 }; - var result = BookFileNameParser.Parse("1 - Children of Time (2015)", CollectionType.Books); + var result = BookFileNameParser.Parse("1 - Children of Time (2015)", "books"); Assert.Equal(expected, result); } @@ -92,7 +93,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests Index = 2 }; - result = BookFileNameParser.Parse("Children of Time (2015) #2 (of 3) (2019)", CollectionType.Books); + result = BookFileNameParser.Parse("Children of Time (2015) #2 (of 3) (2019)", "books"); Assert.Equal(expected, result); // Without series year @@ -103,7 +104,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests Index = 2 }; - result = BookFileNameParser.Parse("Children of Time #2 (of 3) (2019)", CollectionType.Books); + result = BookFileNameParser.Parse("Children of Time #2 (of 3) (2019)", "books"); Assert.Equal(expected, result); // Without total count @@ -114,7 +115,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests Index = 2 }; - result = BookFileNameParser.Parse("Children of Time #2 (2019)", CollectionType.Books); + result = BookFileNameParser.Parse("Children of Time #2 (2019)", "books"); Assert.Equal(expected, result); // With only issue number @@ -124,7 +125,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests Index = 2 }; - result = BookFileNameParser.Parse("Children of Time #2", CollectionType.Books); + result = BookFileNameParser.Parse("Children of Time #2", "books"); Assert.Equal(expected, result); // With only issue number and leading zeroes @@ -134,7 +135,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests Index = 2 }; - result = BookFileNameParser.Parse("Children of Time #002", CollectionType.Books); + result = BookFileNameParser.Parse("Children of Time #002", "books"); Assert.Equal(expected, result); } @@ -152,7 +153,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests Index = 2 }; - result = BookFileNameParser.Parse("Children of Ruin (Children of Time, #2)", CollectionType.Books); + result = BookFileNameParser.Parse("Children of Ruin (Children of Time, #2)", "books"); Assert.Equal(expected, result); // Goodreads format with year added @@ -164,7 +165,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests Year = 2019 }; - result = BookFileNameParser.Parse("Children of Ruin (Children of Time, #2) (2019)", CollectionType.Books); + result = BookFileNameParser.Parse("Children of Ruin (Children of Time, #2) (2019)", "books"); Assert.Equal(expected, result); } diff --git a/tests/Jellyfin.Plugin.Bookshelf.Tests/ComicBookInfoProviderTest.cs b/tests/Jellyfin.Plugin.Bookshelf.Tests/ComicBookInfoProviderTest.cs index fad2509..e453072 100644 --- a/tests/Jellyfin.Plugin.Bookshelf.Tests/ComicBookInfoProviderTest.cs +++ b/tests/Jellyfin.Plugin.Bookshelf.Tests/ComicBookInfoProviderTest.cs @@ -1,4 +1,5 @@ using System; +using Jellyfin.Data.Enums; using Jellyfin.Plugin.Bookshelf.Providers.ComicBookInfo; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; @@ -129,13 +130,13 @@ public class ComicBookInfoProviderTest Assert.NotNull(_comicBookInfoFormat.Metadata); _uut.ReadPeopleMetadata(_comicBookInfoFormat.Metadata!, metadataResult); - var writer = new PersonInfo { Name = "Alan Moore", Type = "Writer" }; - var artist = new PersonInfo { Name = "Dave Gibbons", Type = "Artist" }; - var letterer = new PersonInfo { Name = "Dave Gibbons", Type = "Letterer" }; - var colorer = new PersonInfo { Name = "John Gibbons", Type = "Colorer" }; - var editor0 = new PersonInfo { Name = "Len Wein", Type = "Editor" }; - var editor1 = new PersonInfo { Name = "Barbara Kesel", Type = "Editor" }; - var example = new PersonInfo { Name = "Takashi Shimoyama", Type = "Example" }; + var writer = new PersonInfo { Name = "Alan Moore", Type = PersonKind.Writer }; + var artist = new PersonInfo { Name = "Dave Gibbons", Type = PersonKind.Artist }; + var letterer = new PersonInfo { Name = "Dave Gibbons", Type = PersonKind.Letterer }; + var colorer = new PersonInfo { Name = "John Gibbons", Type = PersonKind.Colorist }; + var editor0 = new PersonInfo { Name = "Len Wein", Type = PersonKind.Editor }; + var editor1 = new PersonInfo { Name = "Barbara Kesel", Type = PersonKind.Editor }; + var example = new PersonInfo { Name = "Takashi Shimoyama", Type = PersonKind.Unknown }; Assert.Collection( metadataResult.People, diff --git a/tests/Jellyfin.Plugin.Bookshelf.Tests/ComicInfoXmlUtilitiesTest.cs b/tests/Jellyfin.Plugin.Bookshelf.Tests/ComicInfoXmlUtilitiesTest.cs index edbbc5a..43624b8 100644 --- a/tests/Jellyfin.Plugin.Bookshelf.Tests/ComicInfoXmlUtilitiesTest.cs +++ b/tests/Jellyfin.Plugin.Bookshelf.Tests/ComicInfoXmlUtilitiesTest.cs @@ -2,6 +2,7 @@ using Xunit; using System; using System.Xml.Linq; using System.Globalization; +using Jellyfin.Data.Enums; using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Entities; @@ -117,13 +118,13 @@ public class ComicInfoXmlUtilitiesTest _uut.ReadPeopleMetadata(_document, metadataResult); - var author = new PersonInfo { Name = "Hajime Isayama", Type = "Author" }; - var penciller = new PersonInfo { Name = "A Penciller", Type = "Penciller" }; - var inker = new PersonInfo { Name = "An Inker", Type = "Inker" }; - var letterer = new PersonInfo { Name = "Steve Wands", Type = "Letterer" }; - var coverArtist0 = new PersonInfo { Name = "Artist A", Type = "Cover Artist" }; - var coverArtist1 = new PersonInfo { Name = "Takashi Shimoyama", Type = "Cover Artist" }; - var colourist = new PersonInfo { Name = "An Colourist", Type = "Colourist" }; + var author = new PersonInfo { Name = "Hajime Isayama", Type = PersonKind.Author }; + var penciller = new PersonInfo { Name = "A Penciller", Type = PersonKind.Penciller }; + var inker = new PersonInfo { Name = "An Inker", Type = PersonKind.Inker }; + var letterer = new PersonInfo { Name = "Steve Wands", Type = PersonKind.Letterer }; + var coverArtist0 = new PersonInfo { Name = "Artist A", Type = PersonKind.CoverArtist }; + var coverArtist1 = new PersonInfo { Name = "Takashi Shimoyama", Type = PersonKind.CoverArtist }; + var colourist = new PersonInfo { Name = "An Colourist", Type = PersonKind.Colorist }; Assert.Collection(metadataResult.People, authorActual => { diff --git a/tests/Jellyfin.Plugin.Bookshelf.Tests/ComicVineProviderTests.cs b/tests/Jellyfin.Plugin.Bookshelf.Tests/ComicVineProviderTests.cs index 2894623..03b3820 100644 --- a/tests/Jellyfin.Plugin.Bookshelf.Tests/ComicVineProviderTests.cs +++ b/tests/Jellyfin.Plugin.Bookshelf.Tests/ComicVineProviderTests.cs @@ -1,4 +1,5 @@ using System.Net; +using Jellyfin.Data.Enums; using Jellyfin.Plugin.Bookshelf.Providers.ComicVine; using Jellyfin.Plugin.Bookshelf.Tests.Http; using MediaBrowser.Controller.Entities; @@ -277,31 +278,31 @@ namespace Jellyfin.Plugin.Bookshelf.Tests p => { Assert.Equal("Ben Applegate", p.Name); - Assert.Equal("Editor", p.Type); + Assert.Equal(PersonKind.Editor, p.Type); Assert.True(HasComicVineId("ben-applegate/4040-74578", p.ProviderIds)); }, p => { Assert.Equal("Hajime Isayama", p.Name); - Assert.Equal("Writer", p.Type); + Assert.Equal(PersonKind.Writer, p.Type); Assert.True(HasComicVineId("hajime-isayama/4040-64651", p.ProviderIds)); }, p => { Assert.Equal("Ko Ransom", p.Name); - Assert.Equal("Unknown", p.Type); + Assert.Equal(PersonKind.Unknown, p.Type); Assert.True(HasComicVineId("ko-ransom/4040-74576", p.ProviderIds)); }, p => { Assert.Equal("Steve Wands", p.Name); - Assert.Equal("Letterer", p.Type); + Assert.Equal(PersonKind.Letterer, p.Type); Assert.True(HasComicVineId("steve-wands/4040-47630", p.ProviderIds)); }, p => { Assert.Equal("Takashi Shimoyama", p.Name); - Assert.Equal("CoverArtist", p.Type); + Assert.Equal(PersonKind.CoverArtist, p.Type); Assert.True(HasComicVineId("takashi-shimoyama/4040-74571", p.ProviderIds)); }); diff --git a/tests/Jellyfin.Plugin.Bookshelf.Tests/GoogleBooksProviderTests.cs b/tests/Jellyfin.Plugin.Bookshelf.Tests/GoogleBooksProviderTests.cs index 7898971..7ad5424 100644 --- a/tests/Jellyfin.Plugin.Bookshelf.Tests/GoogleBooksProviderTests.cs +++ b/tests/Jellyfin.Plugin.Bookshelf.Tests/GoogleBooksProviderTests.cs @@ -1,4 +1,5 @@ using System.Net; +using Jellyfin.Data.Enums; using Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks; using Jellyfin.Plugin.Bookshelf.Tests.Http; using MediaBrowser.Controller.Entities; @@ -218,7 +219,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests p => { Assert.Equal("Adrian Tchaikovsky", p.Name); - Assert.Equal("Author", p.Type); + Assert.Equal(PersonKind.Author, p.Type); }); Assert.True(HasGoogleId("49T5twEACAAJ", metadataResult.Item.ProviderIds)); @@ -278,7 +279,7 @@ namespace Jellyfin.Plugin.Bookshelf.Tests p => { Assert.Equal("Adrian Tchaikovsky", p.Name); - Assert.Equal("Author", p.Type); + Assert.Equal(PersonKind.Author, p.Type); }); Assert.True(HasGoogleId("G7utDwAAQBAJ", metadataResult.Item.ProviderIds)); diff --git a/tests/Jellyfin.Plugin.Bookshelf.Tests/Jellyfin.Plugin.Bookshelf.Tests.csproj b/tests/Jellyfin.Plugin.Bookshelf.Tests/Jellyfin.Plugin.Bookshelf.Tests.csproj index b161873..86d73a5 100644 --- a/tests/Jellyfin.Plugin.Bookshelf.Tests/Jellyfin.Plugin.Bookshelf.Tests.csproj +++ b/tests/Jellyfin.Plugin.Bookshelf.Tests/Jellyfin.Plugin.Bookshelf.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable false @@ -11,14 +11,14 @@ - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all