Fix OperationalError when trying to wipe empty Plex DB
This commit is contained in:
parent
a5ce8e0a93
commit
009fc9937a
1 changed files with 15 additions and 10 deletions
|
@ -526,6 +526,7 @@ def wipe_database():
|
||||||
from . import plex_db
|
from . import plex_db
|
||||||
# First get the paths to all synced playlists
|
# First get the paths to all synced playlists
|
||||||
playlist_paths = []
|
playlist_paths = []
|
||||||
|
try:
|
||||||
with plex_db.PlexDB() as plexdb:
|
with plex_db.PlexDB() as plexdb:
|
||||||
if plexdb.songs_have_been_synced():
|
if plexdb.songs_have_been_synced():
|
||||||
LOG.info('Detected that music has also been synced - wiping music')
|
LOG.info('Detected that music has also been synced - wiping music')
|
||||||
|
@ -536,6 +537,10 @@ def wipe_database():
|
||||||
plexdb.cursor.execute('SELECT kodi_path FROM playlists')
|
plexdb.cursor.execute('SELECT kodi_path FROM playlists')
|
||||||
for entry in plexdb.cursor:
|
for entry in plexdb.cursor:
|
||||||
playlist_paths.append(entry[0])
|
playlist_paths.append(entry[0])
|
||||||
|
except OperationalError:
|
||||||
|
# Plex DB completely empty yet. Wipe existing Kodi music only if we
|
||||||
|
# expect to sync Plex music
|
||||||
|
music = settings('enableMusic') == 'true'
|
||||||
kodidb_functions.wipe_dbs(music)
|
kodidb_functions.wipe_dbs(music)
|
||||||
plex_db.wipe()
|
plex_db.wipe()
|
||||||
plex_db.initialize()
|
plex_db.initialize()
|
||||||
|
|
Loading…
Reference in a new issue