2014-12-09, 11:56
Hi,
I'm busy creating my very first XBMC/Kodi addon in Python. It's a service that sets up a pyinotify notifier loop and watch for filesystem changes. In particular if my camera is connected via USB, so it'll copy over the images to an attached harddisk. This works well (enough), but I'm unable to stop the pyinotify notifier loop upon XBMC shutdown. It now looks like this:
I read in the wiki that for the XBMC version I'm running (13.2), I should start the script like this:
Now I can replace the 'some code' with my notifier.loop, but since the script will happily keep looping, it'll never go to the sleep(500) part.
I'm kind of stuck here ... Every time I want to close XBMC, it gives me an error in the logfile:
which is probably caused by the notifier.loop() ...
Any ideas?
I'm busy creating my very first XBMC/Kodi addon in Python. It's a service that sets up a pyinotify notifier loop and watch for filesystem changes. In particular if my camera is connected via USB, so it'll copy over the images to an attached harddisk. This works well (enough), but I'm unable to stop the pyinotify notifier loop upon XBMC shutdown. It now looks like this:
Code:
def main():
# watch manager
wm = pyinotify.WatchManager()
mask = pyinotify.IN_CREATE | pyinotify.IN_DELETE
wm.add_watch(mediadir, mask, rec=True)
# event handler
eh = MyEventHandler()
# notifier
notifier = pyinotify.Notifier(wm, eh)
notifier.loop()
if __name__ == '__main__':
main()
I read in the wiki that for the XBMC version I'm running (13.2), I should start the script like this:
Code:
if __name__ == '__main__':
while not xbmc.abortRequested:
some code
xbmc.sleep(500)
Now I can replace the 'some code' with my notifier.loop, but since the script will happily keep looping, it'll never go to the sleep(500) part.
I'm kind of stuck here ... Every time I want to close XBMC, it gives me an error in the logfile:
Quote:10:47:59 T:140134299994560 ERROR: CPythonInvoker(5, /home/leon/.xbmc/addons/plugin.program.camerasync/service.py): script didn't stop in 5 seconds - let's kill it
which is probably caused by the notifier.loop() ...
Any ideas?