Files
jellycon/resources/lib/datamanager.py
Shaun 2e9c230314 remove a bunch of string encode calls, they ar enot needed and were there to fix logging
fix the logging to convery any unicode to a utf-8 string on the fly
2018-01-02 11:52:56 +11:00

29 lines
684 B
Python

# Gnu General Public License - see LICENSE.TXT
import json
from collections import defaultdict
from downloadutils import DownloadUtils
from simple_logging import SimpleLogging
log = SimpleLogging(__name__)
class DataManager():
cacheDataResult = None
dataUrl = None
cacheDataPath = None
canRefreshNow = False
def __init__(self, *args):
log.debug("DataManager __init__")
def loadJasonData(self, jsonData):
return json.loads(jsonData, object_hook=lambda d: defaultdict(lambda: None, d))
def GetContent(self, url):
jsonData = DownloadUtils().downloadUrl(url)
result = self.loadJasonData(jsonData)
return result