Guides icon indicating copy to clipboard operation
Guides copied to clipboard

feat(starr): expand dual audio regex

Open adapowers opened this issue 1 year ago • 6 comments

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 pattern
  • DUAL-VARYG matches literally
  • (?i) turns case-insensitivity back on for the rest of the pattern

dual[ ._-]?(\d{3,4}p|ultrahd|4k)

  • dual[ ._-] matches dual (case insensitive) plus common separator characters
  • \d{3,4}p|ultrahd|4k matches any 3-4 digits followed by p (1080p, 720p, etc.) or 4K or UltraHD

(\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 dual is 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

adapowers avatar Jun 17 '24 01:06 adapowers