Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
break out of for loop?
#1
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
Reply
#2
Could you please explain the logic you are trying to implement.
Reply
#3
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!
Reply
#4
if you guys need more info I'm happy to assist. I simply can't figure it out on my own.

Thanks!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Code won't break While loop or go back to the input? MrKnd94 2 947 Oct-26-2022, 10:10 AM
Last Post: Larz60+
  How to break out of a for loop on button press? philipbergwerf 6 1,740 Oct-06-2022, 03:12 PM
Last Post: philipbergwerf
  Asyncio: Queue consumer gets out of while loop without break. Where exactly and how? saavedra29 2 2,682 Feb-07-2022, 07:24 PM
Last Post: saavedra29
  tkinter control break a while loop samtal 0 2,388 Apr-29-2021, 08:26 AM
Last Post: samtal
  Cannot 'break' from a "for" loop in a right place tester_V 9 3,984 Feb-17-2021, 01:03 AM
Last Post: tester_V
  How to break a loop in this case? Blainexi 10 7,258 Sep-24-2020, 04:06 PM
Last Post: Blainexi
  how to break the loop? bntayfur 8 3,062 Jun-07-2020, 11:07 PM
Last Post: bntayfur
  break for loop Agusben 1 1,909 Apr-01-2020, 05:07 PM
Last Post: Larz60+
  Help For AutoGui Loop break ahmetnwpal 0 1,962 Mar-11-2020, 01:14 PM
Last Post: ahmetnwpal
  Do break operators turn while loop conditions from True to False? Drone4four 5 2,947 Oct-24-2019, 07:11 PM
Last Post: newbieAuggie2019

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020