mirror of
https://github.com/jellyfin/jellycon.git
synced 2024-11-23 22:19:54 +00:00
Utilize the new kodi_version function
This commit is contained in:
parent
6126d617f5
commit
a482172be4
@ -15,7 +15,7 @@ import xbmcaddon
|
||||
import xbmc
|
||||
|
||||
from .jellyfin import api
|
||||
from .utils import convert_size, translate_string, get_version, load_user_details, get_art_url, get_default_filters, translate_path
|
||||
from .utils import convert_size, translate_string, get_version, load_user_details, get_art_url, get_default_filters, translate_path, kodi_version
|
||||
from .item_functions import get_art
|
||||
from .kodi_utils import HomeWindow
|
||||
from .datamanager import clear_cached_server_data
|
||||
@ -40,7 +40,6 @@ PLUGINPATH = translate_path(os.path.join(__cwd__))
|
||||
|
||||
log = LazyLogger(__name__)
|
||||
|
||||
kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
|
||||
user_details = load_user_details()
|
||||
|
||||
|
||||
@ -60,7 +59,7 @@ def main_entry_point():
|
||||
log.debug("Running Python: {0}".format(sys.version_info))
|
||||
log.debug("Running JellyCon: {0}".format(get_version()))
|
||||
log.debug("Kodi BuildVersion: {0}".format(xbmc.getInfoLabel("System.BuildVersion")))
|
||||
log.debug("Kodi Version: {0}".format(kodi_version))
|
||||
log.debug("Kodi Version: {0}".format(kodi_version()))
|
||||
log.debug("Script argument data: {0}".format(sys.argv))
|
||||
|
||||
params = get_params()
|
||||
|
@ -9,12 +9,11 @@ from datetime import datetime
|
||||
import xbmc
|
||||
import xbmcgui
|
||||
|
||||
from .utils import datetime_from_string, get_art_url, image_url
|
||||
from .utils import datetime_from_string, get_art_url, image_url, kodi_version
|
||||
from .lazylogger import LazyLogger
|
||||
from six import ensure_text
|
||||
|
||||
log = LazyLogger(__name__)
|
||||
kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
|
||||
|
||||
|
||||
class ItemDetails:
|
||||
@ -428,7 +427,7 @@ def add_gui_item(url, item_details, display_options, folder=True, default_sort=F
|
||||
else:
|
||||
item_details.plot = time_info
|
||||
|
||||
if kodi_version > 17:
|
||||
if kodi_version() > 17:
|
||||
list_item = xbmcgui.ListItem(list_item_name, offscreen=True)
|
||||
else:
|
||||
list_item = xbmcgui.ListItem(list_item_name, iconImage=thumb_path, thumbnailImage=thumb_path)
|
||||
@ -459,7 +458,7 @@ def add_gui_item(url, item_details, display_options, folder=True, default_sort=F
|
||||
|
||||
# add cast
|
||||
if item_details.cast:
|
||||
if kodi_version >= 17:
|
||||
if kodi_version() >= 17:
|
||||
list_item.setCast(item_details.cast)
|
||||
else:
|
||||
info_labels['cast'] = info_labels['castandrole'] = [(cast_member['name'], cast_member['role']) for cast_member in item_details.cast]
|
||||
@ -595,7 +594,7 @@ def add_gui_item(url, item_details, display_options, folder=True, default_sort=F
|
||||
if item_details.baseline_itemname is not None:
|
||||
item_properties["suggested_from_watching"] = item_details.baseline_itemname
|
||||
|
||||
if kodi_version > 17:
|
||||
if kodi_version() > 17:
|
||||
list_item.setProperties(item_properties)
|
||||
else:
|
||||
for key, value in item_properties.iteritems():
|
||||
|
@ -45,22 +45,3 @@ def add_menu_directory_item(label, path, folder=True, art=None):
|
||||
li.setArt(art)
|
||||
|
||||
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=path, listitem=li, isFolder=folder)
|
||||
|
||||
|
||||
def get_kodi_version():
|
||||
|
||||
json_data = xbmc.executeJSONRPC(
|
||||
'{ "jsonrpc": "2.0", "method": "Application.GetProperties", "params": {"properties": ["version", "name"]}, "id": 1 }')
|
||||
|
||||
result = json.loads(json_data)
|
||||
|
||||
try:
|
||||
result = result.get("result")
|
||||
version_data = result.get("version")
|
||||
version = float(str(version_data.get("major")) + "." + str(version_data.get("minor")))
|
||||
log.debug("Version: {0} - {1}".format(version, version_data))
|
||||
except:
|
||||
version = 0.0
|
||||
log.error("Version Error : RAW Version Data: {0}".format(result))
|
||||
|
||||
return version
|
||||
|
@ -10,10 +10,9 @@ import xbmcvfs
|
||||
|
||||
from .jsonrpc import JsonRpc, get_value, set_value
|
||||
from .lazylogger import LazyLogger
|
||||
from .utils import translate_path
|
||||
from .utils import translate_path, kodi_version
|
||||
|
||||
log = LazyLogger(__name__)
|
||||
ver = xbmc.getInfoLabel('System.BuildVersion')[:2]
|
||||
|
||||
|
||||
def clone_default_skin():
|
||||
@ -92,7 +91,7 @@ def clone_skin():
|
||||
# get jellycon path
|
||||
jellycon_path = os.path.join(kodi_home_path, "addons", "plugin.video.jellycon")
|
||||
|
||||
log.debug("Major Version: {0}".format(ver))
|
||||
log.debug("Major Version: {0}".format(kodi_version()))
|
||||
|
||||
file_list = ["Home.xml",
|
||||
"Includes_Home.xml",
|
||||
@ -102,7 +101,7 @@ def clone_skin():
|
||||
|
||||
# Copy customized skin files from our addon into cloned skin
|
||||
for file_name in file_list:
|
||||
source = os.path.join(jellycon_path, "resources", "skins", "skin.estuary", ver, "xml", file_name)
|
||||
source = os.path.join(jellycon_path, "resources", "skins", "skin.estuary", str(kodi_version), "xml", file_name)
|
||||
destination = os.path.join(kodi_skin_destination, "xml", file_name)
|
||||
xbmcvfs.copy(source, destination)
|
||||
|
||||
|
@ -9,7 +9,7 @@ import random
|
||||
import time
|
||||
|
||||
from .jellyfin import api
|
||||
from .utils import get_jellyfin_url, image_url, load_user_details, get_art_url, get_default_filters
|
||||
from .utils import get_jellyfin_url, image_url, load_user_details, get_art_url, get_default_filters, kodi_version
|
||||
from .lazylogger import LazyLogger
|
||||
from .kodi_utils import HomeWindow
|
||||
from .dir_functions import process_directory
|
||||
@ -18,7 +18,6 @@ from .tracking import timer
|
||||
log = LazyLogger(__name__)
|
||||
user_details = load_user_details()
|
||||
user_id = user_details.get('user_id')
|
||||
kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
|
||||
|
||||
background_items = []
|
||||
background_current_item = 0
|
||||
@ -238,7 +237,7 @@ def get_widget_content_cast(handle, params):
|
||||
person_thumbnail = image_url(
|
||||
person_id, "Primary", 0, 400, 400, person_tag, server=server)
|
||||
|
||||
if kodi_version > 17:
|
||||
if kodi_version() > 17:
|
||||
list_item = xbmcgui.ListItem(label=person_name, offscreen=True)
|
||||
else:
|
||||
list_item = xbmcgui.ListItem(label=person_name)
|
||||
|
Loading…
Reference in New Issue
Block a user