• 1
  • 12
  • 13
  • 14(current)
  • 15
  • 16
  • 23
[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)
Hello KenV99,
I'm running Openelec/Kodi on a Intel-NUC with USB-HDDs and think about mirroring/backup my music-data to my NAS.
Your addon seems to me the best tool available for this, but I'm new to Kodi and an absolute python-noob...

So I need some 'kickoff'.
My 1st idea is:
1. If Kodi starts - send a WOL to the NAS (afaik is a function in Kodi)
2. when ready start rsync (client on Kodi, is already installed, server runs on the NAS)
- this should be packed into an shell-script.

Do you think I can get this 'wrapped' into your addon?
And, if yes, will this (as long as its running) prevent Kodi from shutting down if no other action takes place?
( I adjusted Kodi to shutdown after the max. possible 120 min.)

I'm not sure how to mix shell, python and this WOL-call.
If you can point me to some further reading...
Reply
(2015-03-28, 14:26)wolfn48 Wrote: Hello KenV99,
I'm running Openelec/Kodi on a Intel-NUC with USB-HDDs and think about mirroring/backup my music-data to my NAS.
Your addon seems to me the best tool available for this, but I'm new to Kodi and an absolute python-noob...

So I need some 'kickoff'.
My 1st idea is:
1. If Kodi starts - send a WOL to the NAS (afaik is a function in Kodi)

This is done directly in Kodi, not through this addon: Wake_on_lan (wiki)

(2015-03-28, 14:26)wolfn48 Wrote: 2. when ready start rsync (client on Kodi, is already installed, server runs on the NAS)
- this should be packed into an shell-script.

I don't know much about rsync. Unless you can set a long timeout, you will need to find a way to poll to see when the NAS is online in your shell script before you start the sync process.

(2015-03-28, 14:26)wolfn48 Wrote: Do you think I can get this 'wrapped' into your addon?
And, if yes, will this (as long as its running) prevent Kodi from shutting down if no other action takes place?
( I adjusted Kodi to shutdown after the max. possible 120 min.)

I'm not sure how to mix shell, python and this WOL-call.
If you can point me to some further reading...

I doesn't need to be 'wrapped' as best as I can tell. Kodi will do the WOL. You will need to write the shell script and link it to the 'on Startup Event' as a shell executable.

There is no way to abort a Kodi shutdown - scripts are terminated automatically if they do not abort themselves in 5 seconds after shutdown starts. However, since the script executes in a subprocess call, it will likely run until it finishes, but it may cause issues when you retry to restart Kodi because the process may not terminate gracefully. I know this happens in windows, I'm not sure if it happens in Linux.
Reply
Thank you very much KenV99,

just played around with your addon + found I can call 1x python OR 1x shell OR 1x call to Kodi.
So I will try to write a little python-script to 1st call Kodi for WOL to my NAS, then do some pings for waiting til ready and then start the rsync.
Found in the Kodi-wiki some links for get me going in python, will give it a try...

Thanks again, will report success or problems...
Reply
If you want to code sending the WOL magic packet yourself, more power to you, but if you enable it as above and edit the xml, you may be fine. Or you can use the advanced version: Add-on:Advanced_Wake_On_Lan (wiki)
I don't see a direct way of calling the kodi wol routines from python or via json, so you will have to either do it from the shell or download the advanced wol add on and look at how it's coded.
Reply
Hi KenV99,

Advanced_WOL ist already installed and used by Kodi on my NUC - this way the idea with rsync is born...

But just this moment I found the ethtool in Openelec, has a switch for WOL.

Edit: Bad, only for setting the local port. - Searching continues.
Edit2: Just found this:

#!/usr/bin/env python
import socket
s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.sendto('\xff'*6+'\xQQ\xQQ\xQQ\xQQ\xQQ\xQQ'*16, ("255.255.255.255",9))

- It works perfectly!!!


If this works for me, then most problems have gone. Then I will write some shell-code for this job.
(looked into Python-doc -- puuuhh, some overkill I think)
Reply
Hi

I've been trying to use KenV99's callback script to run .bat commands that i've made to control my lights , as seen here http://lightwaverfcommunity.org.uk/forum...e-control/

I have tried to get kodi to plain trigger the .bat which results in a fail
I have tried to get kodi to trigger a .py that triggers the .bat which results in a classic Python script error
I have made a .exe that is the .bat , it works fine when run from the desktop , but Kodi brings up the error 'it is not a recognized internal or external command."

Any solutions or ideas ? The .exe , .bat and .py all run and work themselves , just not when triggered.

General xbmc log :

