From 3690daa72fcb4360e519eaf9f3f5b813875695da Mon Sep 17 00:00:00 2001 From: Maista6969 Date: Sat, 20 Jan 2024 01:00:37 +0100 Subject: [PATCH] Update kodi-helper Replaces fields that were deprecated in v0.24 --- scripts/kodi-helper/kodi-helper.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/kodi-helper/kodi-helper.py b/scripts/kodi-helper/kodi-helper.py index 2e79f4d5..d46e4c95 100644 --- a/scripts/kodi-helper/kodi-helper.py +++ b/scripts/kodi-helper/kodi-helper.py @@ -35,7 +35,7 @@ def main(): def generateNFOFiles(args): - if not args.inline and args.outdir == "": + if not (args.inline or args.outdir): print("--outdir or --inline must be set\n") return @@ -54,6 +54,12 @@ def generateNFOFiles(args): scenes = getScenes(i, filter) for scene in scenes: + # skip scenes without files + if not scene["files"]: + continue + + # Quick fix for scenes with multiple files + scene["path"] = scene["files"][0]["path"] # don't regenerate if file already exists and not overwriting output = getOutputNFOFile(scene["path"], args) if not args.overwrite and os.path.exists(output): @@ -165,11 +171,12 @@ def getScenes(page, sceneFilter): scenes { id title - path - rating + files { + path + } + rating100 details date - oshash paths { screenshot stream @@ -244,8 +251,9 @@ def generateNFO(scene, args): {}""".format(t["name"]) rating = "" - if scene["rating"] != None: - rating = scene["rating"] + if scene["rating100"] != None: + # Kodi uses a 10 point scale, in increments of 0.5 + rating = (2 * scene["rating100"] // 10) / 2.0 date = "" if scene["date"] != None: