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,16 +526,21 @@ 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 = []
|
||||||
with plex_db.PlexDB() as plexdb:
|
try:
|
||||||
if plexdb.songs_have_been_synced():
|
with plex_db.PlexDB() as plexdb:
|
||||||
LOG.info('Detected that music has also been synced - wiping music')
|
if plexdb.songs_have_been_synced():
|
||||||
music = True
|
LOG.info('Detected that music has also been synced - wiping music')
|
||||||
else:
|
music = True
|
||||||
LOG.info('No music has been synced in the past - not wiping')
|
else:
|
||||||
music = False
|
LOG.info('No music has been synced in the past - not wiping')
|
||||||
plexdb.cursor.execute('SELECT kodi_path FROM playlists')
|
music = False
|
||||||
for entry in plexdb.cursor:
|
plexdb.cursor.execute('SELECT kodi_path FROM playlists')
|
||||||
playlist_paths.append(entry[0])
|
for entry in plexdb.cursor:
|
||||||
|
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