Code:
19:11:48 T:1844  NOTICE: special://profile/ is mapped to: special://masterprofile/
19:11:48 T:1844  NOTICE: -----------------------------------------------------------------------
19:11:48 T:1844  NOTICE: Starting Kodi (14.2-RC1 Git:20150311-e7ba06f). Platform: Windows NT x86 32-bit
19:11:48 T:1844  NOTICE: Using Release Kodi x32 build
19:11:48 T:1844  NOTICE: Kodi compiled Mar 11 2015 by MSVC 180030723 for Windows NT x86 32-bit version 6.0 (0x06000000)
19:11:48 T:1844  NOTICE: Running on LENOVO 10AY003WUK with Windows 8.1, kernel: Windows NT x86 64-bit version 6.3
19:11:48 T:1844  NOTICE: Host CPU: Intel(R) Core(TM) i3-4150T CPU @ 3.00GHz, 4 cores available
19:11:48 T:1844  NOTICE: Desktop Resolution: 1280x1024 32Bit at 32Hz
19:11:48 T:1844  NOTICE: Running with restricted rights
19:11:48 T:1844  NOTICE: Aero is enabled
19:11:48 T:1844  NOTICE: special://xbmc/ is mapped to: C:\Program Files (x86)\Kodi
19:11:48 T:1844  NOTICE: special://xbmcbin/ is mapped to: C:\Program Files (x86)\Kodi
19:11:48 T:1844  NOTICE: special://masterprofile/ is mapped to: C:\Users\Media\AppData\Roaming\Kodi\userdata
19:11:48 T:1844  NOTICE: special://home/ is mapped to: C:\Users\Media\AppData\Roaming\Kodi\
19:11:48 T:1844  NOTICE: special://temp/ is mapped to: C:\Users\Media\AppData\Roaming\Kodi\cache
19:11:48 T:1844  NOTICE: The executable running is: C:\Program Files (x86)\Kodi\Kodi.exe
19:11:48 T:1844  NOTICE: Local hostname: XBMC
19:11:48 T:1844  NOTICE: Log File is located: C:\Users\Media\AppData\Roaming\Kodi\kodi.log
19:11:48 T:1844  NOTICE: -----------------------------------------------------------------------
19:11:48 T:1844  NOTICE: load settings...
19:11:48 T:1844 WARNING: CSettingString: unknown options filler "timezonecountries" of "locale.timezonecountry"
19:11:48 T:1844 WARNING: CSettingString: unknown options filler "timezones" of "locale.timezone"
19:11:48 T:1844  NOTICE: No settings file to load (special://xbmc/system/advancedsettings.xml)
19:11:48 T:1844  NOTICE: No settings file to load (special://masterprofile/advancedsettings.xml)
19:11:48 T:1844  NOTICE: Default DVD Player: dvdplayer
19:11:48 T:1844  NOTICE: Default Video Player: dvdplayer
19:11:48 T:1844  NOTICE: Default Audio Player: paplayer
19:11:48 T:1844  NOTICE: Disabled debug logging due to GUI setting. Level 0.
19:11:48 T:1844  NOTICE: Log level changed to "LOG_LEVEL_NORMAL"
19:11:48 T:1844  NOTICE: CMediaSourceSettings: loading media sources from special://masterprofile/sources.xml
19:11:48 T:1844  NOTICE: Loading player core factory settings from special://xbmc/system/playercorefactory.xml.
19:11:48 T:1844  NOTICE: Loaded playercorefactory configuration
19:11:48 T:1844  NOTICE: Loading player core factory settings from special://masterprofile/playercorefactory.xml.
19:11:48 T:1844  NOTICE: special://masterprofile/playercorefactory.xml does not exist. Skipping.
19:11:48 T:8272  NOTICE: Thread ActiveAE start, auto delete: false
19:11:48 T:16928  NOTICE: Thread AESink start, auto delete: false
19:11:48 T:8272  NOTICE: Found 2 Lists of Devices
19:11:48 T:8272  NOTICE: Enumerated DIRECTSOUND devices:
19:11:48 T:8272  NOTICE:     Device 1
19:11:48 T:8272  NOTICE:         m_deviceName      : {6C26BA7D-F0B2-4225-B422-8168C5261E45}
19:11:48 T:8272  NOTICE:         m_displayName     : Network Device - Remote Audio
19:11:48 T:8272  NOTICE:         m_displayNameExtra: DIRECTSOUND: Remote Audio
19:11:48 T:8272  NOTICE:         m_deviceType      : AE_DEVTYPE_PCM
19:11:48 T:8272  NOTICE:         m_channels        : FL,FR
19:11:48 T:8272  NOTICE:         m_sampleRates     : 44100
19:11:48 T:8272  NOTICE:         m_dataFormats     : AE_FMT_FLOAT
19:11:48 T:8272  NOTICE:     Device 2
19:11:48 T:8272  NOTICE:         m_deviceName      : default
19:11:48 T:8272  NOTICE:         m_displayName     : default
19:11:48 T:8272  NOTICE:         m_displayNameExtra:
19:11:48 T:8272  NOTICE:         m_deviceType      : AE_DEVTYPE_PCM
19:11:48 T:8272  NOTICE:         m_channels        : FL,FR
19:11:48 T:8272  NOTICE:         m_sampleRates     : 44100
19:11:48 T:8272  NOTICE:         m_dataFormats     : AE_FMT_FLOAT
19:11:48 T:8272  NOTICE: Enumerated WASAPI devices:
19:11:48 T:8272  NOTICE:     Device 1
19:11:48 T:8272  NOTICE:         m_deviceName      : {6C26BA7D-F0B2-4225-B422-8168C5261E45}
19:11:48 T:8272  NOTICE:         m_displayName     : Network Device - Remote Audio
19:11:48 T:8272  NOTICE:         m_displayNameExtra: WASAPI: Remote Audio
19:11:48 T:8272  NOTICE:         m_deviceType      : AE_DEVTYPE_PCM
19:11:48 T:8272  NOTICE:         m_channels        : FL,FR
19:11:48 T:8272  NOTICE:         m_sampleRates     :
19:11:48 T:8272  NOTICE:         m_dataFormats     :
19:11:48 T:8272  NOTICE:     Device 2
19:11:48 T:8272  NOTICE:         m_deviceName      : default
19:11:48 T:8272  NOTICE:         m_displayName     : default
19:11:48 T:8272  NOTICE:         m_displayNameExtra:
19:11:48 T:8272  NOTICE:         m_deviceType      : AE_DEVTYPE_PCM
19:11:48 T:8272  NOTICE:         m_channels        : FL,FR
19:11:48 T:8272  NOTICE:         m_sampleRates     :
19:11:48 T:8272  NOTICE:         m_dataFormats     :
19:11:48 T:1844  NOTICE: Running database version Addons16
19:11:48 T:1844  NOTICE: ADDONS: Using repository repository.addonscriptorde-beta
19:11:48 T:1844  NOTICE: ADDONS: Using repository repository.xbmc.org
19:11:48 T:19404  NOTICE: Thread RemoteControl start, auto delete: false
19:11:48 T:12800  NOTICE: Thread PeripBusCEC start, auto delete: false
19:11:48 T:256  NOTICE: Thread PeripBusUSB start, auto delete: false
19:11:48 T:1844  NOTICE: Found screen: Dummy Monitor on RDPUDD Chained DD, adapter 0.
19:11:48 T:18780  NOTICE: Thread JobWorker start, auto delete: true
19:11:48 T:1844  NOTICE: Primary mode: 1280x1024@ 32.00 - Full Screen
19:11:48 T:1844  NOTICE: Additional mode: 1280x1024@ 32.00 - Full Screen
19:11:48 T:1844  NOTICE: Checking resolution 16
19:11:48 T:1844  NOTICE: Running database version Addons16
19:11:48 T:1844  NOTICE: Running database version ViewModes6
19:11:48 T:1844  NOTICE: Running database version Textures13
19:11:48 T:1844  NOTICE: Running database version MyMusic48
19:11:48 T:1844  NOTICE: Running database version MyVideos90
19:11:48 T:1844  NOTICE: Running database version TV26
19:11:48 T:1844  NOTICE: Running database version Epg8
19:11:48 T:1844 WARNING: JSONRPC: Could not parse type "PVR.Details.Channel"
19:11:48 T:1844 WARNING: JSONRPC: Could not parse type "PVR.Details.ChannelGroup.Extended"
19:11:48 T:1844 WARNING: JSONRPC: Could not parse type "GUI.Property.Value"
19:11:49 T:1844 WARNING: JSONRPC: Could not parse type "Setting.Details.SettingList"
19:11:49 T:14828  NOTICE: Thread LanguageInvoker start, auto delete: false
19:11:49 T:1844  NOTICE: Previous line repeats 9 times.
19:11:49 T:1844  NOTICE: initialize done
19:11:49 T:16132  NOTICE: Thread LanguageInvoker start, auto delete: false
19:11:49 T:1844  NOTICE: Running the application...
19:11:49 T:1844  NOTICE: starting zeroconf publishing
19:11:49 T:17900  NOTICE: Thread LanguageInvoker start, auto delete: false
19:11:49 T:1844  NOTICE: Webserver: Starting...
19:11:49 T:19464  NOTICE: Thread JobWorker start, auto delete: true
19:11:49 T:1844  NOTICE: WebServer: Started the webserver
19:11:49 T:1844  NOTICE: starting upnp controller
19:11:49 T:12804  NOTICE: Thread JobWorker start, auto delete: true
19:11:49 T:1844  NOTICE: starting upnp server
19:11:49 T:1844  NOTICE: starting upnp renderer
19:11:49 T:1844  NOTICE: ES: Starting event server
19:11:49 T:17744  NOTICE: Thread EventServer start, auto delete: false
19:11:49 T:11996  NOTICE: Thread TCPServer start, auto delete: false
19:11:49 T:17744  NOTICE: ES: Starting UDP Event server on 0.0.0.0:9777
19:11:49 T:17744  NOTICE: UDP: Listening on port 9777
19:11:49 T:9212  NOTICE: Thread RSSReader start, auto delete: false
19:11:49 T:19464   ERROR: CDVDDemuxFFmpeg::Open - Error, could not open file F:\TV\The Returned (US)\The Returned (US) - 1x03 - Julie.mkv
19:11:49 T:8968  NOTICE: -->Python Interpreter Initialized<--
19:11:50 T:15224  NOTICE: Thread LanguageInvoker start, auto delete: false
19:11:51 T:4680  NOTICE: -->Python Interpreter Initialized<--
19:11:51 T:11224  NOTICE: Previous line repeats 10 times.
19:11:51 T:11224  NOTICE: script.tv.show.next.aired: ### TV Show - Next Aired starting background proc (6.0.13)
19:11:51 T:14828  NOTICE: service.libraryautoupdate-0.9.4 : Update Library Service starting...
19:11:52 T:14828  NOTICE: service.libraryautoupdate-0.9.4 : update timers
19:11:52 T:14828  NOTICE: service.libraryautoupdate-0.9.4 : Creating timer for Video Library
19:11:52 T:15224  NOTICE: -->Python Interpreter Initialized<--
19:11:52 T:13896  NOTICE:  StorageServer Module loaded RUN
19:11:52 T:13896  NOTICE: StorageClient-2.5.4 Starting server
19:11:52 T:7616  NOTICE: 1Channel: Service: Installed Version: 2.5.55
19:11:53 T:7616  NOTICE: 1Channel: Loading sqlite3 as DB engine
19:11:53 T:7616  NOTICE: 1Channel: Service: Resetting...
19:11:53 T:7616  NOTICE: 1Channel: Service: starting...
19:11:54 T:15224  NOTICE: weather.metoffice: Fetching Hourly Observation for 'Heathrow (3772)' from the Met Office...
19:11:54 T:15224  SEVERE: weather.metoffice: Traceback (most recent call last):
                                              File "C:\Users\Media\AppData\Roaming\Kodi\addons\weather.metoffice\src\metoffice\utilities.py", line 22, in wrapper
                                                return f(*args, **kwds)
                                              File "C:\Users\Media\AppData\Roaming\Kodi\addons\weather.metoffice\src\metoffice\default.py", line 37, in main
                                                properties.observation()
                                              File "C:\Users\Media\AppData\Roaming\Kodi\addons\weather.metoffice\src\metoffice\utilities.py", line 52, in wrapper
                                                return f(*args, **kwargs)
                                              File "C:\Users\Media\AppData\Roaming\Kodi\addons\weather.metoffice\src\metoffice\properties.py", line 23, in observation
                                                data=json.load(open(filename))
                                              File "C:\Users\Media\AppData\Roaming\Kodi\addons\weather.metoffice\src\metoffice\urlcache.py", line 37, in __exit__
                                                self.flush()
                                              File "C:\Users\Media\AppData\Roaming\Kodi\addons\weather.metoffice\src\metoffice\urlcache.py", line 51, in flush
                                                if not os.path.isfile(entry['resource']) or utilities.strptime(entry['expiry'], self.TIME_FORMAT) < datetime.utcnow():
                                              File "C:\Users\Media\AppData\Roaming\Kodi\addons\weather.metoffice\src\metoffice\utilities.py", line 16, in strptime
                                                return datetime.fromtimestamp(time.mktime(time.strptime(dt, fmt)))
                                            ImportError: Failed to import _strptime because the import lockis held by another thread.
19:11:54 T:16132  NOTICE: $$$ [xbmc.callbacks2] - Starting xbmc.callbacks2 version 0.0.6
19:11:55 T:10648  NOTICE: Thread VideoInfoScanner start, auto delete: false
19:11:55 T:10648  NOTICE: CVideoDatabase::CleanDatabase: Starting videodatabase cleanup ..
19:11:55 T:10648 WARNING: XFILE::CFileFactory::CreateLoader - unsupported protocol(plugin) in plugin://plugin.video.iplayer/?pid=b0441m7x
19:11:55 T:10648 WARNING: XFILE::CFileFactory::CreateLoader - unsupported protocol(plugin) in plugin://plugin.video.iplayer/?pid=bbc_news24&feed_channel=bbc_news24
19:11:55 T:10648 WARNING: XFILE::CFileFactory::CreateLoader - unsupported protocol(plugin) in plugin://plugin.video.iplayer/?pid=bbc_one&feed_channel=bbc_one
19:11:56 T:10648 WARNING: XFILE::CFileFactory::CreateLoader - unsupported protocol(plugin) in plugin://plugin.video.youtube/?action=play_video&videoid=2TQ-pOvI6Xo
19:11:56 T:10648 WARNING: XFILE::CFileFactory::CreateLoader - unsupported protocol(plugin) in plugin://plugin.video.youtube/?action=play_video&videoid=9u4FHmId-Y0
19:11:56 T:10648 WARNING: XFILE::CFileFactory::CreateLoader - unsupported protocol(plugin) in plugin://plugin.video.youtube/?action=play_video&videoid=WT_xpFZe20A
19:11:56 T:10648 WARNING: XFILE::CFileFactory::CreateLoader - unsupported protocol(plugin) in plugin://plugin.video.youtube/?action=play_video&videoid=ayTnvVpj9t4
19:11:56 T:10648 WARNING: XFILE::CFileFactory::CreateLoader - unsupported protocol(plugin) in plugin://plugin.video.youtube/?action=play_video&videoid=gLvmVnKT4cc
19:11:56 T:10648 WARNING: XFILE::CFileFactory::CreateLoader - unsupported protocol(plugin) in plugin://plugin.video.youtube/?action=play_video&videoid=tSVeDx9fk60
19:11:56 T:10648 WARNING: XFILE::CFileFactory::CreateLoader - unsupported protocol(plugin) in plugin://plugin.video.youtube/?action=play_video&videoid=whgBnumr3QQ
19:11:56 T:10648 WARNING: XFILE::CFileFactory::CreateLoader - unsupported protocol(plugin) in plugin://plugin.video.youtube/?action=play_video&videoid=xT5qhPoRS9g
19:11:56 T:10648  NOTICE: CVideoDatabase::CleanDatabase: Cleaning videodatabase done. Operation took 00:00
19:11:57 T:15100  NOTICE: Thread MusicInfoScanner start, auto delete: false
19:11:57 T:15100  NOTICE: CMusicDatabase::Cleanup: Starting musicdatabase cleanup ..
19:11:57 T:15100  NOTICE: CMusicDatabase::Cleanup: Cleaning musicdatabase done. Operation took 00:00
19:11:58 T:12824  NOTICE: Thread BackgroundLoader start, auto delete: false
19:12:01 T:3064  NOTICE: Previous line repeats 1 times.
19:12:01 T:3064  NOTICE: Thread VideoInfoScanner start, auto delete: false
19:12:01 T:3064  NOTICE: VideoInfoScanner: Starting scan ..
19:12:02 T:3064 WARNING: No information found for item 'F:\TV\Agents of Shield\', it won't be added to the library.
19:12:02 T:3064  NOTICE: VideoInfoScanner: Finished scan. Scanning for video info took 00:00
19:12:03 T:14828  NOTICE: service.libraryautoupdate-0.9.4 : update timers
19:12:03 T:14828  NOTICE: service.libraryautoupdate-0.9.4 : Creating timer for Video Library
19:12:04 T:11120  NOTICE: Thread BackgroundLoader start, auto delete: false
19:12:18 T:16132  NOTICE: $$$ [xbmc.callbacks2] - Stopped xbmc.callbacks2
19:12:18 T:19524  NOTICE: Thread BackgroundLoader start, auto delete: false
19:12:20 T:2892  NOTICE: Thread LanguageInvoker start, auto delete: false
19:12:20 T:2892  NOTICE: -->Python Interpreter Initialized<--
19:12:21 T:18780   ERROR: CDVDDemuxFFmpeg::Open - Error, could not open file F:\TV\The Returned (US)\The Returned (US) - 1x03 - Julie.mkv
19:12:23 T:12668  NOTICE: Thread BackgroundLoader start, auto delete: false
19:12:36 T:18840  NOTICE: Thread LanguageInvoker start, auto delete: false
19:12:36 T:19580  NOTICE: Thread BackgroundLoader start, auto delete: false
19:12:36 T:18840  NOTICE: -->Python Interpreter Initialized<--
19:12:36 T:18840  NOTICE: $$$ [xbmc.callbacks2] - Starting xbmc.callbacks2 version 0.0.6
19:12:37 T:14528  NOTICE: Thread BackgroundLoader start, auto delete: false
19:12:47 T:9424  NOTICE: Previous line repeats 1 times.
19:12:47 T:9424  NOTICE: Thread LanguageInvoker start, auto delete: false
19:12:47 T:9424  NOTICE: -->Python Interpreter Initialized<--
19:12:47 T:9424 WARNING: CPythonInvoker(15): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
19:12:47 T:9424  NOTICE: $$$ xbmc.callbacks2 - Starting tester.py from cwd: C:\Users\Media\AppData\Roaming\Kodi\addons\service.xbmc.callbacks2-master
19:12:48 T:9424  NOTICE: $$$ [xbmc.callbacks2] - Executing command: [C:\Users\Media\Desktop\Cinemapy.py] for event: onPlaybackStarted
19:12:48 T:9424  NOTICE: $$$ [xbmc.callbacks2] - Command for onPlaybackStarted executed successfully
19:12:48 T:18724  NOTICE: Thread LanguageInvoker start, auto delete: false
19:12:48 T:18724  NOTICE: -->Python Interpreter Initialized<--
19:12:48 T:18724 WARNING: CPythonInvoker(16): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
19:12:48 T:18724   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.WindowsError'>
                                            Error Contents: [Error 2] The system cannot find the file specified
                                            Traceback (most recent call last):
                                              File "C:\Users\Media\Desktop\Cinemapy.py", line 2, in <module>
                                                p = Popen("Cinema.bat", cwd=r"c:\users\media\desktop")
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\subprocess.py", line 710, in __init__
                                                errread, errwrite)
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\subprocess.py", line 958, in _execute_child
                                                startupinfo)
                                            WindowsError: [Error 2] The system cannot find the file specified
                                            -->End of Python script error report<--
