def clear(table=None, withyes=True): try: control.idle() if table is None: table = ['rel_list', 'rel_lib'] elif not type(table) == list: table = [table] if withyes: yes = control.yesnoDialog(control.lang(30401).encode('utf-8'), '', '') if not yes: return else: pass dbcon = database.connect(control.cacheFile) dbcur = dbcon.cursor() for t in table: try: dbcur.execute("DROP TABLE IF EXISTS %s" % t) dbcur.execute("VACUUM") dbcon.commit() except: pass control.infoDialog('DONE!!!') except: pass
def clear(table=None, withyes=True): try: control.idle() if table == None: table = ['rel_list', 'rel_lib'] elif not type(table) == list: table = [table] if withyes: yes = control.yesnoDialog(control.lang(30401).encode('utf-8'), '', '') if not yes: return else: pass dbcon = database.connect(control.cacheFile) dbcur = dbcon.cursor() for t in table: try: dbcur.execute("DROP TABLE IF EXISTS %s" % t) dbcur.execute("VACUUM") dbcon.commit() except: pass control.infoDialog(control.lang(30402).encode('utf-8')) except: pass
def search_new(self): control.idle() t = control.lang(32010).encode('utf-8') k = control.keyboard('', t) k.doModal() q = k.getText() if k.isConfirmed() else None if (q == None or q == ''): return q = q.lower() try: from sqlite3 import dbapi2 as database except: from pysqlite2 import dbapi2 as database dbcon = database.connect(control.searchFile) dbcur = dbcon.cursor() dbcur.execute("DELETE FROM tvshow WHERE term = ?", (q, )) dbcur.execute("INSERT INTO tvshow VALUES (?,?)", (None, q)) dbcon.commit() dbcur.close() url = self.search_link + urllib.quote_plus(q) if int(control.getKodiVersion()) >= 18: self.get(url) else: url = '%s?mode=6&url=%s' % (sys.argv[0], urllib.quote_plus(url)) control.execute('Container.Update(%s)' % url)
def accountCheck(self): if traktCredentials == False and imdbCredentials == False: control.idle() control.infoDialog(control.lang(32042).encode('utf-8'), sound=True, icon='WARNING') sys.exit()
def views(self): try: control.idle() items = [(control.lang(32001).encode('utf-8'), 'movies'), (control.lang(32002).encode('utf-8'), 'tvshows'), (control.lang(32054).encode('utf-8'), 'seasons'), (control.lang(32038).encode('utf-8'), 'episodes')] select = control.selectDialog([i[0] for i in items], control.lang(32049).encode('utf-8')) if select == -1: return content = items[select][1] title = control.lang(32059).encode('utf-8') url = '%s?action=addView&content=%s' % (sys.argv[0], content) poster, banner, fanart = control.addonPoster( ), control.addonBanner(), control.addonFanart() item = control.item(label=title) item.setInfo(type='Video', infoLabels={'title': title}) item.setArt({ 'icon': poster, 'thumb': poster, 'poster': poster, 'banner': banner }) item.setProperty('Fanart_Image', fanart) control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False) control.content(int(sys.argv[1]), content) control.directory(int(sys.argv[1]), cacheToDisc=True) from resources.lib.modules import views views.setView(content, {}) except: return
def clearCacheAll(self): control.idle() yes = control.yesnoDialog(control.lang(32056).encode('utf-8'), '', '') if not yes: return from resources.lib.modules import cache cache.cache_clear_all() control.infoDialog(control.lang(32057).encode('utf-8'), sound=True, icon='INFO')
def clear(table=None): try: control.idle() if table == None: table = ['rel_list'] elif not type(table) == list: table = [table] dbcon = database.connect(control.cacheFile) dbcur = dbcon.cursor() for t in table: try: dbcur.execute("DROP TABLE IF EXISTS %s" % t) dbcur.execute("VACUUM") dbcon.commit() except: pass except: pass
def onPlayBackStarted(self): for i in range(0, 200): if control.condVisibility('Window.IsActive(busydialog)') == 1: control.idle() else: break control.sleep(100) if control.setting('playback_info') == 'true': elapsedTime = '%s %s %s' % (control.lang(30464).encode('utf-8'), int((time.time() - self.loadingTime)), control.lang(30465).encode('utf-8')) control.infoDialog(elapsedTime, heading=self.title) try: if self.offset == '0': raise Exception() self.seekTime(float(self.offset)) except Exception, e: print str(e) pass
def search_term(self, q): control.idle() q = q.lower() try: from sqlite3 import dbapi2 as database except: from pysqlite2 import dbapi2 as database dbcon = database.connect(control.searchFile) dbcur = dbcon.cursor() dbcur.execute("DELETE FROM tvshow WHERE term = ?", (q, )) dbcur.execute("INSERT INTO tvshow VALUES (?,?)", (None, q)) dbcon.commit() dbcur.close() url = self.search_link + urllib.quote_plus(q) if int(control.getKodiVersion()) >= 18: self.get(url) else: url = '%s?mode=tvshowPage&url=%s' % (sys.argv[0], urllib.quote_plus(url)) control.execute('Container.Update(%s)' % url)
def clear(table=None, notify=False): try: control.idle() if table == None: table = ['rel_list', 'rel_lib'] elif not type(table) == list: table = [table] yes = control.yesnoDialog("Are you sure?", '', '') if not yes: return dbcon = database.connect(control.cacheFile) dbcur = dbcon.cursor() for t in table: try: dbcur.execute("DROP TABLE IF EXISTS %s" % t) dbcur.execute("VACUUM") dbcon.commit() except: pass control.infoDialog("Process complete") except: pass
def clear(table=None,notify=False): try: control.idle() if table == None: table = ['rel_list', 'rel_lib'] elif not type(table) == list: table = [table] yes = control.yesnoDialog("Are you sure?", '', '') if not yes: return dbcon = database.connect(control.cacheFile) dbcur = dbcon.cursor() for t in table: try: dbcur.execute("DROP TABLE IF EXISTS %s" % t) dbcur.execute("VACUUM") dbcon.commit() except: pass control.infoDialog("Process complete") except: pass
def clearCacheSearch(self): control.idle() if control.yesnoDialog(control.lang(32056).encode('utf-8'), '', ''): control.setSetting('tvsearch', '') control.setSetting('moviesearch', '') control.refresh()