# Buggy code
def __init__(self, server_id=None, api_client=None):
    self.server_id = server_id or None
    self.api_client = api_client
    self.server = self.api_client.config.data["auth.server"]
    self.stack = []


# Traceback (sqlite3.OperationalError)
2020-11-20 11:12:04.823 T:29417    INFO <general>: JELLYFIN.database -> ERROR::jellyfin_kodi/database/__init__.py:163 type: <class 'sqlite3.OperationalError'> value: no such column: strFanart
2020-11-20 11:12:04.839 T:29417    INFO <general>: JELLYFIN.database -> ERROR::jellyfin_kodi/database/__init__.py:163 type: <class 'sqlite3.OperationalError'> value: no such column: strFanart
2020-11-20 11:12:04.852 T:29246    INFO <general>: Loading skin file: DialogConfirm.xml, load type: KEEP_IN_MEMORY
2020-11-20 11:12:13.154 T:29417    INFO <general>: JELLYFIN.full_sync -> ERROR::jellyfin_kodi/full_sync.py:257 full sync exited unexpectedly
2020-11-20 11:12:13.190 T:29417    INFO <general>: JELLYFIN.full_sync -> ERROR::jellyfin_kodi/full_sync.py:258 no such column: strFanart
Traceback (most recent call last):
File "jellyfin_kodi/full_sync.py", line 243, in process_library
media[library['CollectionType']](library)
File "jellyfin_kodi/helper/wrapper.py", line 41, in wrapper
result = func(self, dialog=dialog, *args, **kwargs)
File "jellyfin_kodi/full_sync.py", line 436, in music
obj.artist(item)
File "jellyfin_kodi/helper/wrapper.py", line 65, in wrapper
return func(*args, **kwargs)
File "jellyfin_kodi/helper/wrapper.py", line 77, in wrapper
return func(self, item, e_item=e_item, *args, **kwargs)
File "jellyfin_kodi/objects/music.py", line 93, in artist
self.update(obj['Genre'], obj['Bio'], obj['Thumb'], obj['Backdrops'], obj['LastScraped'], obj['ArtistId'])
File "jellyfin_kodi/objects/kodi/music.py", line 91, in update
self.cursor.execute(QU.update_artist, args)
sqlite3.OperationalError: no such column: strFanart

2020-11-20 11:12:13.203 T:29417    INFO <general>: JELLYFIN.full_sync -> INFO::jellyfin_kodi/full_sync.py:586 --<[ fullsync ]
2020-11-20 11:12:13.212 T:29417    INFO <general>: JELLYFIN.library -> ERROR::jellyfin_kodi/library.py:367 no such column: strFanart
Traceback (most recent call last):
File "jellyfin_kodi/library.py", line 324, in startup
sync.libraries()
File "jellyfin_kodi/full_sync.py", line 101, in libraries
self.start()
File "jellyfin_kodi/full_sync.py", line 186, in start
self.process_library(library)
File "jellyfin_kodi/full_sync.py", line 243, in process_library
media[library['CollectionType']](library)
File "jellyfin_kodi/helper/wrapper.py", line 41, in wrapper
result = func(self, dialog=dialog, *args, **kwargs)
File "jellyfin_kodi/full_sync.py", line 436, in music
obj.artist(item)
File "jellyfin_kodi/helper/wrapper.py", line 65, in wrapper
return func(*args, **kwargs)
File "jellyfin_kodi/helper/wrapper.py", line 77, in wrapper
return func(self, item, e_item=e_item, *args, **kwargs)
File "jellyfin_kodi/objects/music.py", line 93, in artist
self.update(obj['Genre'], obj['Bio'], obj['Thumb'], obj['Backdrops'], obj['LastScraped'], obj['ArtistId'])
File "jellyfin_kodi/objects/kodi/music.py", line 91, in update
self.cursor.execute(QU.update_artist, args)
sqlite3.OperationalError: no such column: strFanart

# Fixed code
def __init__(self, server_id=None, api_client=None):
    self.server_id = server_id or None
    if not api_client:
        LOG.debug("No api client provided, attempting to use config file")
        jellyfin_client = Jellyfin(server_id).get_client()
        api_client = jellyfin_client.jellyfin
        addon_data = xbmc.translatePath(
            "special://profile/addon_data/plugin.video.jellyfin/data.json"
        )
        try:
            with open(addon_data, "rb") as infile:
                data = json.load(infile)

                server_data = data["Servers"][0]
                api_client.config.data["auth.server"] = server_data.get("address")
                api_client.config.data["auth.server-name"] = server_data.get("Name")
                api_client.config.data["auth.user_id"] = server_data.get("UserId")
                api_client.config.data["auth.token"] = server_data.get("AccessToken")
        except Exception as e:
            LOG.warning("Addon appears to not be configured yet: {}".format(e))

    self.api_client = api_client
    self.server = self.api_client.config.data["auth.server"]

    self.stack = []