Skip to content

Commit

Permalink
Merge pull request #2052 from Spacetech/fix_tags
Browse files Browse the repository at this point in the history
Fix getVideoInfoTag error
  • Loading branch information
croneter authored Mar 29, 2024
2 parents 8a43dfc + 83e571e commit 955d1f5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions resources/lib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,9 @@ def create_listitem(item, as_tuple=True, offscreen=True,
listitem=xbmcgui.ListItem):
"""helper to create a kodi listitem from kodi compatible dict with mediainfo"""
try:
# PKCListItem does not implement getVideoInfoTag
use_tags_for_item = USE_TAGS and listitem == xbmcgui.ListItem

liz = listitem(
label=item.get("label", ""),
label2=item.get("label2", ""),
Expand All @@ -493,7 +496,7 @@ def create_listitem(item, as_tuple=True, offscreen=True,
# extra properties
for key, value in item["extraproperties"].items():
# some Video properties should be set via tags on newer kodi versions
if nodetype != "Video" or not USE_TAGS or key not in TAG_PROPERTIES:
if nodetype != "Video" or not use_tags_for_item or key not in TAG_PROPERTIES:
liz.setProperty(key, value)

# video infolabels
Expand Down Expand Up @@ -539,7 +542,7 @@ def create_listitem(item, as_tuple=True, offscreen=True,

# streamdetails
if item.get("streamdetails"):
if USE_TAGS:
if use_tags_for_item:
tags = liz.getVideoInfoTag()
tags.addVideoStream(_create_VideoStreamDetail(item["streamdetails"].get("video", {})))
tags.addAudioStream(_create_AudioStreamDetail(item["streamdetails"].get("audio", {})))
Expand All @@ -555,7 +558,7 @@ def create_listitem(item, as_tuple=True, offscreen=True,
if "date" in item:
infolabels["date"] = item["date"]

if USE_TAGS and "resumetime" in item["extraproperties"] and "totaltime" in item["extraproperties"]:
if use_tags_for_item and "resumetime" in item["extraproperties"] and "totaltime" in item["extraproperties"]:
tags = liz.getVideoInfoTag()
tags.setResumePoint(float(item["extraproperties"].get("resumetime")), float(item["extraproperties"].get("totaltime")));

Expand Down Expand Up @@ -598,7 +601,7 @@ def create_listitem(item, as_tuple=True, offscreen=True,
infolabels["lastplayed"] = item["lastplayed"]

# assign the infolabels
if USE_TAGS and nodetype == "Video":
if use_tags_for_item and nodetype == "Video":
# filter out None valued properties
infolabels = {k: v for k, v in infolabels.items() if v is not None}

Expand Down

0 comments on commit 955d1f5

Please sign in to comment.