Determine if XBMC is closing?
#1
Hi there,
I am working on the callerid script which is basically a never ending loop running in the background. Because of this though, when you go close XBMC it just doesn't work. So i need a conditional in the loop to tell it to exit. Is there a way i can determine if XBMC is closing down?
Reply
#2
BUMP

anybody got any suggestions on how to break the loop when xbmc is shutting down?
Reply
#3
Lightbulb 
Hi,

I have a background script running while XBMC is shutting down and I managed to work around it by creating a time.sleep(5) endless loop. The short interval allows XBMC to shutdown within maximum of 5 seconds, because that's when the thread will be released. In order to support longer intervals, I have a modulo check within the loop, so for example a minute would be something like:
timeline_interval = 0
while 1:
----if (timeline_interval % 12 == 0): #one minute
--------print 'do something'

timeline_interval = timeline_interval + 1
time.sleep(5)

Not sure if that's what you're looking for, but maybe you or someone else will find it useful.

--mr. kav
Reply
#4
Well after some more investigating, I found where the source of the problem actually lies. It was actually getting caught up in the socket connection, so it wasn't the loop. So I had to add a timeout to the socket, because actually what was happening was it was sitting there listening to the socket and wouldn't finish the script. so now that there is a timeout on the socket connection, it works great.

Thanks for the suggestion though. I see what you were saying.
Reply

Logout Mark Read Team Forum Stats Members Help
Determine if XBMC is closing?0