Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Matrix-RC2 #462

Merged
merged 4 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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