From 80181873d1e6a2b7b3762d9ba03e484afd30fd88 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 8 Dec 2019 16:41:43 +0100 Subject: [PATCH] Fix OperationalError when starting with a fresh PKC installation --- resources/lib/playlists/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/lib/playlists/__init__.py b/resources/lib/playlists/__init__.py index 7463557d..1e2ff6bc 100644 --- a/resources/lib/playlists/__init__.py +++ b/resources/lib/playlists/__init__.py @@ -13,6 +13,7 @@ """ from __future__ import absolute_import, division, unicode_literals from logging import getLogger +from sqlite3 import OperationalError from .common import Playlist, PlaylistError, PlaylistObserver, \ kodi_playlist_hash @@ -74,7 +75,11 @@ def remove_synced_playlists(): """ LOG.info('Removing all playlists that we synced to Kodi') 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) db.wipe_table() LOG.info('Done removing all synced playlists')