2023-11-05, 23:58
Hello,
After an update to Kodi 20 from Kodi 18, my autoexec script no longer works properly.
Here is the script:
import os
import xbmc
import random
import math
class XBMCPlayer(xbmc.Player):
def __init__(self):
xbmc.Player.__init__(self)
def onAVStarted(self):
if xbmc.Player().isPlayingVideo():
total_time = int(math.fabs(xbmc.Player().getTotalTime()))
xbmc.Player().seekTime(random.randint(0, total_time))
Player = XBMCPlayer()
videoList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
videoList.clear()
videoList.load("http://192.168.178.88/playlist.m3u")
# Enable playlist shuffle if needed
# videoList.shuffle()
xbmc.executebuiltin("xbmc.PlayerControl(RepeatAll)")
xbmc.Player().play(videoList)
while (not xbmc.abortRequested):
xbmc.sleep(100)
When starting the playlist is loaded and the video is played, however in version Kodi 18 the video jumped to a random time in the video.
Unfortunately, I can't really get the auotexec addon to work under Python 3.
I would appreciate some help.
After an update to Kodi 20 from Kodi 18, my autoexec script no longer works properly.
Here is the script:
import os
import xbmc
import random
import math
class XBMCPlayer(xbmc.Player):
def __init__(self):
xbmc.Player.__init__(self)
def onAVStarted(self):
if xbmc.Player().isPlayingVideo():
total_time = int(math.fabs(xbmc.Player().getTotalTime()))
xbmc.Player().seekTime(random.randint(0, total_time))
Player = XBMCPlayer()
videoList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
videoList.clear()
videoList.load("http://192.168.178.88/playlist.m3u")
# Enable playlist shuffle if needed
# videoList.shuffle()
xbmc.executebuiltin("xbmc.PlayerControl(RepeatAll)")
xbmc.Player().play(videoList)
while (not xbmc.abortRequested):
xbmc.sleep(100)
When starting the playlist is loaded and the video is played, however in version Kodi 18 the video jumped to a random time in the video.
Unfortunately, I can't really get the auotexec addon to work under Python 3.
I would appreciate some help.