# Path: lib/libs/mediatypes.py
# TVSHOW = 'tvshow'
# MOVIE = 'movie'
# EPISODE = 'episode'
# SEASON = 'season'
# MOVIESET = 'set'
# MUSICVIDEO = 'musicvideo'
# ARTIST = 'artist'
# ALBUM = 'album'
# SONG = 'song'
# PREFERRED_SOURCE_SHARED = {'0': None, '1': 'fanart.tv'}
# PREFERRED_SOURCE_MEDIA = {'tvshows': ('thetvdb.com', (TVSHOW, SEASON, EPISODE)),
#     'movies': ('themoviedb.org', (MOVIE, MOVIESET)),
#     'music': ('theaudiodb.com', audiotypes),
#     'musicvideos': ('theaudiodb.com', (MUSICVIDEO,))}
# def get_artinfo(mediatype, arttype):
# def hack_mediaarttype(mediatype, arttype):
# def disabled(mediatype):
# def iter_every_arttype(mediatype):
# def downloadartwork(mediatype, arttype):
# def downloadanyartwork(mediatype):
# def _split_arttype(arttype):
# def generatethumb(mediatype):
# def haspreferred_source(mediatype):
# def ispreferred_source(mediatype, provider):
# def only_filesystem(mediatype):
# def update_settings():
# def _get_autolimit_from_setting(settingid):
# def _set_allmulti(always_multi):
# 
# Path: lib/libs/pykodi.py
# ADDONID = 'script.artwork.beef'
# def get_main_addon():
# def is_addon_watched():
# def get_kodi_version():
# def localize(messageid):
# def get_conditional(conditional):
# def get_infolabel(infolabel):
# def execute_builtin(builtin_command):
# def datetime_now():
# def datetime_strptime(date_string, format_string):
# def execute_jsonrpc(jsonrpc_command):
# def log(message, level=xbmc.LOGDEBUG, tag=None):
# def scrub_message(message):
# def set_log_scrubstring(key, string):
# def get_language(language_format=xbmc.ENGLISH_NAME, region=False):
# def unquoteimage(imagestring):
# def quoteimage(imagestring):
# def unquotearchive(filepath):
# def get_command(*first_arg_keys):
# def get_busydialog():
#     def __init__(self, *args, **kwargs):
#     def get_setting(self, settingid):
#     def set_setting(self, settingid, value):
#     def __init__(self, *args, **kwargs):
#     def default(self, obj):
#     def __init__(self, *args, **kwargs):
#     def iterencode(self, obj, _one_shot=False):
#     def raw_decode(self, s, idx=0):
#     def _json_unicode_to_str(self, jsoninput):
#     def __init__(self):
#     def create(self):
#     def close(self):
#     def __del__(self):
# class Addon(xbmcaddon.Addon):
# class ObjectJSONEncoder(json.JSONEncoder):
# class UTF8PrettyJSONEncoder(ObjectJSONEncoder):
# class UTF8JSONDecoder(json.JSONDecoder):
# class DialogBusy(object):
# 
# Path: lib/libs/pykodi.py
# ADDONID = 'script.artwork.beef'
# def get_main_addon():
# def is_addon_watched():
# def get_kodi_version():
# def localize(messageid):
# def get_conditional(conditional):
# def get_infolabel(infolabel):
# def execute_builtin(builtin_command):
# def datetime_now():
# def datetime_strptime(date_string, format_string):
# def execute_jsonrpc(jsonrpc_command):
# def log(message, level=xbmc.LOGDEBUG, tag=None):
# def scrub_message(message):
# def set_log_scrubstring(key, string):
# def get_language(language_format=xbmc.ENGLISH_NAME, region=False):
# def unquoteimage(imagestring):
# def quoteimage(imagestring):
# def unquotearchive(filepath):
# def get_command(*first_arg_keys):
# def get_busydialog():
#     def __init__(self, *args, **kwargs):
#     def get_setting(self, settingid):
#     def set_setting(self, settingid, value):
#     def __init__(self, *args, **kwargs):
#     def default(self, obj):
#     def __init__(self, *args, **kwargs):
#     def iterencode(self, obj, _one_shot=False):
#     def raw_decode(self, s, idx=0):
#     def _json_unicode_to_str(self, jsoninput):
#     def __init__(self):
#     def create(self):
#     def close(self):
#     def __del__(self):
# class Addon(xbmcaddon.Addon):
# class ObjectJSONEncoder(json.JSONEncoder):
# class UTF8PrettyJSONEncoder(ObjectJSONEncoder):
# class UTF8JSONDecoder(json.JSONDecoder):
# class DialogBusy(object):


