Correctly parse volume and chapter when at start of filename#273
Correctly parse volume and chapter when at start of filename#273spin-drift wants to merge 1 commit intoSnd-R:masterfrom
Conversation
… filename This accommodates a long-standing behavior in Mihon derivatives that strips series from filename under certain conditions.
|
this seems to work pretty well from my testing, it still gets tripped up over things like volume 8 extras but it's a lot more accurate at getting chapter numbers in general. I should also add that C001 and such makes komf also order what some rippers use in their file naming for their releases. |
|
further testing, it doesn't look like it's grabbing Cxx correctly. |
For testing's sake, can you give me some example filenames that aren't being matched correctly? I think my regex should match what you gave me, so I think it's probably coming down to the specifics. |
Ditto with volume 8 extras—any examples? |
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. :)