diff --git a/jellyfin_kodi/dialogs/usersconnect.py b/jellyfin_kodi/dialogs/usersconnect.py index 023f85be..84faf4e2 100644 --- a/jellyfin_kodi/dialogs/usersconnect.py +++ b/jellyfin_kodi/dialogs/usersconnect.py @@ -61,10 +61,7 @@ class UsersConnect(xbmcgui.WindowXMLDialog): item = xbmcgui.ListItem(label) item.setProperty('id', user_id) - if self.kodi_version > 15: - item.setArt({'Icon': user_image}) - else: - item.setIconImage(user_image) + item.setArt({'icon': user_image}) return item diff --git a/jellyfin_kodi/entrypoint/default.py b/jellyfin_kodi/entrypoint/default.py index c19bcbb8..760601ce 100644 --- a/jellyfin_kodi/entrypoint/default.py +++ b/jellyfin_kodi/entrypoint/default.py @@ -3,11 +3,11 @@ from __future__ import division, absolute_import, print_function, unicode_litera ################################################################################################# -import json import logging import sys import os +from six import iteritems from six.moves.urllib.parse import parse_qsl, urlencode from kodi_six import xbmc, xbmcvfs, xbmcgui, xbmcplugin, xbmcaddon @@ -206,9 +206,11 @@ def dir_listitem(label, path, artwork=None, fanart=None): ''' Gets the icon paths for default node listings ''' li = xbmcgui.ListItem(label, path=path) - li.setThumbnailImage(artwork or "special://home/addons/plugin.video.jellyfin/resources/icon.png") - li.setArt({"fanart": fanart or "special://home/addons/plugin.video.jellyfin/resources/fanart.png"}) - li.setArt({"landscape": artwork or fanart or "special://home/addons/plugin.video.jellyfin/resources/fanart.png"}) + li.setArt({ + "thumb": artwork or "special://home/addons/plugin.video.jellyfin/resources/icon.png", + "fanart": fanart or "special://home/addons/plugin.video.jellyfin/resources/fanart.png", + "landscape": artwork or fanart or "special://home/addons/plugin.video.jellyfin/resources/fanart.png", + }) return li @@ -712,12 +714,10 @@ def create_listitem(item): li.setProperty('resumetime', str(item['resume']['position'])) li.setProperty('totaltime', str(item['resume']['total'])) li.setArt(item['art']) - li.setThumbnailImage(item['art'].get('thumb', '')) - li.setIconImage('DefaultTVShows.png') li.setProperty('dbid', str(item['episodeid'])) li.setProperty('fanart_image', item['art'].get('tvshow.fanart', '')) - for key, value in item['streamdetails'].iteritems(): + for key, value in iteritems(item['streamdetails']): for stream in value: li.addStreamInfo(key, stream) diff --git a/jellyfin_kodi/helper/utils.py b/jellyfin_kodi/helper/utils.py index c62f0127..37ff8ba0 100644 --- a/jellyfin_kodi/helper/utils.py +++ b/jellyfin_kodi/helper/utils.py @@ -460,6 +460,7 @@ def has_attribute(obj, name): except AttributeError: return False + def set_addon_mode(): ''' Setup playback mode. If native mode selected, check network credentials. diff --git a/jellyfin_kodi/jellyfin/api.py b/jellyfin_kodi/jellyfin/api.py index fafa62be..238a2787 100644 --- a/jellyfin_kodi/jellyfin/api.py +++ b/jellyfin_kodi/jellyfin/api.py @@ -388,7 +388,6 @@ class API(object): return request_method(url, **request_settings) - def login(self, server_url, username, password=""): path = "Users/AuthenticateByName" authData = { @@ -411,7 +410,7 @@ class API(object): LOG.debug(headers) return {} - except Exception as e: # Find exceptions for likely cases i.e, server timeout, etc + except Exception as e: # Find exceptions for likely cases i.e, server timeout, etc LOG.error(e) return {} @@ -432,7 +431,7 @@ class API(object): response = self.send_request(server_address, "system/info/public") try: return response.json() if response.status_code == 200 else {} - except JSONDecodeError as e: + except json.JSONDecodeError as e: LOG.error("Failed to get server public info. JSON error: %s" % e) LOG.error(response.content) return {} @@ -444,4 +443,3 @@ class API(object): response = self.send_request(server_address, "system/info/public") url = response.url.replace('/system/info/public', '') return url - diff --git a/jellyfin_kodi/objects/actions.py b/jellyfin_kodi/objects/actions.py index f3d673c3..01d3a857 100644 --- a/jellyfin_kodi/objects/actions.py +++ b/jellyfin_kodi/objects/actions.py @@ -325,8 +325,10 @@ class Actions(object): if intro or obj['Type'] == 'Trailer': listitem.setArt({'poster': ""}) # Clear the poster value for intros / trailers to prevent issues in skins - listitem.setIconImage('DefaultVideo.png') - listitem.setThumbnailImage(obj['Artwork']['Primary']) + listitem.setArt({ + 'icon': 'DefaultVideo.png', + 'thumb': obj['Artwork']['Primary'], + }) if obj['Premiere']: obj['Premiere'] = obj['Premiere'].split('T')[0] @@ -487,12 +489,17 @@ class Actions(object): 'playcount': obj['PlayCount'], 'overlay': obj['Overlay'] } - listitem.setIconImage(obj['Artwork']['Thumb']) - listitem.setThumbnailImage(obj['Artwork']['Primary']) + + listitem.setArt({ + 'icon': obj['Artwork']['Thumb'], + 'thumb': obj['Artwork']['Primary'], + }) self.set_artwork(obj['Artwork'], listitem, obj['Type']) if obj['Artwork']['Primary']: - listitem.setThumbnailImage(obj['Artwork']['Primary']) + listitem.setArt({ + 'thumb': obj['Artwork']['Primary'], + }) if not obj['Artwork']['Backdrop']: listitem.setArt({'fanart': obj['Artwork']['Primary']}) @@ -572,7 +579,9 @@ class Actions(object): 'title': obj['Title'] } listitem.setProperty('path', obj['Artwork']['Primary']) - listitem.setThumbnailImage(obj['Artwork']['Primary']) + listitem.setArt({ + 'thumb': obj['Artwork']['Primary'], + }) if obj['Type'] == 'Photo': metadata.update({ @@ -588,10 +597,14 @@ class Actions(object): }) listitem.setProperty('plot', obj['Overview']) listitem.setProperty('IsFolder', 'false') - listitem.setIconImage('DefaultPicture.png') + listitem.setArt({ + 'icon': 'DefaultPicture.png', + }) else: listitem.setProperty('IsFolder', 'true') - listitem.setIconImage('DefaultFolder.png') + listitem.setArt({ + 'icon': 'DefaultFolder.png', + }) listitem.setProperty('IsPlayable', 'false') listitem.setLabel(obj['Title'])