Python Forum

Full Version: break out of for loop?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi, I am using Kodi and I have my movies in different folders depending on the resolution, refresh rate and available soundtrack (like Dolby Atmos, DD+, DTS-HD)

I have a script which is giving me a notification when I switch to the movie poster in Kodi.

HOWEVER, the notification is stuck on the screen and doesn't disappear after 5 seconds as it should.
I simply can't figure out how to break out of the loop.

It should reappear once I switch to a movie which has a different sound mode/or refresh rate, etc. ...

I'd really appreciate if someone can take a look - what is likely a simple solution. Just not for me....

Thanks a lot!

if __name__ == '__main__':    
    monitor = xbmc.Monitor()    
    while not monitor.abortRequested():
        if monitor.waitForAbort(.5):
            break
        for root, dirs, files in os.walk("/storage/emulated/0/DCIM/"):
            for x in dirs:
                if xbmc.getInfoLabel('ListItem.Title') in dirs:
                        xbmc.executebuiltin( 'Notification(Status,Refresh rate: 23Hz)' )
                        break
            break
Could you please explain the logic you are trying to implement.
Hi, I just want the notification to show and then disappear after some time. When you don't specify the time it automatically disappears after 5 seconds.

On my code it doesn't disappear at all. I somehow can't figure out how to break out of the code.

And it should reappear when the condition is met again - which is when it goes to a movie in a different folder.

Hope it's clearer now. Appreciate any help!
if you guys need more info I'm happy to assist. I simply can't figure it out on my own.

Thanks!