mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
Make sure emby tables exists before proceeding
This commit is contained in:
parent
071a4bde9b
commit
6db7972301
1 changed files with 20 additions and 14 deletions
|
@ -232,20 +232,6 @@ class LibrarySync(threading.Thread):
|
||||||
# Add sources
|
# Add sources
|
||||||
utils.sourcesXML()
|
utils.sourcesXML()
|
||||||
|
|
||||||
embyconn = utils.kodiSQL('emby')
|
|
||||||
embycursor = embyconn.cursor()
|
|
||||||
# Create the tables for the emby database
|
|
||||||
# emby, view, version
|
|
||||||
embycursor.execute(
|
|
||||||
"""CREATE TABLE IF NOT EXISTS emby(
|
|
||||||
emby_id TEXT UNIQUE, media_folder TEXT, emby_type TEXT, media_type TEXT, kodi_id INTEGER,
|
|
||||||
kodi_fileid INTEGER, kodi_pathid INTEGER, parent_id INTEGER, checksum INTEGER)""")
|
|
||||||
embycursor.execute(
|
|
||||||
"""CREATE TABLE IF NOT EXISTS view(
|
|
||||||
view_id TEXT UNIQUE, view_name TEXT, media_type TEXT, kodi_tagid INTEGER)""")
|
|
||||||
embycursor.execute("CREATE TABLE IF NOT EXISTS version(idVersion TEXT)")
|
|
||||||
embyconn.commit()
|
|
||||||
|
|
||||||
# content sync: movies, tvshows, musicvideos, music
|
# content sync: movies, tvshows, musicvideos, music
|
||||||
kodiconn = utils.kodiSQL('video')
|
kodiconn = utils.kodiSQL('video')
|
||||||
kodicursor = kodiconn.cursor()
|
kodicursor = kodiconn.cursor()
|
||||||
|
@ -854,6 +840,23 @@ class LibrarySync(threading.Thread):
|
||||||
# Database out of date.
|
# Database out of date.
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _verify_emby_database(cls):
|
||||||
|
# Create the tables for the emby database
|
||||||
|
conn = utils.kodiSQL('emby')
|
||||||
|
cursor = conn.cursor()
|
||||||
|
# emby, view, version
|
||||||
|
cursor.execute(
|
||||||
|
"""CREATE TABLE IF NOT EXISTS emby(
|
||||||
|
emby_id TEXT UNIQUE, media_folder TEXT, emby_type TEXT, media_type TEXT,
|
||||||
|
kodi_id INTEGER, kodi_fileid INTEGER, kodi_pathid INTEGER, parent_id INTEGER,
|
||||||
|
checksum INTEGER)""")
|
||||||
|
cursor.execute(
|
||||||
|
"""CREATE TABLE IF NOT EXISTS view(
|
||||||
|
view_id TEXT UNIQUE, view_name TEXT, media_type TEXT, kodi_tagid INTEGER)""")
|
||||||
|
cursor.execute("CREATE TABLE IF NOT EXISTS version(idVersion TEXT)")
|
||||||
|
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -885,6 +888,9 @@ class LibrarySync(threading.Thread):
|
||||||
|
|
||||||
log.warn("---===### Starting LibrarySync ###===---")
|
log.warn("---===### Starting LibrarySync ###===---")
|
||||||
|
|
||||||
|
# Verify database structure, otherwise create it.
|
||||||
|
self._verify_emby_database()
|
||||||
|
|
||||||
while not self.monitor.abortRequested():
|
while not self.monitor.abortRequested():
|
||||||
|
|
||||||
# In the event the server goes offline
|
# In the event the server goes offline
|
||||||
|
|
Loading…
Reference in a new issue