Fixed an issue where the Parse method was using filename with extension to run regex matching, while it should be running on name without extension.
This commit is contained in:
parent
9e71d5461d
commit
27a7f19446
1 changed files with 8 additions and 7 deletions
|
|
@ -555,7 +555,7 @@ namespace API.Parser
|
||||||
/// <returns><see cref="ParserInfo"/> or null if Series was empty</returns>
|
/// <returns><see cref="ParserInfo"/> or null if Series was empty</returns>
|
||||||
public static ParserInfo Parse(string filePath, string rootPath, LibraryType type = LibraryType.Manga)
|
public static ParserInfo Parse(string filePath, string rootPath, LibraryType type = LibraryType.Manga)
|
||||||
{
|
{
|
||||||
var fileName = Path.GetFileName(filePath);
|
var fileName = Path.GetFileNameWithoutExtension(filePath);
|
||||||
ParserInfo ret;
|
ParserInfo ret;
|
||||||
|
|
||||||
if (IsEpub(filePath))
|
if (IsEpub(filePath))
|
||||||
|
|
@ -565,7 +565,7 @@ namespace API.Parser
|
||||||
Chapters = ParseChapter(fileName) ?? ParseComicChapter(fileName),
|
Chapters = ParseChapter(fileName) ?? ParseComicChapter(fileName),
|
||||||
Series = ParseSeries(fileName) ?? ParseComicSeries(fileName),
|
Series = ParseSeries(fileName) ?? ParseComicSeries(fileName),
|
||||||
Volumes = ParseVolume(fileName) ?? ParseComicVolume(fileName),
|
Volumes = ParseVolume(fileName) ?? ParseComicVolume(fileName),
|
||||||
Filename = fileName,
|
Filename = Path.GetFileName(filePath),
|
||||||
Format = ParseFormat(filePath),
|
Format = ParseFormat(filePath),
|
||||||
FullFilePath = filePath
|
FullFilePath = filePath
|
||||||
};
|
};
|
||||||
|
|
@ -577,14 +577,14 @@ namespace API.Parser
|
||||||
Chapters = type == LibraryType.Manga ? ParseChapter(fileName) : ParseComicChapter(fileName),
|
Chapters = type == LibraryType.Manga ? ParseChapter(fileName) : ParseComicChapter(fileName),
|
||||||
Series = type == LibraryType.Manga ? ParseSeries(fileName) : ParseComicSeries(fileName),
|
Series = type == LibraryType.Manga ? ParseSeries(fileName) : ParseComicSeries(fileName),
|
||||||
Volumes = type == LibraryType.Manga ? ParseVolume(fileName) : ParseComicVolume(fileName),
|
Volumes = type == LibraryType.Manga ? ParseVolume(fileName) : ParseComicVolume(fileName),
|
||||||
Filename = fileName,
|
Filename = Path.GetFileName(filePath),
|
||||||
Format = ParseFormat(filePath),
|
Format = ParseFormat(filePath),
|
||||||
Title = Path.GetFileNameWithoutExtension(fileName),
|
Title = Path.GetFileNameWithoutExtension(fileName),
|
||||||
FullFilePath = filePath
|
FullFilePath = filePath
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsImage(filePath) && IsCoverImage(fileName)) return null;
|
if (IsImage(filePath) && IsCoverImage(filePath)) return null;
|
||||||
|
|
||||||
if (IsImage(filePath))
|
if (IsImage(filePath))
|
||||||
{
|
{
|
||||||
|
|
@ -632,7 +632,7 @@ namespace API.Parser
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pdfs may have .pdf in the series name, remove that
|
// Pdfs may have .pdf in the series name, remove that
|
||||||
if (IsPdf(fileName) && ret.Series.ToLower().EndsWith(".pdf"))
|
if (IsPdf(filePath) && ret.Series.ToLower().EndsWith(".pdf"))
|
||||||
{
|
{
|
||||||
ret.Series = ret.Series.Substring(0, ret.Series.Length - ".pdf".Length);
|
ret.Series = ret.Series.Substring(0, ret.Series.Length - ".pdf".Length);
|
||||||
}
|
}
|
||||||
|
|
@ -915,11 +915,12 @@ namespace API.Parser
|
||||||
{
|
{
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
title = title.Replace(match.Value, "").Trim();
|
title = title.Replace(match.Value, string.Empty).Trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Since we have loops like this, think about using a method
|
||||||
foreach (var regex in MangaEditionRegex)
|
foreach (var regex in MangaEditionRegex)
|
||||||
{
|
{
|
||||||
var matches = regex.Matches(title);
|
var matches = regex.Matches(title);
|
||||||
|
|
@ -927,7 +928,7 @@ namespace API.Parser
|
||||||
{
|
{
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
title = title.Replace(match.Value, "").Trim();
|
title = title.Replace(match.Value, string.Empty).Trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue