mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
Update guessit to 3.0.3
Also updates: - babelfish-0.5.5 - python-dateutil-2.7.5 - rebulk-1.0.0 - six-1.12.0
This commit is contained in:
parent
05b0fb498f
commit
2eb9d9dc7c
120 changed files with 17964 additions and 4530 deletions
|
@ -4,14 +4,10 @@
|
|||
JSON Utils
|
||||
"""
|
||||
import json
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
except ImportError: # pragma: no-cover
|
||||
from ordereddict import OrderedDict # pylint:disable=import-error
|
||||
|
||||
from six import text_type
|
||||
from rebulk.match import Match
|
||||
|
||||
|
||||
class GuessitEncoder(json.JSONEncoder):
|
||||
"""
|
||||
JSON Encoder for guessit response
|
||||
|
@ -19,14 +15,8 @@ class GuessitEncoder(json.JSONEncoder):
|
|||
|
||||
def default(self, o): # pylint:disable=method-hidden
|
||||
if isinstance(o, Match):
|
||||
ret = OrderedDict()
|
||||
ret['value'] = o.value
|
||||
if o.raw:
|
||||
ret['raw'] = o.raw
|
||||
ret['start'] = o.start
|
||||
ret['end'] = o.end
|
||||
return ret
|
||||
elif hasattr(o, 'name'): # Babelfish languages/countries long name
|
||||
return str(o.name)
|
||||
else: # pragma: no cover
|
||||
return str(o)
|
||||
return o.advanced
|
||||
if hasattr(o, 'name'): # Babelfish languages/countries long name
|
||||
return text_type(o.name)
|
||||
# pragma: no cover
|
||||
return text_type(o)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue