Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1
  • 3
  • 4
  • 5(current)
  • 6
  • 7
  • 22
Release Execute user tasks for Kodi events (callbacks ver2)
#61
(2016-02-18, 19:48)bigbadrabbit Wrote: I cannot get any of my scripts to execute. They work perfectly with previous versions of your plugin from the old thread.

Here's one of my scripts (Player_START.sh) that should get executed when the player starts:
Code:
#!/bin/bash

/usr/bin/osascript <<-EOF

tell application "Hue Server" to run command "Wohnzimmer Off"
delay 0.2

do shell script "curl http://localhost:5005/Wohnzimmer/pause"
delay 0.2

do shell script "curl http://192.168.0.20/goform/formiPhoneAppDirect.xml?SDHDMI"
do shell script "curl http://192.168.0.20/goform/formiPhoneAppDirect.xml?MSDOLBY%20DIGITAL"


EOF

And here're the errors:
Code:
18:46:39 T:123145304526848   ERROR: /Users/macmini_home/Library/Application Support/Kodi/addons/script.service.kodi.callbacks-nonrepo/resources/lib/watchdog/observers/__init__.py:83: UserWarning: Failed to import fsevents and kqueue. Fall back to polling.
                                              warnings.warn("Failed to import fsevents and kqueue. Fall back to polling.")
18:46:39 T:123145304526848   ERROR: Previous line repeats 1 times.
18:46:39 T:123145304526848  NOTICE: $$$ [kodi.callbacks] - Running Test for Event: E1
18:46:39 T:123145304526848  NOTICE: $$$ [kodi.callbacks] - Settings for test read
18:46:39 T:123145304526848  NOTICE: $$$ [kodi.callbacks] - Creating subscriber for test
18:46:39 T:123145304526848  NOTICE: $$$ [kodi.callbacks] - Test subscriber created successfully
18:46:39 T:123145304526848  NOTICE: $$$ [kodi.callbacks] - Running test
18:46:39 T:123145304526848 WARNING: CSkinInfo: failed to load skin settings
18:46:39 T:123145304526848   ERROR: /Users/macmini_home/Library/Application Support/Kodi/addons/script.service.kodi.callbacks-nonrepo/resources/lib/dialogtb.py:47: DeprecationWarning: object.__init__() takes no parameters
                                              super(MessageDialog, self).__init__(*args, **kwargs)
18:46:40 T:123145308819456 WARNING: DARWINOSX: underflow (0 vs 4096 bytes)

As I have mentioned before, please post a full log to pastebin and post the link here.
Nothing in the partial above explains why your script failed.
There are other things I need to look at to help debug.

And the forum moderators have many times asked not to post logs in the forum.

Thanks for your help with complying with this.

EDIT:
The above two are warnings and should not be responsible for your script failing. The first warning is expected. In order to use fsevents on OSX you would need to install the full version of watchdog in OSX and then build the binary which requires that you have XCode installed.

The second is a peculiarity on OSX when using a super call with an xbmc module. Although xbmcgui.MessageDialog does indeed take arguments it must not communicate that properly to the python flavor distributed with Kodi.

The output of the textbox that opens after the 'Test' would be important. I would also need to know if you are using shell or not and also the full path name to your script.
Reply
#62
@KenV99,

thanks again for the update. Now it seems to be working fine. I did some testing and it went well. The addon is using the system time to trigger the given events.

