Fixed a bug where files tagged as specials (ComicInfo) were not propagating the title field to the UI.
This commit is contained in:
parent
4d435865a8
commit
2c9ad049ad
6 changed files with 39 additions and 4 deletions
|
@ -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<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
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[
|
||||
"test/just a bunch of junk.cbz"
|
||||
]
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -39,9 +39,7 @@ public class ChapterBuilder : IEntityBuilder<Chapter>
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1412,6 +1412,8 @@ public class ExternalMetadataService : IExternalMetadataService
|
|||
}
|
||||
|
||||
await DownloadSeriesCovers(series, externalMetadata.CoverUrl);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue