Skip to content

Commit

Permalink
Merge pull request #462 from mcarlton00/matrix-stuff
Browse files Browse the repository at this point in the history
Fixes for Matrix-RC2
  • Loading branch information
oddstr13 committed Jan 28, 2021
2 parents e25e7a3 + 0aa2e71 commit 33c2926
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jellyfin_kodi/dialogs/loginmanual.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def onAction(self, action):
def _add_editcontrol(self, x, y, height, width, password=False):

kwargs = dict(
label="User",
label="",
font="font13",
textColor="FF00A4DC",
disabledColor="FF888888",
Expand Down
2 changes: 1 addition & 1 deletion jellyfin_kodi/dialogs/servermanual.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def onAction(self, action):
def _add_editcontrol(self, x, y, height, width):

control = xbmcgui.ControlEdit(0, 0, 0, 0,
label="User",
label="",
font="font13",
textColor="FF00A4DC",
disabledColor="FF888888",
Expand Down
20 changes: 20 additions & 0 deletions jellyfin_kodi/objects/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import threading
import sys
import json
from datetime import timedelta

from kodi_six import xbmc, xbmcgui, xbmcplugin, xbmcaddon
Expand All @@ -13,6 +14,7 @@
from helper import translate, playutils, api, window, settings, dialog
from dialogs import resume
from helper import LazyLogger
from jellyfin import Jellyfin

from .obj import Objects

Expand All @@ -28,8 +30,26 @@ class Actions(object):
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 = []

def get_playlist(self, item):
Expand Down
7 changes: 6 additions & 1 deletion jellyfin_kodi/objects/kodi/music.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ def update_artist_name(self, *args):
self.cursor.execute(QU.update_artist_name, 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):
self.cursor.execute(QU.update_link, args)
Expand Down
7 changes: 6 additions & 1 deletion jellyfin_kodi/objects/kodi/queries_music.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,16 @@
WHERE idArtist = ?
"""
update_artist_name_obj = ["{Name}", "{ArtistId}"]
update_artist = """
update_artist74 = """
UPDATE artist
SET strGenres = ?, strBiography = ?, strImage = ?, strFanart = ?, lastScraped = ?
WHERE idArtist = ?
"""
update_artist82 = """
UPDATE artist
SET strGenres = ?, strBiography = ?, strImage = ?, lastScraped = ?
WHERE idArtist = ?
"""
update_link = """
INSERT OR REPLACE INTO album_artist(idArtist, idAlbum, strArtist)
VALUES (?, ?, ?)
Expand Down

0 comments on commit 33c2926

Please sign in to comment.