As to the partial log: Sorry, I think it was my fault (not bigbadrabbit's) because I used post excerpts from my log before. I did not know about the policy that this is forbidden. Life in forums is so complicated nowadays :-)

Regards,

FantasticN
Reply
#63
(2016-02-18, 21:14)KenV99 Wrote: As I have mentioned before, please post a full log to pastebin and post the link here.
Nothing in the partial above explains why your script failed.
There are other things I need to look at to help debug.

The output of the textbox that opens after the 'Test' would be important. I would also need to know if you are using shell or not and also the full path name to your script.

Sorry for posting logs directly.

So, here we go:
log
testbox output 1
testbox output 2

Full path name script:
/Users/macmini_home/Library/Application Support/Kodi/scripts/Player_START.sh

I'm not using shell as the script only worked when the shell option was deactivated (old plugin).

Thanks!
Reply
#64
Just tried the latest version from the nonrepo branch and my scripts are working again! Thanks KenV99!
Reply
#65
I just posted another update that corrects a potential error with quoted strings.
I think bigbadrabbit's issue was that there was a space in the path that wasn't handled correctly.
The safest way to handle that is to put quotes around the path, but I also have a routine to try to reassemble the path is the parser breaks them.
Reply
#66
Thank you for the addon. I am controlling the LED-backlight from the LCD with kodi.callbacks via GPIO.
Working great. (Raspberry Pi 1B, OSMC with KODI 16.0)

Reply
#67
Is it possible to add an option like "on refresh rate change"?

I'd need to run some script when Playback Ends and Kodi is switching the refresh rate back. Thanks.
Reply
#68
(2016-02-23, 21:14)bigbadrabbit Wrote: Is it possible to add an option like "on refresh rate change"?

I'd need to run some script when Playback Ends and Kodi is switching the refresh rate back. Thanks.

If the onPlayBackStopped event doesn't do it for you, unfortunately, there is no direct way that I can find to query what the current refresh rate is in Python.
I checked both PyDocs and JSON and nada.

So that leaves the log. Look thru the log and see if you can find a line that comes up when the refresh rate changes. Can't do this easily for you atm since my computer is a fixed refresh rate and my HTPC is currently not available.
You can then use the onLogSimple or onLogRegex event to detect the refresh change if it appears in the log.

EDIT:
Although the log shows 'Display resolution ADJUST : 3840x2160@ 60.00 - Full Screen (16) (weight: 0.200)' for me at the start of playback, I do not see any log entries corresponding to it switching back at the end of playback. At least on my PC.It might be different if there were other refresh rates.
You're going to have to look thru your logs for lines similar to the above..
Reply
#69
(2016-02-23, 19:29)TB-303 Wrote: Thank you for the addon. I am controlling the LED-backlight from the LCD with kodi.callbacks via GPIO.
Working great. (Raspberry Pi 1B, OSMC with KODI 16.0)


Very nice Smile I have always wanted to do something like that, but I'm kinda near sighted and my TV and pi are far enough away that I would need a BIG display to read it from across the room.
Reply
#70
I uploaded a MAJOR update to GitHub.
Both nonrepo and master branches are the same ATM but will continue development on the nonrepo branch until I hear if the addon was accepted into the official repo.
Unfortunately you will get an error on first update and will have to hit defaults and put your settings back in if you wish to update.
Sorry about that.
Changes are in the first post and on the wiki.
Reply
#71
Hi KenV99,

I've being using your addon for a couple of weeks and I found it great. I send JSON request from an remote control app on my phone.

https://github.com/goldenratio/xbmc-web-remote

So far, using the "on Log Simple" option of your addon, I can catch the JSON request and run some scripts. Now, I'm trying to use the option of "JSON Notification" of your addon instead.

That option requires "sender", "method" and "data".

When some JSON request is sent, something like this appears in kodi.log


JSONRPC: Incoming request: {"jsonrpc":"2.0","method":"Player.GetActivePlayers","id":"1"}

or

JSONRPC: Incoming request: {"jsonrpc":"2.0","method":"Input.ExecuteAction","id":"1","params":{"action":"stepforward"}}


I think in the log the "method" is clear, but I cannot figure out who are the "sender" and "data" that the addon requires. Is it possible to find those in the log?

Many thanks.
Reply
#72
(2016-02-28, 19:37)Milox Wrote: Hi KenV99,

I've being using your addon for a couple of weeks and I found it great. I send JSON request from an remote control app on my phone.

https://github.com/goldenratio/xbmc-web-remote

So far, using the "on Log Simple" option of your addon, I can catch the JSON request and run some scripts. Now, I'm trying to use the option of "JSON Notification" of your addon instead.

That option requires "sender", "method" and "data".

When some JSON request is sent, something like this appears in kodi.log


JSONRPC: Incoming request: {"jsonrpc":"2.0","method":"Player.GetActivePlayers","id":"1"}

or

JSONRPC: Incoming request: {"jsonrpc":"2.0","method":"Input.ExecuteAction","id":"1","params":{"action":"stepforward"}}


I think in the log the "method" is clear, but I cannot figure out who are the "sender" and "data" that the addon requires. Is it possible to find those in the log?

Many thanks.

sender is usually xbmc.
I'll warn you that the Python JSON notification interface misses some messages, so you'll have to play around with it (already reported as a bug).
In reporting that bug, I created a small addon that logs everything that comes into the python json monitor.
https://github.com/KenV99/service.monitorjsonlogger
That might be helpful to you to install it and see what shows in the log.
The sender, method and data are separated by commas in the log.
Example:
Code:
12:23:08 T:62412  NOTICE: *** JSON Notification Received: xbmc, Application.OnVolumeChanged, {"muted":true,"volume":31.714401245117188}
Reply
#73
What do i need to enter into the "Var sub arg string" field if i want to execute a script only if it's a local video from the library and not something like PVR streams or addon video streams?
Reply
#74
(2016-03-09, 16:48)bigbadrabbit Wrote: What do i need to enter into the "Var sub arg string" field if i want to execute a script only if it's a local video from the library and not something like PVR streams or addon video streams?

%mt

This returns music|pvr|movie|episode|stream|unknown

So in your script when you process the command line arguments you would execute only if the argument is equal to movie or episode.
Reply
#75
(2016-03-09, 22:00)KenV99 Wrote: %mt

This returns music|pvr|movie|episode|stream|unknown

So in your script when you process the command line arguments you would execute only if the argument is equal to movie or episode.

Thanks. I simply have zero experience with such arguments in scripts. All of my scripts are simple Applescripts which get called from within the bash via oascript:
Code:
#!/bin/bash

/usr/bin/osascript <<-EOF

tell application "AirServer" to stop broadcast
do shell script "curl http://192.168.0.20/goform/formiPhoneAppDirect.xml?PSDYNVOL%20OFF"

tell application "iTunes"
    pause
end tell

tell application "Hue Server" to run command "Wohnzimmer Off"
tell application "AirServer" to start broadcast
EOF

Could you please tell me WHERE i'd need to put in the proper argument to filter out movie or episode? Many thanks again!
Reply
  • 1
  • 3
  • 4
  • 5(current)
  • 6
  • 7
  • 22

Logout Mark Read Team Forum Stats Members Help
Execute user tasks for Kodi events (callbacks ver2)3
This forum uses Lukasz Tkacz MyBB addons.