mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-16 02:02:53 -07:00
updated libs to fix guessit and subliminal. Fixes #1080
This commit is contained in:
parent
319d418af8
commit
0625f7f3c0
263 changed files with 28711 additions and 12615 deletions
51
libs/guessit/rules/common/validators.py
Normal file
51
libs/guessit/rules/common/validators.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Validators
|
||||
"""
|
||||
from functools import partial
|
||||
|
||||
from rebulk.validators import chars_before, chars_after, chars_surround
|
||||
from . import seps
|
||||
|
||||
seps_before = partial(chars_before, seps)
|
||||
seps_after = partial(chars_after, seps)
|
||||
seps_surround = partial(chars_surround, seps)
|
||||
|
||||
|
||||
def int_coercable(string):
|
||||
"""
|
||||
Check if string can be coerced to int
|
||||
:param string:
|
||||
:type string:
|
||||
:return:
|
||||
:rtype:
|
||||
"""
|
||||
try:
|
||||
int(string)
|
||||
return True
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
def compose(*validators):
|
||||
"""
|
||||
Compose validators functions
|
||||
:param validators:
|
||||
:type validators:
|
||||
:return:
|
||||
:rtype:
|
||||
"""
|
||||
def composed(string):
|
||||
"""
|
||||
Composed validators function
|
||||
:param string:
|
||||
:type string:
|
||||
:return:
|
||||
:rtype:
|
||||
"""
|
||||
for validator in validators:
|
||||
if not validator(string):
|
||||
return False
|
||||
return True
|
||||
return composed
|
Loading…
Add table
Add a link
Reference in a new issue