Correctly parse volume and chapter when at start of filename #273
+3
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This adjusts
volumeRegexesandchapterRegexesto find matches that start at the beginning of a filename. These changes allow for proper reordering of volumes before chapters (and, where possible, locking in chapters) in cases where a Mihon derivative has stripped the series title from the filename.Problem
Suwayomi-Server (one of many Mihon derivatives) automatically strips the series title from the filename when downloading, but ONLY IF it's an exact match. (I believe it matches using the
<Series>inComicInfo.xml.)Komf's current regexes do not recognize volumes in the modified filenames, which prevents them from being reordered before chapters in Komga.
This behavior apparently comes from Mihon (or earlier), and the likelihood of the upstream project changing it appears to be very low. Thus, the attempt to accommodate it in Komf.
Changes
Volume: Replaces
,?\swith(?:^|,?\s)(matches line start OR optional comma and required whitespace)Chapter: Factors out whitespace from
(\sc|\s?ch\.\s|\s?chapter\s|\s?ep\.\s)and replaces with(?:^|\s?)(c|ch\.\s|chapter\s|ep\.\s)(matches line start OR optional whitespace; makes leading whitespace optional for all chapter conventions).Impact
c. (I could not find any such titles.)Testing
Other notes
Despite the examples I gave, I did not change anything that would allow Komf to recognize manga chapters in the format
###—whether after a title or not—as the risk of false positives is too high. However, Komga parses leading numbers itself just fine, so IMO only volume handling is essential.If the changes to chapter regexes are controversial, I'm happy to back off of them, but would strongly prefer allowing the modified volume regex regardless. :)