Metadata Bugfixes (#1511)

* Fix XML deserialization of empty elements to integers

* Fix assumption that environment uses US time format

* Use series name as SeriesSort in epub

* Address some PR comments

* Add partial Equals(0 implementation to ComicInfo

* Update ComicInfo unittest. Revert previous version
This commit is contained in:
tjarls 2022-09-14 14:03:20 +01:00 committed by GitHub
parent 0a6e64d767
commit a1c3f43656
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 22 deletions

View file

@ -23,6 +23,7 @@ public class ComicInfo
/// <summary>
/// The total number of items in the series.
/// </summary>
[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
/// </summary>
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;

View file

@ -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;
}
}

View file

@ -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);