# Path: lib/libs/addonsettings.py
# DEFAULT_IMAGESIZE = '1'
# AVAILABLE_IMAGESIZES = {'0': (10000, 10000, 600), '1': (1920, 1080, 600), '2': (1280, 720, 480)}
# PROGRESS_DISPLAY_FULLPROGRESS = '0'
# PROGRESS_DISPLAY_WARNINGSERRORS = '1'
# PROGRESS_DISPLAY_NONE = '2' # Only add-on crashes
# EXCLUSION_PATH_TYPE_FOLDER = '0'
# EXCLUSION_PATH_TYPE_PREFIX = '1'
# EXCLUSION_PATH_TYPE_REGEX = '2'
# class Settings(object):
#     def __init__(self):
#     def update_useragent(self):
#     def update_settings(self):
#     def get_apikey(self, provider):
#     def get_apienabled(self, provider):
#     def get_api_config(self, provider):
#     def autoadd_episodes(self):
#     def autoadd_episodes(self, value):
# def get_projectkey(provider):


import sqlite3
import xbmc
import xbmcvfs
from lib.libs.addonsettings import settings
    def get_data(self, mediaid, mediatype, medialabel):
        result = self.db.fetchone("""SELECT * FROM processeditems WHERE mediaid=? AND mediatype=?
            AND (medialabel=? or medialabel IS NULL)""", (mediaid, mediatype, medialabel))
        if result:
            return result['data']

    def set_data(self, mediaid, mediatype, medialabel, data):
        exists = self._key_exists(mediaid, mediatype)
        script = "UPDATE processeditems SET data=?, medialabel=? WHERE mediaid=? AND mediatype=?" if exists \
            else "INSERT INTO processeditems (data, medialabel, mediaid, mediatype) VALUES (?, ?, ?, ?)"
        self.db.execute(script, (data, medialabel, mediaid, mediatype))

    def exists(self, mediaid, mediatype, medialabel):
        return bool(self.db.fetchone("""SELECT * FROM processeditems WHERE mediaid=? AND mediatype=?
            AND (medialabel=? or medialabel IS NULL)""", (mediaid, mediatype, medialabel)))

    def does_not_exist(self, mediaid, mediatype, medialabel):
        return not self.exists(mediaid, mediatype, medialabel)

    def _key_exists(self, mediaid, mediatype):
        return bool(self.db.fetchone("SELECT * FROM processeditems WHERE mediaid=? AND mediatype=?",
            (mediaid, mediatype)))

def upgrade_processeditems(db, fromversion):
    if fromversion == VERSION:
        return VERSION

    if fromversion == -1:
        # new install, build the database fresh
        db.execute("""CREATE TABLE processeditems (mediaid INTEGER NOT NULL, mediatype TEXT NOT NULL,

# Path: lib/libs/addonsettings.py
# DEFAULT_IMAGESIZE = '1'
# AVAILABLE_IMAGESIZES = {'0': (10000, 10000, 600), '1': (1920, 1080, 600), '2': (1280, 720, 480)}
# PROGRESS_DISPLAY_FULLPROGRESS = '0'
# PROGRESS_DISPLAY_WARNINGSERRORS = '1'
# PROGRESS_DISPLAY_NONE = '2' # Only add-on crashes
# EXCLUSION_PATH_TYPE_FOLDER = '0'
# EXCLUSION_PATH_TYPE_PREFIX = '1'
# EXCLUSION_PATH_TYPE_REGEX = '2'
# class Settings(object):
#     def __init__(self):
#     def update_useragent(self):
#     def update_settings(self):
#     def get_apikey(self, provider):
#     def get_apienabled(self, provider):
#     def get_api_config(self, provider):
#     def autoadd_episodes(self):
#     def autoadd_episodes(self, value):
# def get_projectkey(provider):


# Path: lib/libs/processeditems.py
import sqlite3
import xbmc
import xbmcvfs
from lib.libs.addonsettings import settings

    def get_data(self, mediaid, mediatype, medialabel):
        result = self.db.fetchone("""SELECT * FROM processeditems WHERE mediaid=? AND mediatype=?
            AND (medialabel=? or medialabel IS NULL)""", (mediaid, mediatype, medialabel))
        if result:
            return result['data']

    def set_data(self, mediaid, mediatype, medialabel, data):
        exists = self._key_exists(mediaid, mediatype)
        script = "UPDATE processeditems SET data=?, medialabel=? WHERE mediaid=? AND mediatype=?" if exists \
            else "INSERT INTO processeditems (data, medialabel, mediaid, mediatype) VALUES (?, ?, ?, ?)"
        self.db.execute(script, (data, medialabel, mediaid, mediatype))

    def exists(self, mediaid, mediatype, medialabel):
        return bool(self.db.fetchone("""SELECT * FROM processeditems WHERE mediaid=? AND mediatype=?
            AND (medialabel=? or medialabel IS NULL)""", (mediaid, mediatype, medialabel)))

    def does_not_exist(self, mediaid, mediatype, medialabel):
        return not self.exists(mediaid, mediatype, medialabel)

    def _key_exists(self, mediaid, mediatype):
        return bool(self.db.fetchone("SELECT * FROM processeditems WHERE mediaid=? AND mediatype=?",
            (mediaid, mediatype)))

def upgrade_processeditems(db, fromversion):
    if fromversion == VERSION:
        return VERSION

    if fromversion == -1:
        # new install, build the database fresh
        db.execute("""CREATE TABLE processeditems (mediaid INTEGER NOT NULL, mediatype TEXT NOT NULL,

            medialabel TEXT, nextdate DATETIME, data TEXT, PRIMARY KEY (mediaid, mediatype))""")