from itertools import chain
from lib.libs import mediatypes, pykodi
from lib.libs.pykodi import get_kodi_version, json, log


# [0] method part, [1] list: properties, [2] dict: extra params
typemap = {mediatypes.MOVIE: ('Movie', ['art', 'imdbnumber', 'file', 'premiered', 'uniqueid', 'setid'], None),
    mediatypes.MOVIESET: ('MovieSet', ['art'], {'movies': {'properties': ['art', 'file']}}),
    mediatypes.TVSHOW: ('TVShow', ['art', 'imdbnumber', 'season', 'file', 'premiered', 'uniqueid'], None),
    mediatypes.EPISODE: ('Episode', ['art', 'uniqueid', 'tvshowid', 'season', 'episode', 'file', 'showtitle'], None),
    mediatypes.SEASON: ('Season', ['season', 'art', 'tvshowid', 'showtitle'], None),
    mediatypes.MUSICVIDEO: ('MusicVideo', ['art', 'file', 'title', 'artist'], None),
    mediatypes.ARTIST: ('Artist', ['art', 'musicbrainzartistid'], None),
    mediatypes.ALBUM: ('Album', ['art', 'musicbrainzalbumid', 'musicbrainzreleasegroupid',
        'musicbrainzalbumartistid', 'artist', 'artistid', 'title'], None),
    mediatypes.SONG: ('Song', ['art', 'musicbrainztrackid', 'musicbrainzalbumartistid', 'album',
        'albumartist', 'albumartistid', 'albumid', 'file', 'disc', 'artist', 'title'], None)}

def _needupgrade(mediatype):

