How to get the duration of the current playing movie - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: How to get the duration of the current playing movie (/showthread.php?tid=164908) |
How to get the duration of the current playing movie - mvdwetering - 2013-05-14 Hi, I am working on an addon to change my lighting when starting/pausing/stopping a movie. That all works fine, but I only want to change the lighting when playing "real" movie not when for example playing music videos or watching youtube. For this I want to check if the duration is > 60 minutes. If so then I assume it is a movie. The movietimes show correctly in the library. I tried using xbmc.Player().getTotalTime() and xbmc.getInfoLabel('VideoPlayer.Duration'), but these don't always give the correct duration. The wrong durations seems to happen with movies that have a menu or movies that have an intro (e.g. the pixar lamp). There I get the duration that is a lot shorter than the movie. BTW I am checking for the duration in the onPlaybackStarted callback/event function. Is there a way to get the duration as is displayed in the library? |