Get duration return 0
#1
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.

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?
Reply
#2
(2016-07-11, 09:49)mirceaciu Wrote: 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.

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?


EDIT: found this, might be helpful http://kodi.wiki/view/Adding_videos_to_the_library
Reply
#3
Update:

Using
Code:
xbmc.executebuiltin('UpdateLibrary(video, special://skin//scripts//videos//)')

I get this, and no update:

Code:
VideoInfoScanner: Finished scan. Scanning for video info took 00:00
Reply

Logout Mark Read Team Forum Stats Members Help
Get duration return 00