Guides
Guides copied to clipboard
feat(starr): expand dual audio regex
Pull Request
Purpose
Two common conventions for indicating dual audio releases are not currently captured by the regex:
- The release group VARYG appends it directly to their name:
DUAL-VARYG - Other release groups will use
DUAL {Resolution}or{Resolution} DUAL
I attempted to add a pattern which was flexible, while having a low risk of false positives.
Approach
The following patterns have been added into the regex:
(?-i)DUAL-VARYG(?i)
(?-i)disables case-insensitivity for the rest of the patternDUAL-VARYGmatches literally(?i)turns case-insensitivity back on for the rest of the pattern
dual[ ._-]?(\d{3,4}p|ultrahd|4k)
dual[ ._-]matchesdual(case insensitive) plus common separator characters\d{3,4}p|ultrahd|4kmatches any 3-4 digits followed byp(1080p,720p, etc.) or4KorUltraHD
(\d{3,4}p|ultrahd|4k)[ ._-]?dual
- Same match as above, but in reverse order:
1080p.DUAL,4K UltraHD DUAL, etc.
Notes:
- I did not choose to mess with case sensitivity lightly; as
dualis a dictionary word, we want to prevent matching on any uppercase, hyphen-delimited filename that contains it. This is the same reason I chose to encode the release group directly. Without both, there could be too many false positives. - In general, this approach attempts to leverage the fact that DUAL (as a single word indicating dual audio) is often placed directly before or after the video resolution.
Regex
https://regex101.com/r/p1Rt67/6
Open Questions and Pre-Merge TODOs
Requirements
- [x] These changes meet the standards for contributing.
- [x] I have read the code of conduct.