rimesso guessit con le modifiche per gli import

This commit is contained in:
marco
2020-05-03 15:51:27 +02:00
parent 99c9f5f134
commit 8cd92ee71f
139 changed files with 37742 additions and 9 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/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)