diff --git a/API.Tests/Services/ScannerServiceTests.cs b/API.Tests/Services/ScannerServiceTests.cs index acc0345b1..838bd8d07 100644 --- a/API.Tests/Services/ScannerServiceTests.cs +++ b/API.Tests/Services/ScannerServiceTests.cs @@ -972,4 +972,35 @@ public class ScannerServiceTests : AbstractDbTest Assert.Contains(postLib.Series, x => x.Name == "Immoral Guild"); Assert.Contains(postLib.Series, x => x.Name == "Futoku No Guild"); } + + #region Just Parsing Tests + [Fact] + public async Task Special_WithTitle_HasTitleSet() + { + const string testcase = "Series with Just a Special - Manga.json"; + + // Get the first file and generate a ComicInfo + var infos = new Dictionary(); + infos.Add("just a bunch of junk.cbz", new ComicInfo() + { + Series = "test", + Title = "Special Title", + Format = "Special" + }); + + var library = await _scannerHelper.GenerateScannerData(testcase, infos); + + var scanner = _scannerHelper.CreateServices(); + await scanner.ScanLibrary(library.Id); + + var postLib = await UnitOfWork.LibraryRepository.GetLibraryForIdAsync(library.Id, LibraryIncludes.Series); + + // Validate that there are 2 series + Assert.NotNull(postLib); + + + Assert.Equal("test", postLib.Series.First().Name); + Assert.Equal("Special Title", postLib.Series.First().Volumes[0].Chapters[0].Title); + } + #endregion } diff --git a/API.Tests/Services/Test Data/ScannerService/TestCases/Series with Just a Special - Manga.json b/API.Tests/Services/Test Data/ScannerService/TestCases/Series with Just a Special - Manga.json new file mode 100644 index 000000000..7b1c2b359 --- /dev/null +++ b/API.Tests/Services/Test Data/ScannerService/TestCases/Series with Just a Special - Manga.json @@ -0,0 +1,3 @@ +[ + "test/just a bunch of junk.cbz" +] \ No newline at end of file diff --git a/API/Entities/Chapter.cs b/API/Entities/Chapter.cs index 61a70c8a2..50ace09ed 100644 --- a/API/Entities/Chapter.cs +++ b/API/Entities/Chapter.cs @@ -188,7 +188,7 @@ public class Chapter : IEntityDate, IHasReadTimeEstimate, IHasCoverImage MinNumber = Parser.DefaultChapterNumber; MaxNumber = Parser.DefaultChapterNumber; } - Title = (IsSpecial && info.Format is MangaFormat.Epub or MangaFormat.Pdf) + Title = IsSpecial ? info.Title : Parser.RemoveExtensionIfSupported(Range); diff --git a/API/Helpers/Builders/ChapterBuilder.cs b/API/Helpers/Builders/ChapterBuilder.cs index d9976d92a..e5891659f 100644 --- a/API/Helpers/Builders/ChapterBuilder.cs +++ b/API/Helpers/Builders/ChapterBuilder.cs @@ -39,9 +39,7 @@ public class ChapterBuilder : IEntityBuilder return builder.WithNumber(Parser.RemoveExtensionIfSupported(info.Chapters)!) .WithRange(specialTreatment ? info.Filename : info.Chapters) - .WithTitle(specialTreatment && info.Format is MangaFormat.Epub or MangaFormat.Pdf - ? info.Title - : specialTitle ?? string.Empty) + .WithTitle(info.Title ?? string.Empty) // NOTE: This originally had duplicate logic. I moved it further up int the pipeline. .WithIsSpecial(specialTreatment); } diff --git a/API/Services/Plus/ExternalMetadataService.cs b/API/Services/Plus/ExternalMetadataService.cs index 3c8023671..28deb2c97 100644 --- a/API/Services/Plus/ExternalMetadataService.cs +++ b/API/Services/Plus/ExternalMetadataService.cs @@ -1412,6 +1412,8 @@ public class ExternalMetadataService : IExternalMetadataService } await DownloadSeriesCovers(series, externalMetadata.CoverUrl); + + return true; } diff --git a/API/Services/Tasks/Scanner/Parser/DefaultParser.cs b/API/Services/Tasks/Scanner/Parser/DefaultParser.cs index 687617fd7..01e1cceea 100644 --- a/API/Services/Tasks/Scanner/Parser/DefaultParser.cs +++ b/API/Services/Tasks/Scanner/Parser/DefaultParser.cs @@ -128,6 +128,7 @@ public abstract class DefaultParser(IDirectoryService directoryService) : IDefau info.IsSpecial = true; info.Chapters = Parser.DefaultChapter; info.Volumes = Parser.SpecialVolume; + info.Title = !string.IsNullOrEmpty(info.ComicInfo.Title) ? info.ComicInfo.Title : info.Title; } // Patch is SeriesSort from ComicInfo