Fixed a bug where files tagged as specials (ComicInfo) were not propagating the title field to the UI.

This commit is contained in:
Joseph Milazzo 2025-06-27 11:35:09 -05:00
parent 4d435865a8
commit 2c9ad049ad
6 changed files with 39 additions and 4 deletions

View file

@ -972,4 +972,35 @@ public class ScannerServiceTests : AbstractDbTest
Assert.Contains(postLib.Series, x => x.Name == "Immoral Guild"); Assert.Contains(postLib.Series, x => x.Name == "Immoral Guild");
Assert.Contains(postLib.Series, x => x.Name == "Futoku No 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<string, ComicInfo>();
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
} }

View file

@ -0,0 +1,3 @@
[
"test/just a bunch of junk.cbz"
]

View file

@ -188,7 +188,7 @@ public class Chapter : IEntityDate, IHasReadTimeEstimate, IHasCoverImage
MinNumber = Parser.DefaultChapterNumber; MinNumber = Parser.DefaultChapterNumber;
MaxNumber = Parser.DefaultChapterNumber; MaxNumber = Parser.DefaultChapterNumber;
} }
Title = (IsSpecial && info.Format is MangaFormat.Epub or MangaFormat.Pdf) Title = IsSpecial
? info.Title ? info.Title
: Parser.RemoveExtensionIfSupported(Range); : Parser.RemoveExtensionIfSupported(Range);

View file

@ -39,9 +39,7 @@ public class ChapterBuilder : IEntityBuilder<Chapter>
return builder.WithNumber(Parser.RemoveExtensionIfSupported(info.Chapters)!) return builder.WithNumber(Parser.RemoveExtensionIfSupported(info.Chapters)!)
.WithRange(specialTreatment ? info.Filename : info.Chapters) .WithRange(specialTreatment ? info.Filename : info.Chapters)
.WithTitle(specialTreatment && info.Format is MangaFormat.Epub or MangaFormat.Pdf .WithTitle(info.Title ?? string.Empty) // NOTE: This originally had duplicate logic. I moved it further up int the pipeline.
? info.Title
: specialTitle ?? string.Empty)
.WithIsSpecial(specialTreatment); .WithIsSpecial(specialTreatment);
} }

View file

@ -1412,6 +1412,8 @@ public class ExternalMetadataService : IExternalMetadataService
} }
await DownloadSeriesCovers(series, externalMetadata.CoverUrl); await DownloadSeriesCovers(series, externalMetadata.CoverUrl);
return true; return true;
} }

View file

@ -128,6 +128,7 @@ public abstract class DefaultParser(IDirectoryService directoryService) : IDefau
info.IsSpecial = true; info.IsSpecial = true;
info.Chapters = Parser.DefaultChapter; info.Chapters = Parser.DefaultChapter;
info.Volumes = Parser.SpecialVolume; info.Volumes = Parser.SpecialVolume;
info.Title = !string.IsNullOrEmpty(info.ComicInfo.Title) ? info.ComicInfo.Title : info.Title;
} }
// Patch is SeriesSort from ComicInfo // Patch is SeriesSort from ComicInfo