Unexpected behavior from xbmc.monitor()
#1
I've been encountering unexpected behavior from xbmc.monitor.waitForAbort, Everytime either a single video or the first playlist entry ends the loop breaks.

I thought I was tracking a bug within xbmc.monitor(), but from what I can tell from the source this is a design feature?
https://github.com/xbmc/xbmc/blob/72d0c2...onitor.cpp

Endtime thread from player is included as abortEvent? am I correctly reading the source? I wonder what would be the appropriate solution (workaround) for my situation?

I'd like to have a loop running a function while a short video is playing... Would it be okay to use
Code:
while True:
and create my own break code since I can abort the loop based on the window status?

Example pseudo code below, thanks for any help.

Code:
SHORTCLIP = 20SECCLIP

class Screensaver(xbmcgui.WindowXMLDialog):
    def __init__(self, *args, **kwargs ):
        playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playlist.clear()
        for i in range(30):
            playlist.add(SHORTCLIP)
        xbmc.executebuiltin("PlayerControl(RepeatAll)")
        xbmc.Player().play(playlist)
        
        
    def onInit(self):
        self.start()
        
    
    def start(self):
        while not xbmc.Monitor().abortRequested():
            doSomething()
            if xbmc.Monitor().waitForAbort(30) == True:
                break
        self.closeWindow()


    def onAction(self, action):
        self.closeWindow()
        
        
    def closeWindow(self):
        xbmc.Player().stop()
        xbmc.executebuiltin("PlayerControl(RepeatOff)")
        self.close()
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#2
@Lunatixz

Quote:I thought I was tracking a bug within xbmc.monitor(), but from what I can tell from the source this is a design feature?
https://github.com/xbmc/xbmc/blob/72d0c2...onitor.cpp

Endtime thread from player is included as abortEvent? am I correctly reading the source?

I'm not a C++ expert but I don't see anything player-related in the code. It looks like a homegrown solution similar to std::chrono, but, as I understand, most of Kodi codebase predates C++11, hence many homegrown solutions instead of modern std:: features.

If the bug indeed occurs and reproducible, I guess you need to submit a bug report.
Reply
#3
Yes that link doesn't but following the includes they lead to the XBMC.thread, system time and player both using a class called Endtime. I'm rusty with C, so I could be mistaken.

I'll open a ticket since at least for me it's reproducible.
Sent from my SM-G935T
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#4
https://trac.kodi.tv/ticket/17517#ticket
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply

Logout Mark Read Team Forum Stats Members Help
Unexpected behavior from xbmc.monitor()0