I have written this code which sends a notification to Kodi when a certain condition is met. (When I start a movie/tv show or play music I want the language, resolution, refresh rate and sound mode to appear on the screen).
I have grouped my media in different folders.
The code is working fine but I can't fix one issue:
The line in bold where I actually send the notification xbmc.executebuiltin( 'Notification(Info, Some text)' ) stays on the screen - forever, unless I change the window or to a file which is in a different folder (then a different notification stays on the screen). Not what I want.
What is missing so the line only executes once and the notification disappears after a few seconds?
if __name__ == '__main__':
monitor = xbmc.Monitor()
while not monitor.abortRequested():
def my_function_one():
for root, dirs, files in os.walk(path_1):
for x in dirs:
if condition_1 and condition_2:
**xbmc.executebuiltin( 'Notification(Info, Some text)' )**
break
def my_function_two():
for root, dirs, files in os.walk(path_2):
for y in dirs:
if condition_3 and condition_4:
**xbmc.executebuiltin( 'Notification(Info, Some other text)' )**
break
if monitor.waitForAbort(5):
break
my_function_one()
my_function_two()
update: I have tried adding True/False statements to my code but the notification is still not disappearing after a few seconds - as it should:
displayed = False
def my_function_one():
for root, dirs, files in os.walk(path_1):
for x in dirs:
if condition_1 and condition_2:
if not displayed:
displayed = True
xbmc.executebuiltin( 'Notification(Info, Some text)' )
break