19:13:11 T:10932  NOTICE: Thread LanguageInvoker start, auto delete: false
19:13:11 T:10932  NOTICE: -->Python Interpreter Initialized<--
19:13:11 T:10932 WARNING: CPythonInvoker(17): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
19:13:11 T:10932  NOTICE: $$$ xbmc.callbacks2 - Starting tester.py from cwd: C:\Users\Media\AppData\Roaming\Kodi\addons\service.xbmc.callbacks2-master
19:13:12 T:10932  NOTICE: $$$ [xbmc.callbacks2] - Executing command: [[u'C:\\Users\\Media\\Desktop\\Cinemapy.py']] for event: onPlaybackStarted
19:13:12 T:10932  NOTICE: $$$ [xbmc.callbacks2] - Command for onPlaybackStarted resulted in ERROR: <attribute 'message' of 'exceptions.BaseException' objects>
                                            Traceback (most recent call last):
                                              File "C:\Users\Media\AppData\Roaming\Kodi\addons\service.xbmc.callbacks2-master\default.py", line 480, in run
                                                result = subprocess.check_output(margs, shell=self.needs_shell, stderr=subprocess.STDOUT)
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\subprocess.py", line 566, in check_output
                                                process = Popen(stdout=PIPE, *popenargs, **kwargs)
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\subprocess.py", line 710, in __init__
                                                errread, errwrite)
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\subprocess.py", line 958, in _execute_child
                                                startupinfo)
                                            WindowsError: [Error 193] %1 is not a valid Win32 application
