diff --git a/API.Tests/Services/ArchiveServiceTests.cs b/API.Tests/Services/ArchiveServiceTests.cs index be0662a53..35e26757a 100644 --- a/API.Tests/Services/ArchiveServiceTests.cs +++ b/API.Tests/Services/ArchiveServiceTests.cs @@ -276,24 +276,40 @@ public class ArchiveServiceTests { var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ArchiveService/ComicInfos"); var archive = Path.Join(testDirectory, "ComicInfo.zip"); - var actual = _archiveService.GetComicInfo(archive); - var expected = new ComicInfo() - { - Publisher = "Yen Press", - Genre = "Manga, Movies & TV", - Summary = - "By all counts, Ryouta Sakamoto is a loser when he's not holed up in his room, bombing things into oblivion in his favorite online action RPG. But his very own uneventful life is blown to pieces when he's abducted and taken to an uninhabited island, where he soon learns the hard way that he's being pitted against others just like him in a explosives-riddled death match! How could this be happening? Who's putting them up to this? And why!? The name, not to mention the objective, of this very real survival game is eerily familiar to Ryouta, who has mastered its virtual counterpart-BTOOOM! Can Ryouta still come out on top when he's playing for his life!?", - PageCount = 194, - LanguageISO = "en", - Notes = "Scraped metadata from Comixology [CMXDB450184]", - Series = "BTOOOM!", - Title = "v01", - Web = "https://www.comixology.com/BTOOOM/digital-comic/450184" - }; + var comicInfo = _archiveService.GetComicInfo(archive); - Assert.NotStrictEqual(expected, actual); + Assert.NotNull(comicInfo); + Assert.Equal(comicInfo.Publisher, "Yen Press"); + Assert.Equal(comicInfo.Genre, "Manga, Movies & TV"); + Assert.Equal(comicInfo.Summary, "By all counts, Ryouta Sakamoto is a loser when he's not holed up in his room, bombing things into oblivion in his favorite online action RPG. But his very own uneventful life is blown to pieces when he's abducted and taken to an uninhabited island, where he soon learns the hard way that he's being pitted against others just like him in a explosives-riddled death match! How could this be happening? Who's putting them up to this? And why!? The name, not to mention the objective, of this very real survival game is eerily familiar to Ryouta, who has mastered its virtual counterpart-BTOOOM! Can Ryouta still come out on top when he's playing for his life!?"); + Assert.Equal(comicInfo.PageCount, 194); + Assert.Equal(comicInfo.LanguageISO, "en"); + Assert.Equal(comicInfo.Notes, "Scraped metadata from Comixology [CMXDB450184]"); + Assert.Equal(comicInfo.Series, "BTOOOM!"); + Assert.Equal(comicInfo.Title, "v01"); + Assert.Equal(comicInfo.Web, "https://www.comixology.com/BTOOOM/digital-comic/450184"); } + #endregion + + #region CanParseComicInfo_DefaultNumberIsBlank + + [Fact] + public void CanParseComicInfo_DefaultNumberIsBlank() + { + var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ArchiveService/ComicInfos"); + var archive = Path.Join(testDirectory, "ComicInfo2.zip"); + var comicInfo = _archiveService.GetComicInfo(archive); + + Assert.NotNull(comicInfo); + Assert.Equal("Hellboy", comicInfo.Series); + Assert.Equal("The Right Hand of Doom", comicInfo.Title); + Assert.Equal("", comicInfo.Number); + Assert.Equal(0, comicInfo.Count); + Assert.Equal("4", comicInfo.Volume); + } + + #endregion #region FindCoverImageFilename diff --git a/API.Tests/Services/Test Data/ArchiveService/ComicInfos/ComicInfo2.zip b/API.Tests/Services/Test Data/ArchiveService/ComicInfos/ComicInfo2.zip new file mode 100644 index 000000000..b327b62d1 Binary files /dev/null and b/API.Tests/Services/Test Data/ArchiveService/ComicInfos/ComicInfo2.zip differ diff --git a/API/Data/Metadata/ComicInfo.cs b/API/Data/Metadata/ComicInfo.cs index eb9cdb344..20061f063 100644 --- a/API/Data/Metadata/ComicInfo.cs +++ b/API/Data/Metadata/ComicInfo.cs @@ -23,6 +23,7 @@ public class ComicInfo /// /// The total number of items in the series. /// + [System.ComponentModel.DefaultValueAttribute(0)] public int Count { get; set; } = 0; public string Volume { get; set; } = string.Empty; public string Notes { get; set; } = string.Empty; @@ -37,8 +38,11 @@ public class ComicInfo /// This is the link to where the data was scraped from /// public string Web { get; set; } = string.Empty; + [System.ComponentModel.DefaultValueAttribute(0)] public int Day { get; set; } = 0; + [System.ComponentModel.DefaultValueAttribute(0)] public int Month { get; set; } = 0; + [System.ComponentModel.DefaultValueAttribute(0)] public int Year { get; set; } = 0; @@ -54,6 +58,7 @@ public class ComicInfo public string StoryArc { get; set; } = string.Empty; public string SeriesGroup { get; set; } = string.Empty; public string AlternateNumber { get; set; } = string.Empty; + [System.ComponentModel.DefaultValueAttribute(0)] public int AlternateCount { get; set; } = 0; public string AlternateSeries { get; set; } = string.Empty; diff --git a/API/Services/BookService.cs b/API/Services/BookService.cs index dfbfc33d2..39bf64b95 100644 --- a/API/Services/BookService.cs +++ b/API/Services/BookService.cs @@ -447,6 +447,10 @@ public class BookService : IBookService case "calibre:title_sort": info.TitleSort = metadataItem.Content; break; + case "calibre:series": + info.Series = metadataItem.Content; + info.SeriesSort = metadataItem.Content; + break; } } @@ -609,15 +613,10 @@ public class BookService : IBookService FullFilePath = filePath, IsSpecial = false, Series = series.Trim(), + SeriesSort = series.Trim(), Volumes = seriesIndex }; - // Don't set titleSort if the book belongs to a group - if (!string.IsNullOrEmpty(titleSort) && string.IsNullOrEmpty(seriesIndex) && (groupPosition.Equals("series") || groupPosition.Equals("set"))) - { - info.SeriesSort = titleSort; - } - return info; } } diff --git a/API/Services/Tasks/Scanner/ProcessSeries.cs b/API/Services/Tasks/Scanner/ProcessSeries.cs index e8db2a97a..6db859b3b 100644 --- a/API/Services/Tasks/Scanner/ProcessSeries.cs +++ b/API/Services/Tasks/Scanner/ProcessSeries.cs @@ -647,7 +647,7 @@ public class ProcessSeries : IProcessSeries { var day = Math.Max(comicInfo.Day, 1); var month = Math.Max(comicInfo.Month, 1); - chapter.ReleaseDate = DateTime.Parse($"{month}/{day}/{comicInfo.Year}"); + chapter.ReleaseDate = new DateTime(comicInfo.Year, month, day); } var people = GetTagValues(comicInfo.Colorist);