From 8c3764e8adab25d32cbe3a661d66fac2d7b4ffa4 Mon Sep 17 00:00:00 2001 From: croneter Date: Mon, 29 Oct 2018 13:21:35 +0100 Subject: [PATCH] Fix OperationalError: no such table: artist --- resources/lib/itemtypes/music.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/resources/lib/itemtypes/music.py b/resources/lib/itemtypes/music.py index de1e3c6b..286fe323 100644 --- a/resources/lib/itemtypes/music.py +++ b/resources/lib/itemtypes/music.py @@ -5,6 +5,8 @@ from logging import getLogger from .common import ItemBase from ..plex_api import API +from ..plex_db import PlexDB +from .. import kodidb_functions as kodidb from .. import plex_functions as PF, utils, state, variables as v LOG = getLogger('PLEX.music') @@ -130,6 +132,18 @@ class Artist(ItemBase, MusicMixin): """ For Plex library-type artists """ + def __enter__(self): + """ + Open DB connections and cursors + """ + self.plexconn = utils.kodi_sql('plex') + self.plexcursor = self.plexconn.cursor() + self.kodiconn = utils.kodi_sql('music') + self.kodicursor = self.kodiconn.cursor() + self.plexdb = PlexDB(self.plexcursor) + self.kodi_db = kodidb.KodiDBMethods(self.kodicursor) + return self + def add_update(self, xml, section_name=None, section_id=None, children=None): """