19:14:27 T:18840  NOTICE: $$$ [xbmc.callbacks2] - Invalid url: www.google.com
19:14:27 T:18840  NOTICE: $$$ [xbmc.callbacks2] - Due to errors, unable to register command: www.google.com
19:14:30 T:5252  NOTICE: Thread LanguageInvoker start, auto delete: false
19:14:30 T:5252  NOTICE: -->Python Interpreter Initialized<--
19:14:30 T:5252 WARNING: CPythonInvoker(18): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
19:14:30 T:5252  NOTICE: $$$ xbmc.callbacks2 - Starting tester.py from cwd: C:\Users\Media\AppData\Roaming\Kodi\addons\service.xbmc.callbacks2-master
19:14:30 T:5252  NOTICE: $$$ [xbmc.callbacks2] - Invalid url: www.google.com
19:14:30 T:5252  NOTICE: $$$ [xbmc.callbacks2] - Due to errors, unable to register command: www.google.com
19:17:04 T:4916  NOTICE: Thread JobWorker start, auto delete: true
19:17:19 T:13988  NOTICE: Thread LanguageInvoker start, auto delete: false
19:17:19 T:13988  NOTICE: -->Python Interpreter Initialized<--
19:17:19 T:13988 WARNING: CPythonInvoker(19): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
19:17:19 T:13988  NOTICE: $$$ xbmc.callbacks2 - Starting tester.py from cwd: C:\Users\Media\AppData\Roaming\Kodi\addons\service.xbmc.callbacks2-master
19:17:20 T:13988  NOTICE: $$$ [xbmc.callbacks2] - Executing command: [[u'C:\\Users\\Media\\Desktop\\Cinema.exe']] for event: onPlaybackStarted
19:17:20 T:13988  NOTICE: $$$ [xbmc.callbacks2] - Command for onPlaybackStarted resulted in ERROR: 'lwrf' is not recognized as an internal or external command,

                                            operable program or batch file.
