Auto Collection Bugfixes (#1769)
* SeriesGroup tag can now have comma separated value to allow a series to be a part of multiple collections. * Added a missing unit test * Refactored how collection tags are created to work in the scan loop reliably. * Added a unit test for RemoveTagsWithoutSeries * Fixed a bug in reading list title generation to avoid Volume 0 if the underlying file had a title set. Fixed a misconfigured unit test.
This commit is contained in:
parent
e86694ea9a
commit
a76770b240
13 changed files with 234 additions and 106 deletions
|
|
@ -1,49 +0,0 @@
|
|||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using API.DTOs.ReadingLists;
|
||||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Services;
|
||||
|
||||
namespace API.Helpers;
|
||||
|
||||
public static class ReadingListHelper
|
||||
{
|
||||
private static readonly Regex JustNumbers = new Regex(@"^\d+$", RegexOptions.Compiled | RegexOptions.IgnoreCase,
|
||||
Services.Tasks.Scanner.Parser.Parser.RegexTimeout);
|
||||
public static string FormatTitle(ReadingListItemDto item)
|
||||
{
|
||||
var title = string.Empty;
|
||||
if (item.ChapterNumber == Services.Tasks.Scanner.Parser.Parser.DefaultChapter) {
|
||||
title = $"Volume {item.VolumeNumber}";
|
||||
}
|
||||
|
||||
if (item.SeriesFormat == MangaFormat.Epub) {
|
||||
var specialTitle = Services.Tasks.Scanner.Parser.Parser.CleanSpecialTitle(item.ChapterNumber);
|
||||
if (specialTitle == Services.Tasks.Scanner.Parser.Parser.DefaultChapter)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.ChapterTitleName))
|
||||
{
|
||||
title = item.ChapterTitleName;
|
||||
}
|
||||
else
|
||||
{
|
||||
title = $"Volume {Services.Tasks.Scanner.Parser.Parser.CleanSpecialTitle(item.VolumeNumber)}";
|
||||
}
|
||||
} else {
|
||||
title = $"Volume {specialTitle}";
|
||||
}
|
||||
}
|
||||
|
||||
var chapterNum = item.ChapterNumber;
|
||||
if (!string.IsNullOrEmpty(chapterNum) && !JustNumbers.Match(item.ChapterNumber).Success) {
|
||||
chapterNum = Services.Tasks.Scanner.Parser.Parser.CleanSpecialTitle(item.ChapterNumber);
|
||||
}
|
||||
|
||||
if (title == string.Empty) {
|
||||
title = ReaderService.FormatChapterName(item.LibraryType, true, true) + chapterNum;
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue