Fix comic xml reader for US comics

Based on the information provided by the Anansi Project, US comics do
use the field "AlternateSeries" to specify an alternate series when the
comic contains cross-over story-arcs. However, software like ComicTagger
use the same field to provide the original title of the manga.
This commit is contained in:
Patrick Farwick 2022-11-24 15:11:25 +00:00
parent 72e7511039
commit 2772667bf8
2 changed files with 30 additions and 1 deletions

View File

@ -21,7 +21,31 @@ namespace Jellyfin.Plugin.Bookshelf.Providers.ComicInfo
var hasFoundMetadata = false;
hasFoundMetadata |= ReadStringInto(xml, "ComicInfo/Title", title => book.Name = title);
hasFoundMetadata |= ReadStringInto(xml, "ComicInfo/AlternateSeries", title => book.OriginalTitle = title);
// this value is used internally only, as Jellyfin has no field to save it to
var isManga = false;
hasFoundMetadata |= ReadStringInto(xml, "ComicInfo/Title", title => book.Name = title);
hasFoundMetadata |= ReadStringInto(xml, "ComicInfo/Manga", manga =>
{
if (manga.Equals("Yes", StringComparison.OrdinalIgnoreCase))
{
isManga = true;
}
});
hasFoundMetadata |= ReadStringInto(xml, "ComicInfo/AlternateSeries", title =>
{
if (isManga)
{
// Software like ComicTagger (https://github.com/comictagger/comictagger) uses
// this field for the original language name when tagging manga
book.OriginalTitle = title;
}
else
{
// Based on the The Anansi Project, some US comics can be part of cross-over
// story arcs. This field is then used to specify an alternate series
}
});
hasFoundMetadata |= ReadStringInto(xml, "ComicInfo/Series", series => book.SeriesName = series);
hasFoundMetadata |= ReadIntInto(xml, "ComicInfo/Number", issue => book.IndexNumber = issue);
hasFoundMetadata |= ReadStringInto(xml, "ComicInfo/Summary", summary => book.Overview = summary);

View File

@ -32,6 +32,11 @@ public class ComicInfoXmlUtilitiesTest
[Fact]
public void ReadAlternativeSeries_Success()
{
// Based on the The Anansi Project, some US comics can be part of cross-over
// story arcs. This field is used to specify an alternate series
// https://anansi-project.github.io/docs/comicinfo/documentation#alternateseries--alternatenumber--alternatecount
// However, software like ComicTagger (https://github.com/comictagger/comictagger) uses
// this field for the original language name when tagging manga
var actual = _uut.ReadComicBookMetadata(_document);
Assert.NotNull(actual);
Assert.Equal("進撃の巨人", actual!.OriginalTitle);