19:17:57 T:20076  NOTICE: Thread LanguageInvoker start, auto delete: false
19:17:57 T:20076  NOTICE: -->Python Interpreter Initialized<--
19:17:57 T:20076 WARNING: CPythonInvoker(20): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
19:17:57 T:20076  NOTICE: $$$ xbmc.callbacks2 - Starting tester.py from cwd: C:\Users\Media\AppData\Roaming\Kodi\addons\service.xbmc.callbacks2-master
19:17:57 T:20076  NOTICE: $$$ [xbmc.callbacks2] - Executing command: [[u'C:\\Users\\Media\\Desktop\\Cinema.exe']] for event: onPlaybackStarted
19:17:58 T:20076  NOTICE: $$$ [xbmc.callbacks2] - Command for onPlaybackStarted resulted in ERROR: 'lwrf' is not recognized as an internal or external command,

                                            operable program or batch file.
19:22:22 T:12668  NOTICE: Thread JobWorker start, auto delete: true
19:24:12 T:12700  NOTICE: Thread LanguageInvoker start, auto delete: false
19:24:12 T:12700  NOTICE: -->Python Interpreter Initialized<--
19:24:13 T:1844  NOTICE: Storing total System Uptime
19:24:13 T:1844  NOTICE: Saving settings
19:24:13 T:1844  NOTICE: stop all
19:24:13 T:1844  NOTICE: stop player
19:24:13 T:1844  NOTICE: ES: Stopping event server
19:24:13 T:1844  NOTICE: stopping upnp
19:24:13 T:17744  NOTICE: ES: UDP Event server stopped
19:24:13 T:1844  NOTICE: stopping zeroconf publishing
19:24:13 T:1844  NOTICE: Webserver: Stopping...
19:24:13 T:1844  NOTICE: WebServer: Stopped the webserver
19:24:13 T:1844  NOTICE: Webserver: Stopped...
19:24:13 T:1844  NOTICE: stop sap announcement listener
19:24:13 T:1844  NOTICE: clean cached files!
19:24:13 T:1844  NOTICE: unload skin
19:24:14 T:7616  NOTICE: 1Channel: Service: shutting down...
19:24:15 T:13716 WARNING: CPythonInvoker(2, C:\Users\Media\AppData\Roaming\Kodi\addons\service.skin.widgets\default.py): the python script "C:\Users\Media\AppData\Roaming\Kodi\addons\service.skin.widgets\default.py" has left several classes in memory that we couldn't clean up. The classes include: class XBMCAddon::xbmcgui::Window,class PythonBindings::XBMCAddon_xbmc_Player_Director,class PythonBindings::XBMCAddon_xbmc_Monitor_Director
19:24:15 T:13896  NOTICE: StorageServer-2.5.4 Closed down
19:24:16 T:7368 WARNING: CPythonInvoker(5, C:\Users\Media\AppData\Roaming\Kodi\addons\service.library.data.provider\service.py): the python script "C:\Users\Media\AppData\Roaming\Kodi\addons\service.library.data.provider\service.py" has left several classes in memory that we couldn't clean up. The classes include: class XBMCAddon::xbmcgui::Window,class PythonBindings::XBMCAddon_xbmc_Monitor_Director,class PythonBindings::XBMCAddon_xbmc_Player_Director
19:24:17 T:11224  NOTICE: script.tv.show.next.aired: ### abort requested -- stopping background processing
19:24:17 T:18840  NOTICE: $$$ [xbmc.callbacks2] - Stopped xbmc.callbacks2
19:24:17 T:1844  NOTICE: stopped
19:24:17 T:1844  NOTICE: destroy
19:24:17 T:1844  NOTICE: closing down remote control service
19:24:17 T:1844  NOTICE: unload sections
19:24:17 T:1844  NOTICE: special://profile/ is mapped to: special://masterprofile/
19:24:17 T:1844  NOTICE: destroy
19:24:17 T:1844 WARNING: Attempted to remove window 10013 from the window manager when it didn't exist
19:24:17 T:1844 WARNING: Attempted to remove window 10014 from the window manager when it didn't exist
19:24:17 T:1844 WARNING: Attempted to remove window 10015 from the window manager when it didn't exist
19:24:17 T:1844 WARNING: Attempted to remove window 10016 from the window manager when it didn't exist
19:24:17 T:1844 WARNING: Attempted to remove window 10017 from the window manager when it didn't exist
19:24:17 T:1844 WARNING: Attempted to remove window 10018 from the window manager when it didn't exist
19:24:17 T:1844 WARNING: Attempted to remove window 10019 from the window manager when it didn't exist
19:24:17 T:1844 WARNING: Attempted to remove window 10021 from the window manager when it didn't exist
19:24:17 T:1844 WARNING: Attempted to remove window 10107 from the window manager when it didn't exist
19:24:17 T:1844 WARNING: Attempted to remove window 10115 from the window manager when it didn't exist
19:24:17 T:1844 WARNING: Attempted to remove window 10104 from the window manager when it didn't exist
19:24:17 T:1844  NOTICE: closing down remote control service
19:24:17 T:1844  NOTICE: unload sections
19:24:17 T:1844  NOTICE: application stopped...
19:24:17 T:1844   ERROR: dllFreeLibrary - Invalid hModule specified

