mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-15 01:32: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
32
libs/guessit/jsonutils.py
Normal file
32
libs/guessit/jsonutils.py
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue