Merge pull request #1082 from croneter/fix-operationalerror

Fix OperationalError when starting with a fresh PKC installation
This commit is contained in:
croneter 2019-12-08 16:48:27 +01:00 committed by GitHub
commit baa33f19b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,6 +13,7 @@
""" """
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from sqlite3 import OperationalError
from .common import Playlist, PlaylistError, PlaylistObserver, \ from .common import Playlist, PlaylistError, PlaylistObserver, \
kodi_playlist_hash kodi_playlist_hash
@ -74,7 +75,11 @@ def remove_synced_playlists():
""" """
LOG.info('Removing all playlists that we synced to Kodi') LOG.info('Removing all playlists that we synced to Kodi')
with app.APP.lock_playlists: with app.APP.lock_playlists:
paths = db.get_all_kodi_playlist_paths() try:
paths = db.get_all_kodi_playlist_paths()
except OperationalError:
LOG.info('Playlists table has not yet been set-up')
return
kodi_pl.delete_kodi_playlists(paths) kodi_pl.delete_kodi_playlists(paths)
db.wipe_table() db.wipe_table()
LOG.info('Done removing all synced playlists') LOG.info('Done removing all synced playlists')