# Path: resources/lib/storageengine/storage.py
# class TimedStorage(_Storage):
#     """A dict with the ability to persist to disk and TTL for items."""
# 
#     def dump(self, fileobj):
#         super(TimedStorage, self).dump(fileobj)
# 
#     def __init__(self, filename, file_format='pickle', TTL=None):
#         """TTL if provided should be a datetime.timedelta. Any entries
#         older than the provided TTL will be removed upon load and upon item
#         access.
#         """
#         self.TTL = TTL
#         _Storage.__init__(self, filename, file_format=file_format)
# 
#     def __setitem__(self, key, val, raw=False):
#         if raw:
#             self._items[key] = val
#         else:
#             self._items[key] = (val, time.time())
# 
#     def __getitem__(self, key):
#         val, timestamp = self._items[key]
#         if self.TTL and (datetime.utcnow() -
#                              datetime.utcfromtimestamp(timestamp) > self.TTL):
#             del self._items[key]
#             return self._items[key][0]  # Will raise KeyError
#         return val
# 
#     def initial_update(self, mapping):
#         '''Initially fills the underlying dictionary with keys, values and
#         timestamps.
#         '''
#         for key, val in mapping.items():
#             _, timestamp = val
#             if not self.TTL or (datetime.utcnow() -
#                                     datetime.utcfromtimestamp(timestamp) < self.TTL):
#                 self.__setitem__(key, val, raw=True)


import json
import os
import stat
import re
import xbmc
import xbmcaddon
import xbmcgui
from datetime import timedelta
from xml.etree.ElementTree import ElementTree
from resources.lib.storageengine.storage import TimedStorage





STRINGS = {
    'name':                30000,
    'addon_settings':      30100,
    'full_refresh':        30101,
    'choose_ctrl_type':    30200,
    'enter_filename':      30201,
    'starting_mapping':    30202,
    'mapping_success':     30203,
    'set_mapping_active':  30204,
    'mapping_failure':     30205,
    'pair_failure_paired': 30206,
    'configure_first':     30207,
    'reset_cache_warning': 30208,
    'empty_game_list':     30209,
    'update_available':    30210,
    'no_update_available': 30211,
    'scraper_failed':      30212,
}


class Core:
    regexp = '(\d+\.)?(\d+\.)?(\*|\d+)'


# Path: resources/lib/storageengine/storage.py
# class TimedStorage(_Storage):
#     """A dict with the ability to persist to disk and TTL for items."""
# 
#     def dump(self, fileobj):
#         super(TimedStorage, self).dump(fileobj)
# 
#     def __init__(self, filename, file_format='pickle', TTL=None):
#         """TTL if provided should be a datetime.timedelta. Any entries
#         older than the provided TTL will be removed upon load and upon item
#         access.
#         """
#         self.TTL = TTL
#         _Storage.__init__(self, filename, file_format=file_format)
# 
#     def __setitem__(self, key, val, raw=False):
#         if raw:
#             self._items[key] = val
#         else:
#             self._items[key] = (val, time.time())
# 
#     def __getitem__(self, key):
#         val, timestamp = self._items[key]
#         if self.TTL and (datetime.utcnow() -
#                              datetime.utcfromtimestamp(timestamp) > self.TTL):
#             del self._items[key]
#             return self._items[key][0]  # Will raise KeyError
#         return val
# 
#     def initial_update(self, mapping):
#         '''Initially fills the underlying dictionary with keys, values and
#         timestamps.
#         '''
#         for key, val in mapping.items():
#             _, timestamp = val
#             if not self.TTL or (datetime.utcnow() -
#                                     datetime.utcfromtimestamp(timestamp) < self.TTL):
#                 self.__setitem__(key, val, raw=True)


# Path: resources/lib/core/corefunctions.py
import json
import os
import stat
import re
import xbmc
import xbmcaddon
import xbmcgui
from datetime import timedelta
from xml.etree.ElementTree import ElementTree
from resources.lib.storageengine.storage import TimedStorage






STRINGS = {
    'name':                30000,
    'addon_settings':      30100,
    'full_refresh':        30101,
    'choose_ctrl_type':    30200,
    'enter_filename':      30201,
    'starting_mapping':    30202,
    'mapping_success':     30203,
    'set_mapping_active':  30204,
    'mapping_failure':     30205,
    'pair_failure_paired': 30206,
    'configure_first':     30207,
    'reset_cache_warning': 30208,
    'empty_game_list':     30209,
    'update_available':    30210,
    'no_update_available': 30211,
    'scraper_failed':      30212,
}


class Core:
    regexp = '(\d+\.)?(\d+\.)?(\*|\d+)'


    def __init__(self, logger):