mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Update deprecated kodi api functions
This commit is contained in:
parent
d79b5077ae
commit
a9793eb1c9
5 changed files with 32 additions and 23 deletions
|
@ -61,10 +61,7 @@ class UsersConnect(xbmcgui.WindowXMLDialog):
|
||||||
|
|
||||||
item = xbmcgui.ListItem(label)
|
item = xbmcgui.ListItem(label)
|
||||||
item.setProperty('id', user_id)
|
item.setProperty('id', user_id)
|
||||||
if self.kodi_version > 15:
|
item.setArt({'icon': user_image})
|
||||||
item.setArt({'Icon': user_image})
|
|
||||||
else:
|
|
||||||
item.setIconImage(user_image)
|
|
||||||
|
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@ from __future__ import division, absolute_import, print_function, unicode_litera
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from six import iteritems
|
||||||
from six.moves.urllib.parse import parse_qsl, urlencode
|
from six.moves.urllib.parse import parse_qsl, urlencode
|
||||||
from kodi_six import xbmc, xbmcvfs, xbmcgui, xbmcplugin, xbmcaddon
|
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
|
''' Gets the icon paths for default node listings
|
||||||
'''
|
'''
|
||||||
li = xbmcgui.ListItem(label, path=path)
|
li = xbmcgui.ListItem(label, path=path)
|
||||||
li.setThumbnailImage(artwork or "special://home/addons/plugin.video.jellyfin/resources/icon.png")
|
li.setArt({
|
||||||
li.setArt({"fanart": fanart or "special://home/addons/plugin.video.jellyfin/resources/fanart.png"})
|
"thumb": artwork or "special://home/addons/plugin.video.jellyfin/resources/icon.png",
|
||||||
li.setArt({"landscape": artwork or fanart or "special://home/addons/plugin.video.jellyfin/resources/fanart.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
|
return li
|
||||||
|
|
||||||
|
@ -712,12 +714,10 @@ def create_listitem(item):
|
||||||
li.setProperty('resumetime', str(item['resume']['position']))
|
li.setProperty('resumetime', str(item['resume']['position']))
|
||||||
li.setProperty('totaltime', str(item['resume']['total']))
|
li.setProperty('totaltime', str(item['resume']['total']))
|
||||||
li.setArt(item['art'])
|
li.setArt(item['art'])
|
||||||
li.setThumbnailImage(item['art'].get('thumb', ''))
|
|
||||||
li.setIconImage('DefaultTVShows.png')
|
|
||||||
li.setProperty('dbid', str(item['episodeid']))
|
li.setProperty('dbid', str(item['episodeid']))
|
||||||
li.setProperty('fanart_image', item['art'].get('tvshow.fanart', ''))
|
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:
|
for stream in value:
|
||||||
li.addStreamInfo(key, stream)
|
li.addStreamInfo(key, stream)
|
||||||
|
|
||||||
|
|
|
@ -460,6 +460,7 @@ def has_attribute(obj, name):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def set_addon_mode():
|
def set_addon_mode():
|
||||||
|
|
||||||
''' Setup playback mode. If native mode selected, check network credentials.
|
''' Setup playback mode. If native mode selected, check network credentials.
|
||||||
|
|
|
@ -388,7 +388,6 @@ class API(object):
|
||||||
|
|
||||||
return request_method(url, **request_settings)
|
return request_method(url, **request_settings)
|
||||||
|
|
||||||
|
|
||||||
def login(self, server_url, username, password=""):
|
def login(self, server_url, username, password=""):
|
||||||
path = "Users/AuthenticateByName"
|
path = "Users/AuthenticateByName"
|
||||||
authData = {
|
authData = {
|
||||||
|
@ -432,7 +431,7 @@ class API(object):
|
||||||
response = self.send_request(server_address, "system/info/public")
|
response = self.send_request(server_address, "system/info/public")
|
||||||
try:
|
try:
|
||||||
return response.json() if response.status_code == 200 else {}
|
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("Failed to get server public info. JSON error: %s" % e)
|
||||||
LOG.error(response.content)
|
LOG.error(response.content)
|
||||||
return {}
|
return {}
|
||||||
|
@ -444,4 +443,3 @@ class API(object):
|
||||||
response = self.send_request(server_address, "system/info/public")
|
response = self.send_request(server_address, "system/info/public")
|
||||||
url = response.url.replace('/system/info/public', '')
|
url = response.url.replace('/system/info/public', '')
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
|
|
@ -325,8 +325,10 @@ class Actions(object):
|
||||||
if intro or obj['Type'] == 'Trailer':
|
if intro or obj['Type'] == 'Trailer':
|
||||||
listitem.setArt({'poster': ""}) # Clear the poster value for intros / trailers to prevent issues in skins
|
listitem.setArt({'poster': ""}) # Clear the poster value for intros / trailers to prevent issues in skins
|
||||||
|
|
||||||
listitem.setIconImage('DefaultVideo.png')
|
listitem.setArt({
|
||||||
listitem.setThumbnailImage(obj['Artwork']['Primary'])
|
'icon': 'DefaultVideo.png',
|
||||||
|
'thumb': obj['Artwork']['Primary'],
|
||||||
|
})
|
||||||
|
|
||||||
if obj['Premiere']:
|
if obj['Premiere']:
|
||||||
obj['Premiere'] = obj['Premiere'].split('T')[0]
|
obj['Premiere'] = obj['Premiere'].split('T')[0]
|
||||||
|
@ -487,12 +489,17 @@ class Actions(object):
|
||||||
'playcount': obj['PlayCount'],
|
'playcount': obj['PlayCount'],
|
||||||
'overlay': obj['Overlay']
|
'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'])
|
self.set_artwork(obj['Artwork'], listitem, obj['Type'])
|
||||||
|
|
||||||
if obj['Artwork']['Primary']:
|
if obj['Artwork']['Primary']:
|
||||||
listitem.setThumbnailImage(obj['Artwork']['Primary'])
|
listitem.setArt({
|
||||||
|
'thumb': obj['Artwork']['Primary'],
|
||||||
|
})
|
||||||
|
|
||||||
if not obj['Artwork']['Backdrop']:
|
if not obj['Artwork']['Backdrop']:
|
||||||
listitem.setArt({'fanart': obj['Artwork']['Primary']})
|
listitem.setArt({'fanart': obj['Artwork']['Primary']})
|
||||||
|
@ -572,7 +579,9 @@ class Actions(object):
|
||||||
'title': obj['Title']
|
'title': obj['Title']
|
||||||
}
|
}
|
||||||
listitem.setProperty('path', obj['Artwork']['Primary'])
|
listitem.setProperty('path', obj['Artwork']['Primary'])
|
||||||
listitem.setThumbnailImage(obj['Artwork']['Primary'])
|
listitem.setArt({
|
||||||
|
'thumb': obj['Artwork']['Primary'],
|
||||||
|
})
|
||||||
|
|
||||||
if obj['Type'] == 'Photo':
|
if obj['Type'] == 'Photo':
|
||||||
metadata.update({
|
metadata.update({
|
||||||
|
@ -588,10 +597,14 @@ class Actions(object):
|
||||||
})
|
})
|
||||||
listitem.setProperty('plot', obj['Overview'])
|
listitem.setProperty('plot', obj['Overview'])
|
||||||
listitem.setProperty('IsFolder', 'false')
|
listitem.setProperty('IsFolder', 'false')
|
||||||
listitem.setIconImage('DefaultPicture.png')
|
listitem.setArt({
|
||||||
|
'icon': 'DefaultPicture.png',
|
||||||
|
})
|
||||||
else:
|
else:
|
||||||
listitem.setProperty('IsFolder', 'true')
|
listitem.setProperty('IsFolder', 'true')
|
||||||
listitem.setIconImage('DefaultFolder.png')
|
listitem.setArt({
|
||||||
|
'icon': 'DefaultFolder.png',
|
||||||
|
})
|
||||||
|
|
||||||
listitem.setProperty('IsPlayable', 'false')
|
listitem.setProperty('IsPlayable', 'false')
|
||||||
listitem.setLabel(obj['Title'])
|
listitem.setLabel(obj['Title'])
|
||||||
|
|
Loading…
Reference in a new issue