Merge pull request #462 from mcarlton00/matrix-stuff

Fixes for Matrix-RC2
This commit is contained in:
Odd Stråbø 2021-01-29 00:02:56 +01:00 committed by GitHub
commit 33c2926732
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 4 deletions

View file

@ -99,7 +99,7 @@ class LoginManual(xbmcgui.WindowXMLDialog):
def _add_editcontrol(self, x, y, height, width, password=False): def _add_editcontrol(self, x, y, height, width, password=False):
kwargs = dict( kwargs = dict(
label="User", label="",
font="font13", font="font13",
textColor="FF00A4DC", textColor="FF00A4DC",
disabledColor="FF888888", disabledColor="FF888888",

View file

@ -98,7 +98,7 @@ class ServerManual(xbmcgui.WindowXMLDialog):
def _add_editcontrol(self, x, y, height, width): def _add_editcontrol(self, x, y, height, width):
control = xbmcgui.ControlEdit(0, 0, 0, 0, control = xbmcgui.ControlEdit(0, 0, 0, 0,
label="User", label="",
font="font13", font="font13",
textColor="FF00A4DC", textColor="FF00A4DC",
disabledColor="FF888888", disabledColor="FF888888",

View file

@ -5,6 +5,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
import threading import threading
import sys import sys
import json
from datetime import timedelta from datetime import timedelta
from kodi_six import xbmc, xbmcgui, xbmcplugin, xbmcaddon from kodi_six import xbmc, xbmcgui, xbmcplugin, xbmcaddon
@ -13,6 +14,7 @@ import database
from helper import translate, playutils, api, window, settings, dialog from helper import translate, playutils, api, window, settings, dialog
from dialogs import resume from dialogs import resume
from helper import LazyLogger from helper import LazyLogger
from jellyfin import Jellyfin
from .obj import Objects from .obj import Objects
@ -28,8 +30,26 @@ class Actions(object):
def __init__(self, server_id=None, api_client=None): def __init__(self, server_id=None, api_client=None):
self.server_id = server_id or 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.api_client = api_client
self.server = self.api_client.config.data['auth.server'] self.server = self.api_client.config.data['auth.server']
self.stack = [] self.stack = []
def get_playlist(self, item): def get_playlist(self, item):

View file

@ -88,7 +88,12 @@ class Music(Kodi):
self.cursor.execute(QU.update_artist_name, args) self.cursor.execute(QU.update_artist_name, args)
def update(self, *args): def update(self, *args):
self.cursor.execute(QU.update_artist, args) if self.version_id < 74:
self.cursor.execute(QU.update_artist74, args)
else:
# No field for backdrops in Kodi 19, so we need to omit that here
args = args[:3] + args[4:]
self.cursor.execute(QU.update_artist82, args)
def link(self, *args): def link(self, *args):
self.cursor.execute(QU.update_link, args) self.cursor.execute(QU.update_link, args)

View file

@ -154,11 +154,16 @@ SET strArtist = ?
WHERE idArtist = ? WHERE idArtist = ?
""" """
update_artist_name_obj = ["{Name}", "{ArtistId}"] update_artist_name_obj = ["{Name}", "{ArtistId}"]
update_artist = """ update_artist74 = """
UPDATE artist UPDATE artist
SET strGenres = ?, strBiography = ?, strImage = ?, strFanart = ?, lastScraped = ? SET strGenres = ?, strBiography = ?, strImage = ?, strFanart = ?, lastScraped = ?
WHERE idArtist = ? WHERE idArtist = ?
""" """
update_artist82 = """
UPDATE artist
SET strGenres = ?, strBiography = ?, strImage = ?, lastScraped = ?
WHERE idArtist = ?
"""
update_link = """ update_link = """
INSERT OR REPLACE INTO album_artist(idArtist, idAlbum, strArtist) INSERT OR REPLACE INTO album_artist(idArtist, idAlbum, strArtist)
VALUES (?, ?, ?) VALUES (?, ?, ?)