def get_installed_resources(): global search_path import os main = kodi.vfs.join(os.path.dirname(os.path.abspath(__file__)), 'scrapers') results = [{ 'path': main, 'name': 'ScrapeCore', 'addonid': 'script.module.scrapecore' }] test_path = kodi.vfs.join(kodi.get_path(), 'resources/scrapers/') if kodi.vfs.exists(test_path): results += [{ 'path': kodi.vfs.join(kodi.get_path(), 'resources'), 'name': kodi.get_name(), 'addonid': kodi.get_id() }] temp = kodi.kodi_json_request( "Addons.GetAddons", { "installed": True, 'type': 'kodi.resource.images', "properties": ["path", "name"] }) for a in temp['result']['addons']: if a['type'] == 'kodi.resource.images' and a['addonid'].startswith( 'resource.scrapecore.'): del a['type'] results.append(a) return results
def about(): try: import xbmc KODI_LANGUAGE = xbmc.getLanguage() except: KODI_LANGUAGE = 'English' path = kodi.vfs.join(kodi.get_path(), 'resources/language/%s/github_help.txt', KODI_LANGUAGE) if not kodi.vfs.exists(path): path = kodi.vfs.join(kodi.get_path(), 'resources/language/English/github_help.txt') text = kodi.vfs.read_file(path) kodi.dialog_textbox('GitHub Browser Instructions', text)
def __init__(self, *args, **kwargs): self.ftp_root = kodi.vfs.translate_path( kodi.get_setting('root_directory')) self.ftp_log = kodi.vfs.join(kodi.get_profile(), "pyftpd.log") self.cert_file = vfs.join(kodi.get_profile(), "pyftpd.pem") if not vfs.exists(self.cert_file): vfs.cp(vfs.join(kodi.get_path(), "pyftpd.pem"), self.cert_file)
def _initialize(self): self.connect() schema_file = kodi.vfs.join(kodi.get_path(), 'resources/database/schema.%s.sql' % self.db_type) if self.run_script(schema_file, commit=False): self.execute('DELETE FROM version', quiet=True) self.execute('INSERT INTO version(db_version) VALUES(?)', [self.db_version], quiet=True) self.commit() self.disconnect()
def show_about(): if kodi.get_setting('disable_about') == 'true': return interval = int(kodi.get_setting('last_about')) if interval == 0: interval = 5 try: import xbmc KODI_LANGUAGE = xbmc.getLanguage() except: KODI_LANGUAGE = 'English' path = kodi.vfs.join(kodi.get_path(), 'resources/language/%s/github_help.txt', KODI_LANGUAGE) if not kodi.vfs.exists(path): path = kodi.vfs.join(kodi.get_path(), 'resources/language/English/github_help.txt') text = kodi.vfs.read_file(path) kodi.dialog_textbox('GitHub Browser Instructions', text) else: interval -= 1 kodi.set_setting('last_about', interval)
def _initialize(self): self.connect() schema_file = kodi.vfs.join( kodi.get_path(), 'resources/database/schema.%s.sql' % self.db_type) if self.run_script(schema_file, commit=False): self.execute('DELETE FROM version', quiet=True) self.execute('INSERT INTO version(db_version) VALUES(?)', [self.db_version], quiet=True) self.commit() self.disconnect()
def start(self): class Monitor(xbmc.Monitor): def onSettingsChanged(self): pass monitor = Monitor() kodi.log("Service Starting...") self.clear_art() if kodi.get_setting('enable_fanart_proxy') == 'true': CONTROL_PORT = int(kodi.get_setting('control_port')) if kodi.get_setting('network_bind') == 'Localhost': address = "127.0.0.1" else: address = "0.0.0.0" CONTROL_PROTO = kodi.get_setting('control_protocol') kodi.log("Launching Fanart WebInterface on: %s://%s:%s" % (CONTROL_PROTO, address, CONTROL_PORT)) kodi.log("Verify at: %s://%s:%s/api/up" % (CONTROL_PROTO, address, CONTROL_PORT)) try: if CONTROL_PROTO == 'https': from commoncore.webservice import HttpsServer certfile = kodi.vfs.join(kodi.get_path(), "resources/server.pem") self.httpd = HttpsServer(address, CONTROL_PORT, certfile, RequestHandler) self.webserver = Thread(target=self.httpd.serve_forever) else: from commoncore.webservice import HttpServer self.httpd = HttpServer(address, CONTROL_PORT, RequestHandler) self.webserver = Thread(target=self.httpd.serve_forever) except Exception, e: kodi.log(e) kodi.raise_error("Service Error: ", str(e)) sys.exit() self.webserver.start()
import hashlib import datetime from os import curdir, sep from urlparse import urlparse from BaseHTTPServer import BaseHTTPRequestHandler from commoncore import kodi from commoncore import core from commoncore import fanart from commoncore import trakt from commoncore.dispatcher import FunctionDispatcher HOST_ADDRESS = socket.gethostname() LOG_FILE = kodi.vfs.join(kodi.get_profile(), 'access.log') BAD_FILE = kodi.vfs.join(kodi.get_profile(), 'badart.log') kodi.log("Setting Fanart API Access log to: %s" % LOG_FILE) DEFAULT_POSTER = kodi.vfs.join(kodi.get_path(), 'resources/artwork/no_poster.jpg') DEFAULT_SCREENSHOT = kodi.vfs.join(kodi.get_path(), 'resources/artwork/no_screenshot.jpg') DEFAULT_FANART = kodi.vfs.join(kodi.get_path(), 'resources/artwork/no_fanart.jpg') DEFAULT_PERSON = kodi.vfs.join(kodi.get_path(), 'resources/artwork/no_person.jpg') client_host = '127.0.0.1' client_port = kodi.get_setting('control_port', 'service.fanart.proxy') client_protocol = kodi.get_setting('control_protocol', 'service.fanart.proxy') BASE_FANART_URL = '%s://%s:%s' % (client_protocol, client_host, client_port) def get_crc32(string): string = string.lower()