Any help is really appreciated as I'd love to get this working , and I feel like its quite obvious

Thanks

Keir
Reply
I'll try to look further into this on Thursday or so. I'm travelling. Please post logs to pastebin in the future and put a link here instead of a full log.

At first glance you don't have the path/file correct for the first call and I'll look into the ill call but looks improperly formatted.
Reply
Hi Ken

I've tried directing XBMC to run CMD from system 32 and using the batch command as the arguments but to no avail , what am I doing wrong ? Im a little confused.

Thanks
Reply
Hi All,

I don't use this addon myself, but I currently have an addon:

VideoScreensaver

This (as the name suggests) plays a video for the screenaver. Due to the way it has the do things, it might cause users of your addon to not get the messages they expected when the screensaver starts/stops.

This was highlighted to me in the following posts:

http://forum.kodi.tv/showthread.php?tid=...pid1984517
http://forum.kodi.tv/showthread.php?tid=...pid1986618

There is not much I can do about the notification messages being generated, but I have added some flags so other addon developers can detect what VideoScreensaver is doing:

http://kodi.wiki/view/Add-on:VideoScreen...Is_Running

I hope this helps anyone else seeing this problem.

Thanks

Rob
Reply
I'm trying to do the simplest thing possible with this addon; but can't get it to work... execute a Windows executable on Player start. And, execute a Windows executable on Player stop. I'm not a python/Linux expert. I'm using Windows 8.1

