2017-07-17, 17:17
Hello, I am trying and trying and trying, but can't figure it out, so I hope anyone here know the answer or can point me in the right direction.
I have a PI with kodi and openelec 6.0.3.
I have written a simple addon that loops video from a folder on a usb called 'STICK'.
I have installed the addon and it is working great.
But when I unplug my usb or start kodi first and then plugin the usb, the script does not work/ does not get executed. I understand that because it is a addon that is called at startup, but I would love this functionality.
Is it possible to play files from a directory (in this case the folder 'loop' from the usb device 'STICK' when it is mounted? And when it is unmounted it plays from the local folder "/storage/videos/loop"?
I have read about rules and tried it but without any luck.
Via putty I found the folder configfiles -> udev.rules.d and added a "startscript.rules" file. I tried different rules to start a script once the usb is mounted, one of them was:
but is does not seems to do anything. I restarted my pi after my changes...
What should I do?
I have a PI with kodi and openelec 6.0.3.
I have written a simple addon that loops video from a folder on a usb called 'STICK'.
I have installed the addon and it is working great.
Code:
#!/usr/bin/python
import os, xbmc
xbmc.executebuiltin('xbmc.PlayMedia("/media/STICK/loop",isdir)')
xbmc.executebuiltin('xbmc.PlayerControl(RepeatAll)')
xbmc.executebuiltin("Action(Fullscreen)")
monitor=xbmc.Monitor()
while not monitor.abortRequested():
if monitor.waitForAbort(1):
break
But when I unplug my usb or start kodi first and then plugin the usb, the script does not work/ does not get executed. I understand that because it is a addon that is called at startup, but I would love this functionality.
Is it possible to play files from a directory (in this case the folder 'loop' from the usb device 'STICK' when it is mounted? And when it is unmounted it plays from the local folder "/storage/videos/loop"?
I have read about rules and tried it but without any luck.
Via putty I found the folder configfiles -> udev.rules.d and added a "startscript.rules" file. I tried different rules to start a script once the usb is mounted, one of them was:
Code:
ACTION=="add", SUBSYSTEM=="usb", KERNEL=="sda1", RUN+="/storage/videos/scripts/loop_stick.py"
What should I do?