updated libs to fix guessit and subliminal. Fixes #1080

This commit is contained in:
clinton-hall 2016-09-21 13:31:41 +09:30
parent 319d418af8
commit 0625f7f3c0
263 changed files with 28711 additions and 12615 deletions

32
libs/guessit/jsonutils.py Normal file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
JSON Utils
"""
import json
try:
from collections import OrderedDict
except ImportError: # pragma: no-cover
from ordereddict import OrderedDict # pylint:disable=import-error
from rebulk.match import Match
class GuessitEncoder(json.JSONEncoder):
"""
JSON Encoder for guessit response
"""
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)