Index Kodi database actor names to speed up sync
This commit is contained in:
parent
e4de57c753
commit
f02bb4a873
2 changed files with 23 additions and 1 deletions
|
@ -15,7 +15,7 @@ from utils import window, settings, getUnixTimestamp, kodiSQL, sourcesXML,\
|
|||
ThreadMethods, ThreadMethodsAdditionalStop, LogTime, getScreensaver,\
|
||||
setScreensaver, playlistXSP, language as lang, DateToKodi, reset,\
|
||||
advancedSettingsXML, getKodiVideoDBPath, tryDecode, deletePlaylists,\
|
||||
deleteNodes, ThreadMethodsAdditionalSuspend
|
||||
deleteNodes, ThreadMethodsAdditionalSuspend, create_actor_db_index
|
||||
import clientinfo
|
||||
import downloadutils
|
||||
import itemtypes
|
||||
|
@ -558,6 +558,9 @@ class LibrarySync(Thread):
|
|||
# content sync: movies, tvshows, musicvideos, music
|
||||
embyconn.close()
|
||||
|
||||
# Create an index for actors to speed up sync
|
||||
create_actor_db_index()
|
||||
|
||||
@LogTime
|
||||
def fullSync(self, repair=False):
|
||||
"""
|
||||
|
|
|
@ -229,6 +229,25 @@ def getKodiVideoDBPath():
|
|||
% dbVersion.get(xbmc.getInfoLabel('System.BuildVersion')[:2], "")))
|
||||
return dbPath
|
||||
|
||||
|
||||
def create_actor_db_index():
|
||||
"""
|
||||
Index the "actors" because we got a TON - speed up SELECT and WHEN
|
||||
"""
|
||||
conn = kodiSQL('video')
|
||||
cursor = conn.cursor()
|
||||
try:
|
||||
cursor.execute("""
|
||||
CREATE UNIQUE INDEX index_name
|
||||
ON actor (name);
|
||||
""")
|
||||
except sqlite3.OperationalError:
|
||||
# Index already exists
|
||||
pass
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
|
||||
def getKodiMusicDBPath():
|
||||
|
||||
dbVersion = {
|
||||
|
|
Loading…
Reference in a new issue