2016-07-11, 09:49
http://mirrors.xbmc.org/docs/python-docs...etduration
Using that property of a list element, I try to calculate total duration of a playlist by iteration over a few videos.
If the video was played by Kodi before, it will return it's duration. If not, it will return 0. Might be that Kodi is making an index for the videos he read at least once, but i need to get the duration of videos I add dynamically. What am I missing here?
Using that property of a list element, I try to calculate total duration of a playlist by iteration over a few videos.
Code:
for video in all_videos:
video_url = 'special://skin//scripts//videos//' + str(video)
listitem = xbmcgui.ListItem(video)
listitem.setInfo('video', {'Title': str(video), 'Genre': 'My genre'})
playlist.add(url=video_url, listitem=listitem)
xbmc.log(str(listitem.getduration())
If the video was played by Kodi before, it will return it's duration. If not, it will return 0. Might be that Kodi is making an index for the videos he read at least once, but i need to get the duration of videos I add dynamically. What am I missing here?