mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2024-11-14 17:40:24 -08:00
23 lines
518 B
Python
23 lines
518 B
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
JSON Utils
|
|
"""
|
|
import json
|
|
|
|
from six import text_type
|
|
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):
|
|
return o.advanced
|
|
if hasattr(o, 'name'): # Babelfish languages/countries long name
|
|
return text_type(o.name)
|
|
# pragma: no cover
|
|
return text_type(o)
|