# Path: lib/libs/mediatypes.py
# TVSHOW = 'tvshow'
# MOVIE = 'movie'
# EPISODE = 'episode'
# SEASON = 'season'
# MOVIESET = 'set'
# MUSICVIDEO = 'musicvideo'
# ARTIST = 'artist'
# ALBUM = 'album'
# SONG = 'song'
# PREFERRED_SOURCE_SHARED = {'0': None, '1': 'fanart.tv'}
# PREFERRED_SOURCE_MEDIA = {'tvshows': ('thetvdb.com', (TVSHOW, SEASON, EPISODE)),
#     'movies': ('themoviedb.org', (MOVIE, MOVIESET)),
#     'music': ('theaudiodb.com', audiotypes),
#     'musicvideos': ('theaudiodb.com', (MUSICVIDEO,))}
# def get_artinfo(mediatype, arttype):
# def hack_mediaarttype(mediatype, arttype):
# def disabled(mediatype):
# def iter_every_arttype(mediatype):
# def downloadartwork(mediatype, arttype):
# def downloadanyartwork(mediatype):
# def _split_arttype(arttype):
# def generatethumb(mediatype):
# def haspreferred_source(mediatype):
# def ispreferred_source(mediatype, provider):
# def only_filesystem(mediatype):
# def update_settings():
# def _get_autolimit_from_setting(settingid):
# def _set_allmulti(always_multi):
# 
# Path: lib/libs/pykodi.py
# ADDONID = 'script.artwork.beef'
# def get_main_addon():
# def is_addon_watched():
# def get_kodi_version():
# def localize(messageid):
# def get_conditional(conditional):
# def get_infolabel(infolabel):
# def execute_builtin(builtin_command):
# def datetime_now():
# def datetime_strptime(date_string, format_string):
# def execute_jsonrpc(jsonrpc_command):
# def log(message, level=xbmc.LOGDEBUG, tag=None):
# def scrub_message(message):
# def set_log_scrubstring(key, string):
# def get_language(language_format=xbmc.ENGLISH_NAME, region=False):
# def unquoteimage(imagestring):
# def quoteimage(imagestring):
# def unquotearchive(filepath):
# def get_command(*first_arg_keys):
# def get_busydialog():
#     def __init__(self, *args, **kwargs):
#     def get_setting(self, settingid):
#     def set_setting(self, settingid, value):
#     def __init__(self, *args, **kwargs):
#     def default(self, obj):
#     def __init__(self, *args, **kwargs):
#     def iterencode(self, obj, _one_shot=False):
#     def raw_decode(self, s, idx=0):
#     def _json_unicode_to_str(self, jsoninput):
#     def __init__(self):
#     def create(self):
#     def close(self):
#     def __del__(self):
# class Addon(xbmcaddon.Addon):
# class ObjectJSONEncoder(json.JSONEncoder):
# class UTF8PrettyJSONEncoder(ObjectJSONEncoder):
# class UTF8JSONDecoder(json.JSONDecoder):
# class DialogBusy(object):
# 
# Path: lib/libs/pykodi.py
# ADDONID = 'script.artwork.beef'
# def get_main_addon():
# def is_addon_watched():
# def get_kodi_version():
# def localize(messageid):
# def get_conditional(conditional):
# def get_infolabel(infolabel):
# def execute_builtin(builtin_command):
# def datetime_now():
# def datetime_strptime(date_string, format_string):
# def execute_jsonrpc(jsonrpc_command):
# def log(message, level=xbmc.LOGDEBUG, tag=None):
# def scrub_message(message):
# def set_log_scrubstring(key, string):
# def get_language(language_format=xbmc.ENGLISH_NAME, region=False):
# def unquoteimage(imagestring):
# def quoteimage(imagestring):
# def unquotearchive(filepath):
# def get_command(*first_arg_keys):
# def get_busydialog():
#     def __init__(self, *args, **kwargs):
#     def get_setting(self, settingid):
#     def set_setting(self, settingid, value):
#     def __init__(self, *args, **kwargs):
#     def default(self, obj):
#     def __init__(self, *args, **kwargs):
#     def iterencode(self, obj, _one_shot=False):
#     def raw_decode(self, s, idx=0):
#     def _json_unicode_to_str(self, jsoninput):
#     def __init__(self):
#     def create(self):
#     def close(self):
#     def __del__(self):
# class Addon(xbmcaddon.Addon):
# class ObjectJSONEncoder(json.JSONEncoder):
# class UTF8PrettyJSONEncoder(ObjectJSONEncoder):
# class UTF8JSONDecoder(json.JSONDecoder):
# class DialogBusy(object):


# Path: lib/libs/quickjson.py
from itertools import chain
from lib.libs import mediatypes, pykodi
from lib.libs.pykodi import get_kodi_version, json, log



# [0] method part, [1] list: properties, [2] dict: extra params
typemap = {mediatypes.MOVIE: ('Movie', ['art', 'imdbnumber', 'file', 'premiered', 'uniqueid', 'setid'], None),
    mediatypes.MOVIESET: ('MovieSet', ['art'], {'movies': {'properties': ['art', 'file']}}),
    mediatypes.TVSHOW: ('TVShow', ['art', 'imdbnumber', 'season', 'file', 'premiered', 'uniqueid'], None),
    mediatypes.EPISODE: ('Episode', ['art', 'uniqueid', 'tvshowid', 'season', 'episode', 'file', 'showtitle'], None),
    mediatypes.SEASON: ('Season', ['season', 'art', 'tvshowid', 'showtitle'], None),
    mediatypes.MUSICVIDEO: ('MusicVideo', ['art', 'file', 'title', 'artist'], None),
    mediatypes.ARTIST: ('Artist', ['art', 'musicbrainzartistid'], None),
    mediatypes.ALBUM: ('Album', ['art', 'musicbrainzalbumid', 'musicbrainzreleasegroupid',
        'musicbrainzalbumartistid', 'artist', 'artistid', 'title'], None),
    mediatypes.SONG: ('Song', ['art', 'musicbrainztrackid', 'musicbrainzalbumartistid', 'album',
        'albumartist', 'albumartistid', 'albumid', 'file', 'disc', 'artist', 'title'], None)}

def _needupgrade(mediatype):

    return mediatype in (mediatypes.MOVIE, mediatypes.TVSHOW) and get_kodi_version() < 17