Ejemplo n.º 1
0
    def searchNew(self):

        control.busy()

        t = control.lang(32010).encode('utf-8')
        k = control.keyboard('', t)
        k.doModal()
        q = k.getText()

        if (q == None or q == ''): return

        try:
            from sqlite3 import dbapi2 as database
        except:
            from pysqlite2 import dbapi2 as database

        dbcon = database.connect(control.searchFile)
        dbcur = dbcon.cursor()
        dbcur.execute("INSERT INTO search VALUES (?,?)", (None, q))
        dbcon.commit()
        dbcur.close()

        list = cache.get(scraper().search, 24, q)

        self.list_builder(list)

        control.idle()

        self.createDirectory(sort=False)
Ejemplo n.º 2
0
def cache_version_check():

    if _find_cache_version():
        cache_clear()
        cache_clear_meta()
        cache_clear_providers()
        control.infoDialog(control.lang(32057).encode('utf-8'),
                           sound=True,
                           icon='INFO')
Ejemplo n.º 3
0
def download(name, image, url, dest=addon.getSetting('download_path')):
    try:
        xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
        import lib.control as control

        if url == None:
            return control.infoDialog(control.lang(30501).encode('utf-8'))
        headers = ("Authorization",
                   "Bearer " + str(xbmcaddon.Addon().getSetting('rd_access')))
        url = url.split('|')[0]

        content = re.compile('(.+?)\sS(\d*)E\d*$').findall(name)
        transname = name.translate('\/:*?"<>|').strip('.')
        levels = ['../../../..', '../../..', '../..', '..']

        dest = control.translatePath(dest)
        for level in levels:
            try:
                control.makeFile(os.path.abspath(os.path.join(dest, level)))
            except:
                pass
        control.makeFile(dest)
        dest = os.path.join(dest, os.path.splitext(transname)[0])

        control.makeFile(dest)
        dest = os.path.join(dest, transname)

        sysheaders = quote_plus(json.dumps(headers))

        sysurl = quote_plus(url)

        systitle = quote_plus(name)

        sysimage = quote_plus(image)

        sysdest = quote_plus(dest)

        script = inspect.getfile(inspect.currentframe())
        cmd = 'RunScript(%s, %s, %s, %s, %s, %s)' % (
            script, sysurl, sysdest, systitle, sysimage, sysheaders)

        xbmc.executebuiltin(cmd)

        xbmc.executebuiltin("Dialog.Close(busydialognocancel)")
    except:
        xbmc.executebuiltin("Dialog.Close(busydialognocancel)")
        util.notify(ADDON_ID, "Error Downloading")