Refresh info by alpha index to avoid blocking

This commit is contained in:
warwickh
2021-10-04 12:46:10 +11:00
parent 607bb52158
commit f587d3d4d6
4 changed files with 50 additions and 35 deletions

View File

@ -1,5 +1,6 @@
import sqlite3 as sql
import time
import xbmc
tbl_artist_info_ddl = str('CREATE TABLE artist_info ('
'artist_id TEXT NOT NULL PRIMARY KEY,'
@ -23,24 +24,24 @@ class SQLiteDatabase(object):
def connect(self):
try:
#xbmc.log("Trying connection to the database %s"%self.db_filename, xbmc.LOGINFO)
print("Trying connection to the database %s"%self.db_filename)
xbmc.log("Trying connection to the database %s"%self.db_filename, xbmc.LOGINFO)
#print("Trying connection to the database %s"%self.db_filename)
self.conn = sql.connect(self.db_filename)
cursor = self.conn.cursor()
cursor.execute(str('SELECT SQLITE_VERSION()'))
#xbmc.log("Connection %s was successful %s"%(self.db_filename, cursor.fetchone()[0]), xbmc.LOGINFO)
print("Connection %s was successful %s"%(self.db_filename, cursor.fetchone()[0]))
xbmc.log("Connection %s was successful %s"%(self.db_filename, cursor.fetchone()[0]), xbmc.LOGINFO)
#print("Connection %s was successful %s"%(self.db_filename, cursor.fetchone()[0]))
cursor.row_factory = lambda cursor, row: row[0]
cursor.execute(str('SELECT name FROM sqlite_master WHERE type=\'table\' ''AND name NOT LIKE \'sqlite_%\''))
list_tables = cursor.fetchall()
if not list_tables:
# If no tables exist create a new one
#xbmc.log("Creating Subsonic local DB", xbmc.LOGINFO)
print("Creating Subsonic local DB")
xbmc.log("Creating Subsonic local DB", xbmc.LOGINFO)
#print("Creating Subsonic local DB")
cursor.execute(tbl_artist_info_ddl)
except sql.Error as e:
#xbmc.log("SQLite error %s"%e.args[0], xbmc.LOGINFO)
print("SQLite error %s"%e.args[0])
xbmc.log("SQLite error %s"%e.args[0], xbmc.LOGINFO)
#print("SQLite error %s"%e.args[0])
def get_cursor(self):
return self.conn.cursor()

View File

@ -2816,7 +2816,7 @@ class Connection(object):
req = urllib.request.Request(url, urlencode(qdict).encode('utf-8'))
if(self._useGET or ('getCoverArt' in viewName) or ('stream' in viewName)):
url += '?%s' % urlencode(qdict)
#xbmc.log("UseGET URL %s"%(url), xbmc.LOGDEBUG)
xbmc.log("UseGET URL %s"%(url), xbmc.LOGDEBUG)
#print(url)
req = urllib.request.Request(url)
return req