I tried the most obvious approach below (just point directly to the Windows EXE)... which didn't do anything.
Image

EDIT: It looks like the problem is that I'm using Helix. I upgraded to the below addon; which worked immediately.

https://github.com/KenV99/service.xbmc.callbacks2
Reply
Is there a way to have a script that only runs when I'm playing (streaming) from a particular add-on? If I'm playing a file out of my library then I don't need my script to run but if I'm streaming then I want to run a script that pauses other internet activity. I'm guessing there isn't a native way to do this but maybe there's a work around where the script runs every time something plays and then the script checks to see what is playing and only executes the meat of the script based on what is playing. Is there a way for a python sc
Reply
Hi Ken,
how could I execute a script at Kodi shutdown?
I would need it to shutdown an amplifyer.
I can start it through a startup script outside kodi but the turn off-feature is still missing
Regards
Reply
I agree with tomrey. SHutdown script is needed. I want to use the shutdown script so a user can select a different remote.
Reply
Is there some way to detect if kodi is in Kiosk mode? Like to disable automatic shutdown when chrome launcher is started.
Reply
(2015-05-09, 12:11)tomrey Wrote: Hi Ken,
how could I execute a script at Kodi shutdown?
I would need it to shutdown an amplifyer.
I can start it through a startup script outside kodi but the turn off-feature is still missing
Regards

(2015-05-10, 17:44)tekno Wrote: I agree with tomrey. SHutdown script is needed. I want to use the shutdown script so a user can select a different remote.

These might be possible if whatever code you are running is not going to be python running on the Kodi python interpreter.
Kodi terminates all scripts if they don't shutdown in 5 seconds, so unless you are launching an independent process, whatever you are doing has to complete fast.
And no, there is no way to change that or abort the shutdown. So waiting for a user prompt to select something would have to programmed with it's own independent GUI.
Of note, Kodi does NOT play nice with the multiprocessing module, so don't go down that path.
Reply
  • 1
  • 12
  • 13
  • 14(current)
  • 15
  • 16
  • 23

Logout Mark Read Team Forum Stats Members Help
[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)4