Skip to content

Commit

Permalink
fix(streaming_service): add iT keyword support for iTunes (#669)
Browse files Browse the repository at this point in the history
  • Loading branch information
Toilal committed Feb 3, 2021
1 parent c635022 commit 51e0021
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion guessit/config/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,10 @@
"Hulu": "HULU",
"Investigation Discovery": "ID",
"IFC": "IFC",
"iTunes": "iTunes",
"iTunes": [
"iTunes",
{"pattern": "iT", "ignore_case": false}
],
"ITV": "ITV",
"Knowledge Network": "KNOW",
"Lifetime": "LIFE",
Expand Down
13 changes: 10 additions & 3 deletions guessit/rules/properties/streaming_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,17 @@ def streaming_service(config): # pylint: disable=too-many-statements,unused-arg
for value, items in config.items():
patterns = items if isinstance(items, list) else [items]
for pattern in patterns:
if pattern.startswith(regex_prefix):
rebulk.regex(pattern[len(regex_prefix):], value=value)
if isinstance(pattern, dict):
pattern_value = pattern.pop('pattern')
kwargs = pattern
pattern = pattern_value
else:
rebulk.string(pattern, value=value)
kwargs = {}
regex = kwargs.pop('regex', False)
if regex or pattern.startswith(regex_prefix):
rebulk.regex(pattern[len(regex_prefix):], value=value, **kwargs)
else:
rebulk.string(pattern, value=value, **kwargs)

rebulk.rules(ValidateStreamingService)

Expand Down
1 change: 1 addition & 0 deletions guessit/test/streaming_services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@
release_group: CasStudio
type: episode

? Suits.S07E01.1080p.iT.WEB-DL.DD5.1.H.264-VLAD.mkv
? Suits.S07E01.1080p.iTunes.WEB-DL.DD5.1.H.264-VLAD.mkv
: title: Suits
season: 7
Expand Down

0 comments on commit 51e0021

Please sign in to comment.