2020-12-03, 09:25
So I've been trying to modify the extras code so that each season has it's own extras, instead of the whole show having all of the extras. In my code, I have the extras folder in the main series folder, but in that folder will be folders for each season (ex: Doctor Who\Extras\s01)
I can't figure out a way of getting the season number when you open up the context menu on a particular season. Can someone who understands the code help me here?
Here is my modified code:
def main():
addon = xbmcaddon.Addon()
item_path = sys.listitem.getVideoInfoTag().getPath()
item_type = xbmc.InfoTagVideo.getMediaType(sys.listitem.getVideoInfoTag())
if not item_path:
return
if item_type == "season":
season_num = xbmc.InfoTagVideo.getSeason(!!! THIS IS WHERE I NEED HELP!!!!)
extras_dir = os.path.join(item_path, "Extras\s", season_num)
xbmc.log("[%s] opening '%s'" % (addon.getAddonInfo('id'), extras_dir), xbmc.LOGDEBUG)
params = {
'path': extras_dir,
'isroot': 'true',
'title': sys.listitem.getLabel(),
'fanart': sys.listitem.getProperty('fanart_image'),
}
I can't figure out a way of getting the season number when you open up the context menu on a particular season. Can someone who understands the code help me here?
Here is my modified code:
def main():
addon = xbmcaddon.Addon()
item_path = sys.listitem.getVideoInfoTag().getPath()
item_type = xbmc.InfoTagVideo.getMediaType(sys.listitem.getVideoInfoTag())
if not item_path:
return
if item_type == "season":
season_num = xbmc.InfoTagVideo.getSeason(!!! THIS IS WHERE I NEED HELP!!!!)
extras_dir = os.path.join(item_path, "Extras\s", season_num)
xbmc.log("[%s] opening '%s'" % (addon.getAddonInfo('id'), extras_dir), xbmc.LOGDEBUG)
params = {
'path': extras_dir,
'isroot': 'true',
'title': sys.listitem.getLabel(),
'fanart': sys.listitem.getProperty('fanart_image'),
}