Conditionally remove special tags during parse

This commit is contained in:
Joseph Milazzo 2021-10-04 17:59:33 -05:00
parent 4a9c3ef1f8
commit 0b1888433d

View file

@ -603,7 +603,7 @@ namespace API.Parser
var edition = ParseEdition(fileName); var edition = ParseEdition(fileName);
if (!string.IsNullOrEmpty(edition)) if (!string.IsNullOrEmpty(edition))
{ {
ret.Series = CleanTitle(ret.Series.Replace(edition, "")); ret.Series = CleanTitle(ret.Series.Replace(edition, ""), type == LibraryType.Comic);
ret.Edition = edition; ret.Edition = edition;
} }
@ -628,7 +628,7 @@ namespace API.Parser
if (string.IsNullOrEmpty(ret.Series)) if (string.IsNullOrEmpty(ret.Series))
{ {
ret.Series = CleanTitle(fileName); ret.Series = CleanTitle(fileName, type == LibraryType.Comic);
} }
// Pdfs may have .pdf in the series name, remove that // Pdfs may have .pdf in the series name, remove that
@ -676,7 +676,7 @@ namespace API.Parser
if ((string.IsNullOrEmpty(series) && i == fallbackFolders.Count - 1)) if ((string.IsNullOrEmpty(series) && i == fallbackFolders.Count - 1))
{ {
ret.Series = CleanTitle(folder); ret.Series = CleanTitle(folder, type == LibraryType.Comic);
break; break;
} }
@ -795,7 +795,7 @@ namespace API.Parser
{ {
if (match.Groups["Series"].Success && match.Groups["Series"].Value != string.Empty) if (match.Groups["Series"].Success && match.Groups["Series"].Value != string.Empty)
{ {
return CleanTitle(match.Groups["Series"].Value); return CleanTitle(match.Groups["Series"].Value, true);
} }
} }
} }
@ -979,16 +979,16 @@ namespace API.Parser
/// </example> /// </example>
/// </summary> /// </summary>
/// <param name="title"></param> /// <param name="title"></param>
/// <param name="isComic"></param>
/// <returns></returns> /// <returns></returns>
public static string CleanTitle(string title) public static string CleanTitle(string title, bool isComic = false)
{ {
title = RemoveReleaseGroup(title); title = RemoveReleaseGroup(title);
title = RemoveEditionTagHolders(title); title = RemoveEditionTagHolders(title);
title = RemoveMangaSpecialTags(title); title = isComic ? RemoveComicSpecialTags(title) : RemoveMangaSpecialTags(title);
title = RemoveComicSpecialTags(title);
title = title.Replace("_", " ").Trim(); title = title.Replace("_", " ").Trim();
if (title.EndsWith("-") || title.EndsWith(",")) if (title.EndsWith("-") || title.EndsWith(","))