def open_sub_install(url):
    path = kodi.translate_path(
        os.path.join('special://home', 'addons', 'packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("Please Wait", 'Installing Official OpenSubtitles Addon')
    lib = os.path.join(path, 'opensubtitlesOfficial.zip')
    try:
        os.remove(lib)
    except OSError:
        pass
    page = kodi.open_url(url)
    xbmc.log('@#@contentcontentcontent: %s' % str(url), xbmc.LOGINFO)
    url += re.search('''title="([^z]*zip)''', page).group(1)
    downloader.download(url, lib, dp, timeout=120)
    addonfolder = kodi.translate_path(
        os.path.join('special://', 'home', 'addons'))
    time.sleep(2)
    try:
        extract.extract_all(lib, addonfolder, '')
    except IOError as e:
        kodi.message("Failed to open required files", "Error is: ", str(e))
        return False
    # except IOError, (errno, strerror):
    #     kodi.message("Failed to open required files", "Error code is:", strerror)
    #     return False
    #
    addon_able.set_enabled("service.subtitles.opensubtitles_by_opensubtitles")
    dialog.ok("Installation Complete!",
              "    We hope you enjoy your Kodi addon experience!",
              "    Brought To You By %s " % siteTitle)
def depend_install(name, url):
    path = kodi.translate_path(
        os.path.join('special://home', 'addons', 'packages'))
    lib = os.path.join(path, name + '.zip')
    addonfolder = kodi.translate_path(
        os.path.join('special://', 'home', 'addons'))
    try:
        os.remove(lib)
    except OSError:
        pass
    download(url, lib, addonfolder, name)
    addon_able.set_enabled(name)
def get_logpath():  # global path
    # global content
    # path = ''
    # content = ''
    logfile_name = xbmc.getInfoLabel('System.FriendlyName').split()[0].lower()
    l_path = os.path.join(kodi.translate_path('special://logpath'),
                          logfile_name + '.log')
    if not os.path.isfile(l_path):
        l_path = os.path.join(kodi.translate_path('special://logpath'),
                              'kodi.log')
        if not os.path.isfile(l_path):
            pass
    return l_path
def deep_depends(dataurl, addonname):
    depends = kodi.translate_path(
        os.path.join('special://home', 'addons', addonname, 'addon.xml'))
    source = open(depends, mode='r')
    link = source.read()
    source.close()
    dmatch = re.compile('import addon="(.+?)"').findall(link)
    for requires in dmatch:
        if 'xbmc.python' not in requires:
            dependspath = kodi.translate_path(
                os.path.join('special://home/addons', requires))
            if not os.path.exists(dependspath):
                new_depend(dataurl, requires)
def install_keymap(name, url):
    if os.path.isfile(KEYBOARD_FILE):
        try:
            os.remove(KEYBOARD_FILE)
        except OSError:
            pass
    # Check is the packages folder exists, if not create it.
    path = kodi.translate_path(
        os.path.join('special://home/addons', 'packages'))
    if not os.path.exists(path):
        os.makedirs(path)
    path_key = kodi.translate_path(
        os.path.join('special://home/userdata', 'keymaps'))
    if not os.path.exists(path_key):
        os.makedirs(path_key)
    buildname = name
    dp = xbmcgui.DialogProgress()
    dp.create("Keymap Installer", "", "", "[B]Keymap: [/B]" + buildname)
    buildname = "customkeymap"
    lib = os.path.join(path, buildname + '.zip')

    try:
        os.remove(lib)
    except OSError:
        pass

    downloader.download(url, lib, dp, timeout=120)
    addonfolder = kodi.translate_path(os.path.join('special://', 'home'))
    time.sleep(2)
    dp.update(0, "", "Installing Please wait..", "")
    try:
        extract.extract_all(lib, addonfolder, dp)
    except IOError as e:
        kodi.message("Failed to open required files", "Error is: ", str(e))
        return False
    # except IOError, (errno, strerror):
    #     kodi.message("Failed to open required files", "Error code is:", strerror)
    #     return False

    time.sleep(1)
    try:
        os.remove(lib)
    except OSError:
        pass

    xbmc.executebuiltin("Container.Refresh")
    dialog.ok("Custom Keymap Installed!",
              "     We hope you enjoy your Kodi addon experience!",
              "    Brought To You By %s " % siteTitle)
Пример #6
0
def scriptblock_checks():
    if kodi.get_setting('scriptblock') == 'true':
        kodi.log('SCRIPT BLOCKER ON')
        link = kodi.read_file(BlocksUrl)
        # try:
        #     req = Request(BlocksUrl)
        #     req.add_header('User-Agent', 'Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; AFTB Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30')
        #     response = urlopen(req)
        # except:
        #     kodi.log('Could not perform blocked script check. invalid URL')
        #     return
        # link = response.read()
        # response.close()
        link = link.replace('\n', '').replace('\r', '').replace('\a', '')

        match = re.compile('block="(.+?)"').findall(link)
        for blocked in match:
            kodi.log('Checking for Malicious scripts')

            addonPath = xbmcaddon.Addon(id=addon_id).getAddonInfo('path')
            addonPath = kodi.translate_path(addonPath)
            xbmcPath = os.path.join(addonPath, "..", "..")
            xbmcPath = os.path.abspath(xbmcPath)

            addonpath = xbmcPath + '/addons/'
            try:
                for root, dirs, files in os.walk(addonpath, topdown=False):
                    if root != addonpath:
                        if blocked in root:
                            shutil.rmtree(root)
            except:
                kodi.log('Could not find blocked script')
Пример #7
0
def startup_rejuv():
    if kodi.yesno_dialog("Please confirm that you wish you wipe clean your current configuration"
                        "and reconfigure Kodi with the latest Config Wizard update!\n"+\
                        "        This will result in the loss of all your current data!",heading=AddonTitle):
        addonPath = kodi.addon.getAddonInfo('path')
        addonPath = kodi.translate_path(addonPath)
        xbmcPath = os.path.join(addonPath, "..", "..")
        xbmcPath = os.path.abspath(xbmcPath)
        # Directories and sub directories not to remove but to sort through
        dir_exclude = ('addons', 'packages', 'userdata', 'Database', 'temp')
        #  Directories and sub directories Directories to ignore and leave intact
        sub_dir_exclude = [
            'metadata.album.universal', 'metadata.artists.universal',
            'service.xbmc.versioncheck', 'metadata.common.musicbrainz.org',
            'metadata.common.imdb.com', AddonID
        ]
        # if kodi.yesno_dialog(AddonTitle, "Do you wish to keep %s installed for convenience after the factory restore?"
        #                     % AddonTitle, '', nolabel='No', yeslabel='Yes'):
        #     sub_dir_exclude.extend([AddonID])
        #  Files to ignore and not to be removed
        file_exclude = ('kodi.log'
                        )  # , 'Textures13.db','Addons26.db',  'Addons27.db')
        db_vers = max(
            re.findall(
                'Addons\d+.db',
                str(os.listdir(kodi.translate_path('special://database')))))
        file_exclude += db_vers
        try:
            for (root, dirs, files) in os.walk(xbmcPath, topdown=True):
                dirs[:] = [dir for dir in dirs if dir not in sub_dir_exclude]
                files[:] = [file for file in files if file not in file_exclude]
                for folder in dirs:
                    if folder not in dir_exclude:
                        try:
                            shutil.rmtree(os.path.join(root, folder))
                        except:
                            pass
                for file_name in files:
                    try:
                        os.remove(os.path.join(root, file_name))
                    except:
                        pass
        except Exception as e:
            kodi.log("Rejuv.startup_rejuv User files partially removed - " +
                     str(e))

        rejuv_run.JUVWIZARD()
Пример #8
0
def art(f, fe=''):
    fe1 = ('.png', '.jpg', '.gif', '.wav', '.txt')
    for ext in fe1:
        if ext in f:
            f = f.replace(ext, '')
            fe = ext
            break
    return kodi.translate_path(addon_path(f + fe))
Пример #9
0
def delete_crash_logs(auto_clear=False):
    if not auto_clear:
        if not xbmcgui.Dialog().yesno(
                AddonName,
                'Delete Crash Logs\nDo you want to delete old crash logs?'):
            return
    cache_directories = (kodi.translate_path('special://home'),
                         os.path.join(kodi.translate_path('special://home'),
                                      'cache'),
                         kodi.translate_path('special://temp'))
    for cache_directory in cache_directories:
        if os.path.exists(cache_directory):
            file_types = ('*.dmp', '*.txt')
            import glob
            for file_type in file_types:
                for infile in glob.glob(cache_directory + file_type):
                    os.remove(infile)
    if not auto_clear:
        xbmcgui.Dialog().ok(AddonName, "Crash logs deleted")
Пример #10
0
def setall_enable():
    if kodi.get_kversion() > 16.5:
        addonfolder = kodi.translate_path(
            os.path.join('special://home', 'addons'))
        contents = os.listdir(addonfolder)
        kodi.log(contents)
        conn.executemany('update installed set enabled=1 WHERE addonID = (?)',
                         ((val, ) for val in contents))
        conn.commit()
        xbmc.executebuiltin("UpdateAddonRepos")
        xbmc.sleep(500)
        xbmc.executebuiltin("UpdateLocalAddons")
Пример #11
0
def purge_packages():
    kodi.log('STARTUP PURGE PACKAGES ACTIVATED')
    packages_path = kodi.translate_path(
        os.path.join('special://home/addons/packages', ''))
    try:
        for root, dirs, files in os.walk(packages_path, topdown=False):
            for name in files:
                os.remove(os.path.join(root, name))
            # kodi.log('Packages Wiped by Service')
            # dialog = xbmcgui.Dialog()
            # dialog.ok(AddonTitle, "                     Packages Folder Wiped Successfully!")
    except:
        kodi.log('Startup Service could not purge packages')
Пример #12
0
def delete_packages(auto_clear=False):
    if not auto_clear:
        if not xbmcgui.Dialog().yesno('Delete Packages',
                                      "Delete Package Cache Files?"):
            return
    for root, dirs, files in os.walk(
            kodi.translate_path('special://home/addons/packages')):
        try:
            for f in files:
                os.unlink(os.path.join(root, f))
            for d in dirs:
                shutil.rmtree(os.path.join(root, d))
        except OSError:
            pass
    if not auto_clear:
        xbmcgui.Dialog().ok(AddonName, "Deleting Packages all done")
        xbmc.executebuiltin("Container.Refresh")
Пример #13
0
def runfulltest(url):
    addon_profile_path = kodi.translate_path(ADDON.getAddonInfo('profile'))
    speed_test_files_dir = make_dir(addon_profile_path, 'speedtestfiles')
    speed_test_download_file = os.path.join(speed_test_files_dir, GetEpochStr() + '.speedtest')
    timetaken = download(url, speed_test_download_file)
    os.remove(speed_test_download_file)
    avgspeed = ((currently_downloaded_bytes / timetaken) * 8 / (1024 * 1024))
    maxspeed = (max_Bps * 8 / (1024 * 1024))
    if avgspeed < 2:
        livestreams = 'Very low quality streams might work.'
        onlinevids = 'Expect buffering, do not try HD.'
        rating = '[COLOR ghostwhite][B] Verdict: [I]Very Poor[/I]   | Score: [COLOR slategray][I]1/10[/I][/B][/COLOR]'
    elif avgspeed < 2.5:
        livestreams = 'You should be ok for SD content only.'
        onlinevids = 'SD/DVD quality should be ok.'
        rating = '[COLOR ghostwhite][B][I]Poor[/I]   | Score: [COLOR slategray][I]2/10[/I][/B][/COLOR]'
    elif avgspeed < 5:
        livestreams = 'Some HD streams might struggle, SD should be fine.'
        onlinevids = '720p will be fine but some 1080p may struggle.'
        rating = '[COLOR ghostwhite][B][I]OK[/I]   | Score: [COLOR slategray][I]4/10[/I][/B][/COLOR]'
    elif avgspeed < 9:
        livestreams = 'All streams including HD should stream fine.'
        onlinevids = 'Movies (720p & 1080p) will stream fine but 3D and 4K will not.'
        rating = '[COLOR ghostwhite][B][I]Good[/I]   | Score: [COLOR slategray][I]6/10[/I][/B][/COLOR]'
    elif avgspeed < 15:
        livestreams = 'All streams including HD should stream fine'
        onlinevids = 'Movies (720p & 1080p and 3D) will stream fine but 4K may not.'
        rating = '[COLOR ghostwhite][B][I]Very good[/I]   | Score: [COLOR slategray][I]8/10[/I][/B][/COLOR]'
    else:
        livestreams = 'All streams including HD should stream fine'
        onlinevids = 'You can play all movies (720p, 1080p, 3D and 4K)'
        rating = '[COLOR ghostwhite][B][I]Excellent[/I]   | Score: [COLOR slategray][I]10/10[/I][/B][/COLOR]'
    print("Average Speed: " + str(avgspeed))
    print("Max. Speed: " + str(maxspeed))
    dialog = xbmcgui.Dialog()
    ok = dialog.ok(
        '[COLOR lightsteelblue][B]Your Result:[/COLOR][/B] ',
        '\n[COLOR lightsteelblue][B]Live Streams:[/COLOR][/B] ' + livestreams+\
        '\n[COLOR lightsteelblue][B]Movie Streams:[/COLOR][/B] ' + onlinevids+\
        '\n[COLOR lightsteelblue][B]Duration:[/COLOR][/B] %.02f secs ' % timetaken + '[COLOR lightsteelblue][B]Average Speed:[/B][/COLOR] %.02f Mb/s ' % avgspeed + '[COLOR lightsteelblue][B]Max Speed:[/B][/COLOR] %.02f Mb/s ' % maxspeed,
    )
Пример #14
0
def clear_cache():
    kodi.log('STARTUP CLEAR CACHE ACTIVATED')
    xbmc_cache_path = os.path.join(kodi.translate_path('special://home'),
                                   'cache')
    if os.path.exists(xbmc_cache_path) == True:
        for root, dirs, files in os.walk(xbmc_cache_path):
            file_count = 0
            file_count += len(files)
            if file_count > 0:
                for f in files:
                    try:
                        os.unlink(os.path.join(root, f))
                    except:
                        pass
                for d in dirs:
                    if 'archive_cache' not in d:
                        try:
                            shutil.rmtree(os.path.join(root, d))
                        except:
                            pass
        kodi.log('Startup Service could not clear cache')
Пример #15
0
def auto_weekly_clean_on_off():
    if kodi.get_setting("clearday") == '7':
        if xbmcgui.Dialog().yesno(
                AddonName,
                'Please confirm that you wish to enable weekly automated maintenance.'
        ):
            kodi.set_setting("clearday", datetime.datetime.today().weekday())
            kodi.open_settings(addon_id, id1=5, id2=3)
            available_space, total_space = get_free_space_mb(
                kodi.translate_path('special://home'))
            if str(available_space) == '0 B Free' and str(
                    total_space) == '0 B Total':
                xbmcgui.Dialog().ok(
                    'Auto Maintenance Error',
                    'Auto Maintenance encountered a problem and can not be run',
                    'Maintenace can still be done individually')
                return
            mb_settings = (0, 25, 50, 75, 100)
            while True:
                allotted_space = 0
                for value in ('cachemb', 'thumbsmb', 'packagesmb'):
                    allotted_space += mb_settings[int(
                        kodi.get_setting(value))] * 10**6
                if (allotted_space >=
                        available_space) and not kodi.get_setting("automb"):
                    xbmcgui.Dialog().ok(
                        "Your settings sizes for Kodi to use are larger than the available drive space",
                        'Please try lower settings, uninstall uneeded apps and addons,',
                        'or set kodi size to "Auto" to use the automated settings based on free space'
                    )
                    kodi.open_settings(addon_id, id1=5, id2=3)
                else:
                    break
    else:
        if xbmcgui.Dialog().yesno(
                AddonName,
                'Please confirm that you wish to disable weekly automated maintenance.'
        ):
            kodi.set_setting("clearday", '7')
    xbmc.executebuiltin("Container.Refresh")
Пример #16
0
import datetime
import os
from sqlite3 import dbapi2 as db_lib

import xbmc
import xbmcaddon
from libs import kodi

addon_id = kodi.addon_id
db_dir = kodi.translate_path("special://profile/Database")
db_path = os.path.join(db_dir, 'Addons33.db')

conn = db_lib.connect(db_path)
conn.text_factory = str

ADDON = xbmcaddon.Addon(id=kodi.addon_id)


def set_enabled(newaddon):
    if kodi.get_kversion() > 16.5:
        kodi.log("Enabling " + newaddon)
        setit = 1
        now = datetime.datetime.now()
        date_time = str(now).split('.')[0]
        sql = 'REPLACE INTO installed (addonID,enabled,installDate) VALUES(?,?,?)'
        conn.execute(sql, (
            newaddon,
            setit,
            date_time,
        ))
        conn.commit()
Пример #17
0
def libinstaller(name, url=None):
    if "Android" in name:
        if not xbmc.getCondVisibility('system.platform.android'):

            dialog.ok(
                AddonTitle + " - Android",
                "[B][COLOR white]Sorry, this file is only for Android devices[/COLOR][/B]",
                '')
            sys.exit(1)
        else:
            name = "librtmp.so"
            path = kodi.translate_path(os.path.join('special://home', ''))
            make_lib(path, name, url)

    if "Windows" in name:
        if not xbmc.getCondVisibility('system.platform.windows'):

            dialog.ok(
                AddonTitle + " -Windows",
                "[B][COLOR white]Sorry, this file is only for Windows devices[/COLOR][/B]",
                '')
            return
        else:
            name = "librtmp.dll"
            path = kodi.translate_path(os.path.join('special://home', ''))
            make_lib(path, name, url)

    if "Linux" in name:
        if not xbmc.getCondVisibility('system.platform.linux'):

            dialog.ok(
                AddonTitle + " - Linux",
                "[B][COLOR white]Sorry, this file is only for Linux devices[/COLOR][/B]",
                '')
            return
        else:
            name = "librtmp.so.1"
            path = kodi.translate_path(os.path.join('special://home', ''))
            make_lib(path, name, url)

    if "OSX" in name:
        if not xbmc.getCondVisibility('system.platform.osx'):

            dialog.ok(
                AddonTitle + " - MacOSX",
                "[B][COLOR white]Sorry, this file is only for MacOSX devices[/COLOR][/B]",
                '')
            return
        else:
            name = "librtmp.1.dylib"
            path = kodi.translate_path(os.path.join('special://home', ''))
            make_lib(path, name, url)

    if "TV" in name:
        if not xbmc.getCondVisibility('system.platform.atv2'):

            dialog.ok(
                AddonTitle + " - ATV",
                "[B][COLOR white]Sorry, this file is only for ATV devices[/COLOR][/B]",
                '')
            return
        else:
            name = "librtmp.1.dylib"
            path = kodi.translate_path(os.path.join('special://home', ''))
            make_lib(path, name, url)

    if "iOS" in name:
        if not xbmc.getCondVisibility('system.platform.ios'):

            dialog.ok(
                AddonTitle + " - iOS",
                "[B][COLOR white]Sorry, this file is only for iOS devices[/COLOR][/B]",
                '')
            return
        else:
            name = "librtmp.1.dylib"
            path = kodi.translate_path(os.path.join('special://home', ''))
            make_lib(path, name, url)

    if "RPi" in name:
        if not xbmc.getCondVisibility('system.platform.rpi'):

            dialog.ok(
                AddonTitle + " - RPi",
                "[B][COLOR white]Sorry, this file is only for RPi devices[/COLOR][/B]",
                '')
            return
        else:
            name = "librtmp.1.so"
            path = kodi.translate_path(os.path.join('special://home', ''))
            make_lib(path, name, url)
Пример #18
0
import traceback
import xbmc
import xbmcgui
import xbmcaddon
import tarfile
import zipfile
from zipfile import ZipFile
from libs import kodi

# try:
#     from urllib.request import urlopen, Request  # python 3.x
# except ImportError:
#     from urllib2 import urlopen, Request  # python 2.x

addon_id = xbmcaddon.Addon().getAddonInfo('id')
profile_path = os.path.join(kodi.translate_path('special://profile/'),
                            'addon_data/', addon_id)
addons_path = os.path.join(kodi.translate_path('special://home/'), 'addons/')
log_file = os.path.join(profile_path, 'nocoin.log')
error_log_file = os.path.join(profile_path, 'nocoin_error.log')
setting = xbmcaddon.Addon().getSetting


class Ziplevels:
    def __init__(self):
        self.path = ''
        self.name = ''
        self.tmp_dir = ''


def zip_file(zip_main_file_path, zip_main_file_name, main_directory,
Пример #19
0
import notification
import downloader
import extract
import time

import xbmc
import xbmcaddon
import maintool

from libs import addon_able
from libs import kodi

addon_id = kodi.addon_id
AddonTitle = kodi.addon.getAddonInfo('name')
addonspath = os.path.abspath(kodi.translate_path('special://home')) + '/addons/'
packages_path = kodi.translate_path(os.path.join('special://home', 'addons', 'packages'))
datapath = os.path.abspath(kodi.translate_path('special://home')) + '/userdata/addon_data/'
artwork = kodi.translate_path(os.path.join('special://home', 'addons', addon_id, 'art/'))
BlocksUrl = 'https://indigo.tvaddons.co/blocker/blocker.txt'
script_url = 'https://github.com/tvaddonsco/tva-release-repo/raw/master/plugin.program.indigo/'
db_dir = kodi.translate_path("special://profile/Database")
db_path = os.path.join(db_dir, 'Addons27.db')
run_once_path = kodi.translate_path(os.path.join('special://home', 'addons', addon_id, 'resources', 'run_once.py'))
settings = xbmcaddon.Addon(id=addon_id)
kodi.log('STARTING ' + AddonTitle + ' SERVICE')

oldinstaller = kodi.translate_path(os.path.join('special://home', 'addons', 'plugin.program.addoninstaller'))
oldnotify = kodi.translate_path(os.path.join('special://home', 'addons', 'plugin.program.xbmchub.notifications'))
oldmain = kodi.translate_path(os.path.join('special://home', 'addons', 'plugin.video.xbmchubmaintool'))
oldwiz = kodi.translate_path(os.path.join('special://home', 'addons', 'plugin.video.hubwizard'))
Пример #20
0
def nocoin():
    _totals_ = {
        'total_occurrences': [],
        'total_mining_instances': 0,
        'total_file_count': 0,
    }
    f_count = 1
    fz_count = 0
    start_time = datetime.datetime.now()
    # if called from service or auto run, skip dp reporting
    dp = xbmcgui.DialogProgress()
    dp.create('Scanning')
    dp.update(0)
    if os.path.exists(log_file):
        os.remove(log_file)
    if os.path.exists(error_log_file):
        os.remove(error_log_file)
    definitions = get_definitions()
    directories = [kodi.translate_path('special://home/')
                   ] if setting('scan_default_dir') == 'true' else []
    if setting('scan_warning') == 'true':
        for numb in range(0, 7):
            scan_dir = xbmcaddon.Addon().getSetting('scan_dir' + str(numb))
            if scan_dir:
                directories.append(scan_dir)
    for directory_to_test in directories:
        f_count = sum(
            len(main_files) for _, _, main_files in os.walk(directory_to_test))
    for directory_to_test in directories:
        for (main_directory, main_sub_dir,
             main_files) in os.walk(directory_to_test, topdown=True):
            for main_file_name in main_files:
                main_file_path = os.path.join(main_directory, main_file_name)
                # if called from service or auto run, skip dp reporting
                percent = 100 * fz_count / f_count if 100 * fz_count / f_count >= 0 else 0
                dp.update(int(percent), os.path.dirname(main_file_path)+'\n'+main_file_name+'\n'+\
                          '%s of %s    %s%%' % (fz_count, f_count, percent))
                if dp.iscanceled():
                    dp.close()
                    return
                try:
                    if zipfile.is_zipfile(
                            main_file_name) or tarfile.is_tarfile(
                                main_file_path):
                        zip_file(main_file_path, main_file_name,
                                 main_directory, definitions, _totals_)
                    else:
                        file_check(main_file_path, main_file_name,
                                   main_directory, definitions, _totals_)
                    fz_count += 1
                except Exception as e:
                    log('could not open ' + main_file_path, str(e))
    # if called from service or auto run, skip dp reporting
    dp.close()
    if not _totals_['total_occurrences'] and not _totals_[
            'total_mining_instances']:
        log('The Files are Clean')
    if _totals_['total_occurrences']:
        for occur in _totals_['total_occurrences']:
            log(occur)
        log('\ntotal mining instances = %s' %
            _totals_['total_mining_instances'])
    log('total files checked = %s \nScan Complete: Elapsed Time = %s' %
        (_totals_['total_file_count'], (datetime.datetime.now() - start_time)))
    log('Last run: %s' % datetime.datetime.now())
    # if ran from service or auto run, regex log for time stamp from service
    # if ran from service or auto run, call nc_options(log_file) directly if _totals_['total_mining_instances'] > 0
    import textviewer
    textviewer.display(log_file, '', 'nocoin')
Пример #21
0
def addon_install(name, url, repourl):
    try:
        name = name.split('[COLOR FF0077D7]Install [/COLOR][COLOR FFFFFFFF]'
                          )[1].split('[/COLOR][COLOR FF0077D7] (v')[0]
    except Exception as e:
        kodi.log(str(e))
        traceback.print_exc(file=sys.stdout)
    kodi.log("Installer: Installing: " + name)
    addonname = '-'.join(url.split('/')[-1].split('-')[:-1])
    addonname = str(addonname).replace('[', '').replace(']', '').replace(
        '"', '').replace('[', '').replace("'", '')
    try:
        addonname = re.search('(.+?)($|-)', addonname).group(1)
    except Exception as e:
        kodi.log(str(e))
        traceback.print_exc(file=sys.stdout)
    path = kodi.translate_path(
        os.path.join('special://home', 'addons', 'packages'))
    if xbmcgui.Dialog().yesno(
            "Please Confirm",
            "                Do you wish to install the chosen add-on and",
            "                        its respective repository if needed?",
            "                            ", "Cancel", "Install"):
        if 'tva-release-repo' in url:
            url = get_max_version(addonname, url, tva_repo)
        dp = xbmcgui.DialogProgress()
        dp.create("Download Progress:", "", '', 'Please Wait')
        lib = os.path.join(path, name + '.zip')
        try:
            os.remove(lib)
        except OSError:
            pass
        addonfolder = kodi.translate_path(
            os.path.join('special://', 'home', 'addons'))
        download(url, lib, addonfolder, name)
        addon_able.set_enabled(addonname)
        try:
            dataurl = repourl.split("repository", 1)[0]

            # Start Addon Depend Search ==================================================================
            depends = kodi.translate_path(
                os.path.join('special://home', 'addons', addonname,
                             'addon.xml'))
            source = open(depends, mode='r')
            link = source.read()
            source.close()
            dmatch = re.compile('import addon="(.+)"').findall(link)
            for requires in dmatch:
                if 'xbmc.python' not in requires:
                    if 'xbmc.gui' not in requires:
                        dependspath = kodi.translate_path(
                            os.path.join('special://home/addons', requires))
                        if not os.path.exists(dependspath):
                            new_depend(dataurl, requires)
                            deep_depends(dataurl, requires)
        except Exception as e:
            kodi.log(str(e))
            traceback.print_exc(file=sys.stdout)
        # # End Addon Depend Search ======================================================================

        kodi.log("STARTING REPO INSTALL")
        kodi.log("Installer: Repo is : " + repourl)
        if repourl:
            if 'None' not in repourl:
                path = kodi.translate_path(
                    os.path.join('special://home/addons', 'packages'))
                repo_name = str(repourl.split('/')[-1:]).split('-')[:-1]
                repo_name = str(repo_name).replace('[', '').replace(']', '').replace('"', '').replace('[', '')\
                    .replace("'", '').replace(".zip", '')
                if 'tva-release-repo' in repourl:
                    repourl = get_max_version(repo_name, repourl, tva_repo)
                lib = os.path.join(path, repo_name + '.zip')
                try:
                    os.remove(lib)
                except Exception as e:
                    kodi.log(str(e))
                addonfolder = kodi.translate_path(
                    os.path.join('special://', 'home/addons'))
                download(repourl, lib, addonfolder, repo_name)
                kodi.log("REPO TO ENABLE IS  " + repo_name)
                addon_able.set_enabled(repo_name)

        if not dialog.yesno(
                siteTitle,
                '                     Click Continue to install more addons or',
                '                    Restart button to finalize addon installation',
                "                          Brought To You By %s " % siteTitle,
                nolabel='Restart',
                yeslabel='Continue'):
            xbmc.executebuiltin('ShutDown')
    else:
        return
Пример #22
0
def system_info():
    systime = xbmc.getInfoLabel('System.Time ')
    dns1 = xbmc.getInfoLabel('Network.DNS1Address')
    gateway = xbmc.getInfoLabel('Network.GatewayAddress')
    ipaddy = xbmc.getInfoLabel('Network.IPAddress')
    linkstate = xbmc.getInfoLabel('Network.LinkState').replace("Link:", "")
    freespace, totalspace = maintool.get_free_space_mb(os.path.join(kodi.translate_path('special://home')))
    freespace = maintool.convert_size(freespace)
    totalspace = maintool.convert_size(totalspace)
    screenres = xbmc.getInfoLabel('system.screenresolution')
    freemem = maintool.convert_size(maintool.revert_size(xbmc.getInfoLabel('System.FreeMemory')))
    
    # FIND WHAT VERSION OF KODI IS RUNNING
    # xbmc_version = xbmc.getInfoLabel("System.BuildVersion")
    # versioni = xbmc_version[:4]
    # codename = kodi.get_codename()

    # Get External IP Address
    try:
        # ext_ip = ("blue", OPEN_URL('https://api.ipify.org'))
        ext_ip = ("blue", kodi.read_file('https://api.ipify.org'))
    except Exception as e:
        kodi.log(str(e))
        try:
            # link = OPEN_URL('http://whatismyip.network/')
            link = kodi.read_file('http://whatismyip.network/')
            ext_ip = ("blue", re.search('>My IP Address[^=]*[^>]*>([^<]*)', link).group(1))
        except TypeError:
            ext_ip = ("red", "IP Check Not Available")

    # Get Python Version
    pv = sys.version_info
    
    # System Information Menu
    # kodi.add_item('[COLOR ghostwhite]Version: [/COLOR][COLOR lime] %s %s[/COLOR]' % (codename, versioni),
    #              '', 100, artwork + 'icon.png', "", description=" ")
    kodi.add_item('[COLOR ghostwhite]Version: [/COLOR][COLOR lime] %s %s[/COLOR]' %
                  (kodi.get_codename(), xbmc.getInfoLabel("System.BuildVersion").split('Git')[0]), '',
                  100, artwork + 'icon.png', "", description=" ")
    kodi.add_item('[COLOR ghostwhite]System Time: [/COLOR][COLOR lime] %s[/COLOR]' % systime,
                  '', 100, artwork + 'icon.png', "", description=" ")
    kodi.add_item('[COLOR ghostwhite]Gateway: [/COLOR][COLOR blue] %s[/COLOR]' % gateway,
                  '', 100, artwork + 'icon.png', "", description=" ")
    kodi.add_item('[COLOR ghostwhite]Local IP: [/COLOR][COLOR blue] %s[/COLOR]' % ipaddy,
                  '', 100, artwork+'icon.png', "", description=" ")
    kodi.add_item('[COLOR ghostwhite]External IP: [/COLOR][COLOR %s] %s[/COLOR]' % ext_ip,
                  '', 100, artwork + 'icon.png', "", description=" ")
    kodi.add_item('[COLOR ghostwhite]DNS 1: [/COLOR][COLOR blue] %s[/COLOR]' % dns1,
                  '', 100, artwork + 'icon.png', "", description=" ")
    kodi.add_item('[COLOR ghostwhite]Network: [/COLOR][COLOR gold] %s[/COLOR]' % linkstate,
                  '', 100, artwork + 'icon.png', "", description=" ")
    if str(totalspace) != '0 B':
        kodi.add_item('[COLOR ghostwhite]Total Disc Space: [/COLOR][COLOR gold] %s[/COLOR]' % totalspace,
                      '', 100, artwork + 'icon.png', "", description=" ")
    if str(freespace) != '0 B':
        kodi.add_item('[COLOR ghostwhite]Free Disc Space: [/COLOR][COLOR gold] %s[/COLOR]' % freespace,
                      '', 100, artwork + 'icon.png', "", description=" ")
    kodi.add_item('[COLOR ghostwhite]Free Memory: [/COLOR][COLOR gold] %s[/COLOR]' % freemem,
                  '', 100, artwork + 'icon.png', "", description=" ")
    kodi.add_item('[COLOR ghostwhite]Resolution: [/COLOR][COLOR gold] %s[/COLOR]' % screenres,
                  '', 100, artwork + 'icon.png', "", description=" ")
    kodi.add_item('[COLOR ghostwhite]Python Version: [/COLOR][COLOR lime] %d.%d.%d[/COLOR]' % (pv[0], pv[1], pv[2]),
                  '', 100, artwork + 'icon.png', "", description=" ")
    viewsetter.set_view("files")
Пример #23
0
    quote_plus = urllib.quote_plus
except AttributeError:
    quote_plus = urllib.parse.quote_plus

# if kodi.get_kversion() > 16.5:
#     ssl._create_default_https_context = ssl._create_unverified_context
# else:
#     pass

siteTitle = "TVADDONS.CO"
AddonTitle = kodi.AddonTitle
addon_id = kodi.addon_id
addon = (addon_id, sys.argv)
settings = xbmcaddon.Addon(id=addon_id)
ADDON = xbmcaddon.Addon(id=addon_id)
artPath = kodi.translate_path(
    os.path.join('special://home', 'addons', addon_id, 'resources', 'art2/'))
artwork1 = kodi.translate_path(
    os.path.join('special://home', 'addons', addon_id, 'art/'))
artwork = kodi.translate_path(
    os.path.join('special://home', 'addons', addon_id, 'art2/'))
mainPath = kodi.translate_path(
    os.path.join('special://home', 'addons', addon_id))
packages_path = kodi.translate_path(
    os.path.join('special://home', 'addons', 'packages'))
addon_folder = kodi.translate_path(os.path.join('special://', 'home',
                                                'addons'))
fanart = kodi.translate_path(os.path.join(mainPath, 'fanart.jpg'))
iconart = kodi.translate_path(os.path.join(mainPath, 'icon.png'))
dialog = xbmcgui.Dialog()
# <<<<<<<<<Common Variables>>>>>>>>>>>>>>>
# Keymaps_URL = base64.b64decode("aHR0cDovL2luZGlnby50dmFkZG9ucy4va2V5bWFwcy9jdXN0b21rZXlzLnR4dA==")
Пример #24
0
def JUVWIZARD(filetype='main'):
    if xbmcgui.Dialog().yesno(
            "Please Confirm",
            "                Please confirm that you wish to automatically",
            "            configure Kodi with all the best addons and tweaks!",
            "              ", "Cancel", "Install"):
        filetype = filetype.lower()
        if filetype == 'main':
            addonfolder = kodi.translate_path('special://home')
        elif filetype == 'addon':
            addonfolder = kodi.translate_path(
                os.path.join('special://home', 'addons'))
        else:
            print({'filetype': filetype})
            dialog.ok("Error!", 'filetype: "%s"' % str(filetype))
            return
        link = kodi.read_file(wizlink).replace('\n',
                                               '').replace('\r', '').replace(
                                                   '\a', '').strip()
        # kodi.log(link)
        if '[error]' in link:
            print(link)
            dialog.ok("Error!", link)
            return
        path = kodi.translate_path(
            os.path.join('special://home', 'addons', 'packages'))
        lib = os.path.join(path, 'rejuv.zip')
        try:
            os.remove(lib)
        except:
            pass
        # ## ## ... ##
        dp = xbmcgui.DialogProgress()
        dp.create(AddonTitle, " ", 'Downloading and Configuring ',
                  'Please Wait')
        downloader.download(link, lib, dp)
        xbmc.sleep(4000)
        extract.extract_all(lib, addonfolder, dp)
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        addon_able.setall_enable()
        try:
            addon_able.set_enabled("inputstream.adaptive")
        except:
            pass
        xbmc.sleep(4000)
        try:
            addon_able.set_enabled("inputstream.rtmp")
        except:
            pass
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        try:
            os.remove(lib)
        except:
            pass
        if filetype == 'main':
            link = kodi.read_file(cutslink)
            shorts = re.compile('shortcut="(.+?)"').findall(link)
            for shortname in shorts:
                xEB('Skin.SetString(%s)' % shortname)
                enableBG16 = "UseCustomBackground,true"
                enableBG17 = "use_custom_bg,true"
                xEB('Skin.SetBool(%s)' % enableBG16)
                xEB('Skin.SetBool(%s)' % enableBG17)

        kodi.set_setting("wizardran", 'true')
        dialog.ok(AddonTitle, "Installation Complete.", "",
                  "Click OK to exit Kodi and then restart to complete .")
        xbmc.executebuiltin('ShutDown')
Пример #25
0
from libs import speedtest
from libs import viewsetter

try:
    import htmlentitydefs  # python 2.x
except ImportError:
    import html.entities as htmlentitydefs  # python 3.x

try:
    unquote_plus = urllib.unquote_plus  # python 2.x
except:
    unquote_plus = urllib.parse.unquote_plus  # python 3.x

addon_id = kodi.addon_id
addon = (addon_id, sys.argv)
artwork = kodi.translate_path(os.path.join('special://home', 'addons', addon_id, 'art/'))
AddonTitle = kodi.addon.getAddonInfo('name')
addon_path = kodi.translate_path(os.path.join('special://home', 'addons', addon_id))
packagepath = kodi.translate_path(os.path.join('special://home', 'addons', 'packages'))
ART = kodi.translate_path(os.path.join('special://home', 'addons', addon_id, 'art/'))
ART2 = kodi.translate_path(os.path.join('special://home', 'addons', addon_id, 'art2/'))
ART3 = kodi.translate_path(os.path.join('special://home', 'addons', addon_id, 'art3/'))
fanart = artwork+'fanart.jpg'
messages = kodi.translate_path(os.path.join('special://home', 'addons', addon_id, 'resources', 'messages/'))
execute = xbmc.executebuiltin
hubpath = kodi.translate_path(os.path.join('special://home', 'addons', 'repository.xbmchub'))
uploaderpath = kodi.translate_path(os.path.join('special://home', 'addons', 'script.tvaddons.debug.log'))

oldinstaller = kodi.translate_path(os.path.join('special://home', 'addons', 'plugin.program.addoninstaller'))
oldnotify = kodi.translate_path(os.path.join('special://home', 'addons', 'plugin.program.xbmchub.notifications'))
oldmain = kodi.translate_path(os.path.join('special://home', 'addons', 'plugin.video.xbmchubmaintenance'))
Пример #26
0
def HELPWIZARD(name, url, description, filetype):
    # path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    filetype = filetype.lower()
    if xbmcgui.Dialog().yesno("Please Confirm",
                              "                Please confirm that you wish to automatically\n"+\
                              "            configure Kodi with all the best addons and tweaks!",
                              "Cancel", "Install"):
        path = kodi.translate_path(
            os.path.join('special://home', 'addons', 'packages'))
        dp = xbmcgui.DialogProgress()
        dp.create(AddonTitle, '\nDownloading and Configuring\nPlease Wait')
        lib = os.path.join(path, name + '.zip')
        try:
            os.remove(lib)
        except:
            pass
        # ## ## ... ##
        # kodi.log(url)
        # if str(url).endswith('[error]'):
        #     print(url)
        #     dialog = xbmcgui.Dialog()
        #     dialog.ok("Error!", url)
        #     return
        if '[error]' in url:
            print(url)
            dialog = xbmcgui.Dialog()
            dialog.ok("Error!", url)
            return
        downloader.download(url, lib, dp)
        if not os.path.exists(lib):
            return
        if filetype == 'main':
            addonfolder = kodi.translate_path('special://home')
        elif filetype == 'addon':
            addonfolder = kodi.translate_path(
                os.path.join('special://home', 'addons'))
        else:
            print({'filetype': filetype})
            dialog = xbmcgui.Dialog()
            dialog.ok("Error!", 'filetype: "%s"' % str(filetype))
            return
        xbmc.sleep(4000)
        extract.extract_all(lib, addonfolder, dp)
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        addon_able.setall_enable()
        try:
            addon_able.set_enabled("inputstream.adaptive")
        except:
            pass
        xbmc.sleep(4000)
        try:
            addon_able.set_enabled("inputstream.rtmp")
        except:
            pass
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        try:
            os.remove(lib)
        except:
            pass
        if filetype == 'main':
            link = kodi.read_file(cutslink)
            shorts = re.compile('shortcut="(.+?)"').findall(link)
            for shortname in shorts:
                xEB('Skin.SetString(%s)' % shortname)
                enableBG16 = "UseCustomBackground,true"
                enableBG17 = "use_custom_bg,true"
                xEB('Skin.SetBool(%s)' % enableBG16)
                xEB('Skin.SetBool(%s)' % enableBG17)

        xbmc.sleep(4000)
        xbmc.executebuiltin('XBMC_UpdateLocalAddons()')
        addon_able.setall_enable()
        # try:
        #     addon_able.set_enabled("inputstream.adaptive")
        # except:
        #     pass
        # xbmc.sleep(4000)
        # try:
        #     addon_able.set_enabled("inputstream.rtmp")
        # except:
        #     pass
        kodi.set_setting("wizardran", 'true')

        dialog = xbmcgui.Dialog()
        dialog.ok(AddonTitle, "Installation Complete!", "",
                  "Click OK to exit Kodi and then restart to complete .")
        xbmc.executebuiltin('ShutDown')
Пример #27
0
    QUALITIES.HIGH: 3,
    QUALITIES.HD720: 4,
    QUALITIES.HD1080: 5
}
SHORT_MONS = [
    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
    'Nov', 'Dec'
]
VIDEO_TYPES = __enum(TVSHOW='TV Show',
                     MOVIE='Movie',
                     EPISODE='Episode',
                     SEASON='Season')
###############################################
BASE_URL = ''
CAPTCHA_BASE_URL = 'http://www.google.com/recaptcha/api'
COOKIEPATH = kodi.translate_path(kodi.get_profile())
MONTHS = [
    'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',
    'September', 'October', 'November', 'December'
]
MAX_RESPONSE = 1024 * 1024 * 5
CF_CAPCHA_ENABLED = kodi.get_setting('cf_captcha') == 'true'


class NoRedirection(urllib2.HTTPErrorProcessor):
    def http_response(self, request, response):
        log_utils.log('Stopping Redirect', log_utils.LOGDEBUG)
        return response

    https_response = http_response
    def onClick(self, control_id):
        if control_id == 20293:
            self.close()
            window()

        elif control_id == 20294:
            if mode == 'nocoin':
                self.path = path
            else:
                if kodi.translate_path('special://logpath') not in self.path:
                    self.path = get_logpath()
                if '.old.log' in self.path:
                    self.path = self.path.replace('.old.log', '.log')
            self.path, self.contents = text_view(t_path=self.path)
            main_content_box = self.getControl(self.main_content_box_control)
            main_content_box.setText(self.contents)
            file_name_box = self.getControl(self.file_name_box_control)
            file_name_box.setLabel(self.path)

        elif control_id == 20295:
            if mode == 'nocoin':
                if 'nocoin.log' in path:
                    self.path = path.replace('nocoin.log', 'nocoin_error.log')
            else:
                if kodi.translate_path('special://logpath') not in self.path:
                    self.path = get_logpath()
                if '.old.log' not in self.path:
                    self.path = self.path.replace('.log', '.old.log')
            self.path, old_contents = text_view(t_path=self.path)
            main_content_box = self.getControl(self.main_content_box_control)
            main_content_box.setText(old_contents)
            file_name_box = self.getControl(self.file_name_box_control)
            file_name_box.setLabel(self.path)

        elif control_id == 20296:
            if mode == 'nocoin':
                #  make function to handle options
                import nocoin
                nocoin.nc_options(path)

            else:
                xbmc.executebuiltin("ToggleDebug")
                debug_on_off_button = self.getControl(self.third_button)
                if not _is_debugging():
                    debug_on_off_button.setLabel('Debug Off')
                else:
                    debug_on_off_button.setLabel('Debug On')

        elif control_id == 20290:
            if mode == 'nocoin':
                self.close()
            else:
                xbmc.executebuiltin("RunAddon(script.tvaddons.debug.log)")

        elif control_id == 20297:
            try:
                self.path, kb_contents = text_view(t_path='kb_input',
                                                   d_path=self.path)
                main_content_box = self.getControl(
                    self.main_content_box_control)
                main_content_box.setText(kb_contents)
                file_name_box = self.getControl(self.file_name_box_control)
                file_name_box.setLabel(self.path)
            except TypeError:
                pass
Пример #29
0
def auto_clean(auto_clear=False):
    if not auto_clear:
        if not xbmcgui.Dialog().yesno(
                AddonName,
                'Selecting Yes runs maintenance based on your settings.',
                'Do you wish to continue?',
                yeslabel='Yes',
                nolabel='No'):
            return
    available_space, total_space = get_free_space_mb(
        kodi.translate_path('special://home'))
    err_default = (0, '0 B', '0M', '0 MB', '0 MB Free', '0 MB Total',
                   '0M Free', '0M Total')
    if str(available_space) in err_default or str(total_space) in err_default:
        if not auto_clear:
            if xbmcgui.Dialog().yesno(
                    'Auto Maintenance Error',
                    'Auto Maintenance encountered a problem and was not ran',
                    'Maintenace can still be done now or individually',
                    'Would you like to just clear the cache, packages, and thumbnails',
                    yeslabel='Yes',
                    nolabel='No'):
                delete_cache(auto_clear=True)
                delete_packages(auto_clear=True)
                delete_thumbnails(auto_clear=True)
                delete_crash_logs(auto_clear=True)
                xbmc.executebuiltin("Container.Refresh")
                xbmcgui.Dialog().ok(
                    AddonName, 'Auto Maintenance has been run successfully')
        return
    mb_settings = (0, 25, 50, 75, 100)
    for value in ('cachemb', 'thumbsmb', 'packagesmb'):
        available_space += mb_settings[int(kodi.get_setting(value))] * 10**6
    automb = kodi.get_setting("automb")
    cachemb = float(
        (mb_settings[int(kodi.get_setting("cachemb"))]) * 10**6)  # 35%
    for path in (cache_path, temp_path):
        if os.path.exists(path):
            try:
                if (automb and (cachemb >= float(available_space) * .35)) or \
                        ((cachemb == 0 and kodi.get_setting("accache") == 'true')
                         or (cachemb != 0 and (get_size(cache_path) >= int(cachemb)))):
                    delete_cache(auto_clear=True)
            except Exception as e:
                kodi.log(str(e))
    thumbsmb = float(
        (mb_settings[int(kodi.get_setting("thumbsmb"))]) * 10**6)  # 35%
    try:
        if (automb and (thumbsmb >= int(available_space) * .35)) or \
                ((thumbsmb == 0 and kodi.get_setting("acthumbs") == 'true')
                 or (thumbsmb != 0 and (get_size(thumbnail_path) >= int(thumbsmb)))):
            delete_thumbnails(auto_clear=True)
    except Exception as e:
        kodi.log(str(e))
    packagesmb = float(
        (mb_settings[int(kodi.get_setting("packagesmb"))]) * 10**6)  # 10%
    try:
        if (automb and (packagesmb >= int(available_space) * .10)) or \
                ((packagesmb == 0 and kodi.get_setting("acpackages") == 'true')
                 or (packagesmb != 0 and (get_size(packages_path) >= int(packagesmb)))):
            delete_packages(auto_clear=True)
    except Exception as e:
        kodi.log(str(e))
    if kodi.get_setting("accrash") == 'true':
        delete_crash_logs(auto_clear=True)

    if not auto_clear:
        xbmc.executebuiltin("Container.Refresh")
        xbmcgui.Dialog().ok(AddonName,
                            'Auto Maintenance has been run successfully')
Пример #30
0
import datetime
import os
import shutil
import sys
import re
import traceback
import xbmc
import xbmcgui
from libs import kodi
from libs import viewsetter

addon_id = kodi.addon_id
addon = (addon_id, sys.argv)
AddonName = kodi.addon.getAddonInfo('name') + " for Kodi"
artwork = kodi.translate_path(
    os.path.join('special://home', 'addons', addon_id, 'art/'))
fanart = artwork + 'fanart.jpg'
messages = kodi.translate_path(
    os.path.join('special://home', 'addons', addon_id, 'resources',
                 'messages/'))
execute = xbmc.executebuiltin
dp = xbmcgui.DialogProgress()
dialog = xbmcgui.Dialog()

userdata_path = kodi.translate_path('special://userdata/')
database_path = kodi.translate_path('special://userdata/Database')
addon_data = kodi.translate_path('special://userdata/addon_data')
thumbnail_path = kodi.translate_path('special://userdata/Thumbnails')
cache_path = os.path.join(kodi.translate_path('special://home'), 'cache')
temp_path = os.path.join(kodi.translate_path('special://home'), 'temp')
addons_path = os.path.join(kodi.translate_path('special://home'), 'addons')