Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1
  • 5
  • 6
  • 7(current)
  • 8
  • 9
  • 22
Release Execute user tasks for Kodi events (callbacks ver2)
#91
(2016-03-27, 21:03)brazen1 Wrote: Hi.
Ran across your add-on and thought I'd give it a try. I seem to be having problems after spending a couple hours trying to config.

My goal is to enable Windows 10 Stereoscopic mode when playing back a 3D.iso and disable it when finished with playback.
I have working .bat files to enable and disable using Nvidia's nvstlink.exe.
I point to these .bat files using your player start and player end tasks and they indeed switch using Script as the type.
The problems are:

Stereoscopic MUST be enabled before playback actually begins. This bat has to take priority before KODI itself does otherwise KODI starts 3D mode switching incorrectly. I assume there is no way around this since the title has to be called 1st to trigger the add-on after numerous tries?
I assume that you are using the onPlaybackStarted event?
Then yes, there is no way to intercept that with this addon before it plays.
The only way I could see you doing this is writing python that immediately stops the file from playing, then does what you need and then restart it.
You might be able to do it from a batch file if you are adept at writing curl commands and you could then use the JSON-RPC.
(2016-03-27, 21:03)brazen1 Wrote: I've added "*3D.iso" to the variable but stereoscopic switches into 3D upon start of a 2D.mkv which makes no sense to me but I'm not a coder.
I don't know what you mean here. In playercorefactory.xml?
(2016-03-27, 21:03)brazen1 Wrote: Can you help me achieve what I'm trying to do?

I'm on W10 using a variant of v.17 (afedchin's new 3D MVC build in the development thread)

This workaround may help Nvidia users be included in the upcoming KODI 3D MVC advancement and I'm eager to test if it can be accomplished.
Thanks for any assistance the community might offer.
Reply
#92
I am currently running this webhook simple server that can trigger scripts with arguments on the script endpoint url

So the I can call a script name "kodi" like http://172.17.0.11:5000/kodi/arg1/arg2/arg3 etc

The script will receive arg1 arg2 and arg3 as $1, $2 and $3 respectively.

I have a firetv with kodi 16 installed and the latest callbacks
I wanted to put as argument the title of the script onPlaybackStarted so i tried something like this
http://172.17.0.11:5000/kodi/%ti

Then i changed to http://172.17.0.11:5000/kodi with var subbed string just plain %ti and "%ti", the script does trigger but the argument doesn't make it to the script.

Is there a way to pass the arguments in the url path?

Edit:

I just found out that firetv has curl, so this for example works in the ADB console

Code:
curl  -X POST  --data "arg1=test"  http://172.17.0.10:5000/kodi

Could it be possible to single command execution? so i can do something like

Code:
curl  -X POST  --data "arg1=%ti&arg2=%fn"  http://172.17.0.10:5000/kodi

The firetv is not rooted so i cannot execute scripts.

Thanks
Reply
#93
I'm not sure if it was the problem but I pushed a small update.
Try updating and see if it fixes it.

The task would be configured as: "http://1732.17.0.11:5000"
and in the event "/kodi/%ti"

Using an echo server to check, I get:

Code:
127.0.0.1 - - [28/Mar/2016 09:53:40] "GET /kodi/City%20of%20Angels%20-%20Berlin.mp4 HTTP/1.1" 200 -
----- Request Start ----->

/kodi/City%20of%20Angels%20-%20Berlin.mp4
Host: 127.0.0.1:8082
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.9.1

<----- Request End -----

The file I'm testing isn't in a folder configured to get an actual title so you are seeing the filename.
Reply
#94
(2016-03-28, 15:58)KenV99 Wrote: I'm not sure if it was the problem but I pushed a small update.
Try updating and see if it fixes it.


Hi KenV99, thanks for your time. I downloaded the zip file from github and pushed the folder to firetv. I've launched also an echo server to test. No variable argument get's passed to the url, neither in the webhook server or the echo server, looks like the variable is not expanding. I've attached a full debug kodi log if you're interested.

This is with webhook server http://hastebin.com/iqixedinod.coffee

This is the echo server http://hastebin.com/xevasuvayi.coffee

The logs in the webhook and echo server don't show the any arguments after kodi/
Reply
#95
Question 
Hi!

From a hasty look, this might be what am looking for. But until I dig in to it I first like to confirm. Will it be possible to send a API command too Sonarr, namely some of this Sonarr API?
The Problem is not the problem. The problem is your attitude about the problem.
Do you understand?
Reply
#96
(2016-03-29, 07:46)Blackkatt Wrote: Hi!

From a hasty look, this might be what am looking for. But until I dig in to it I first like to confirm. Will it be possible to send a API command too Sonarr, namely some of this Sonarr API?

This what i am after. Should be ok this in any version of kodi where you can run scripts. The issue I am having is with firetv since you cannot execute scripts where the device is not rooted, so i am testing using webhooks.

KenV99 I though you push an update to the whole code, but you updated only the test button apparently? well the arguments get's passed this time with the Star Wars test. I also tried other vars like %fn and %mt and works ok.

Side note, the test button completely hangs kodi, i have to press the home button to go to FireOS, force stop kodi then relaunch.
Reply
#97
(2016-03-29, 08:09)subzero79 Wrote:
(2016-03-29, 07:46)Blackkatt Wrote: Hi!

From a hasty look, this might be what am looking for. But until I dig in to it I first like to confirm. Will it be possible to send a API command too Sonarr, namely some of this Sonarr API?

This what i am after. Should be ok this in any version of kodi where you can run scripts. The issue I am having is with firetv since you cannot execute scripts where the device is not rooted, so i am testing using webhooks.

KenV99 I though you push an update to the whole code, but you updated only the test button apparently? well the arguments get's passed this time with the Star Wars test. I also tried other vars like %fn and %mt and works ok.

Side note, the test button completely hangs kodi, i have to press the home button to go to FireOS, force stop kodi then relaunch.

Then one you made https://forums.sonarr.tv/t/episode-monit...odi/9667/4 not working? I haven't even tried it yet. Seem over complicated for such a simply task in my opinion,
The Problem is not the problem. The problem is your attitude about the problem.
Do you understand?
Reply
#98
Quote:Then one you made https://forums.sonarr.tv/t/episode-monit...odi/9667/4 not working? I haven't even tried it yet. Seem over complicated for such a simply task in my opinion,

Yes I've made the same one and it works, I am trying callbacks because is more efficient because the script gets called when the video is finished played or paused (if you want to unmonitor after a percentage of playback it can be done), instead of cron.
But the complexity of parsing the information to reach sonarr will be as complicated as in the script that I wrote, because callbacks doesn't give you detailed information. For example i'll give you the title, but the script will have to parse that info to split the name, season and episode number (guessit in python is good for that). Then go through the sonarr api to find the episode_id and series_id so you can finally use those two id's to toggle unmonitor. I only know BASH so maybe this can be done more efficiently in python or another language.
Reply
#99
Got it! we should work together, I'm a hell of a troubleshooter when I have the energy for it! PM?
The Problem is not the problem. The problem is your attitude about the problem.
Do you understand?
Reply
Ok, Now that i have the three arguments (%ti/%mt/%fn) configured I can see in the logs now that the problem is the variables don't get expanded.

so not title, media type displays as unknown and filename is the only one that works

Here is an extract of the webhook log

06:54:33 web.1 | 10.10.10.13 - - [29/Mar/2016 06:54:33] "GET /kodi//unknown/nfs://10.10.10.12/export/videos/series/ricardo/Line%20of%20Duty/Season%203/Line%20of%20Duty%20-%20S03E01%20-%20SDTV%20-%20ORGANiC.mp4 HTTP/1.1" 200 253 1.0169
06:55:19 web.1 | 10.10.10.13 - - [29/Mar/2016 06:55:19] "GET /kodi//unknown/nfs://10.10.10.12/export/videos/peliculas/Point%20Break%20(2015)/Point%20Break%202015%20BluRay%20COCAIN.mkv HTTP/1.1" 200 221 1.0092

@Blackkatt i know you send me a PM, but the forum doesn't let me respond. I am new here so i might be restricted to send messages for some time.
Reply
Question 
(2016-03-29, 09:00)subzero79 Wrote: @Blackkatt i know you send me a PM, but the forum doesn't let me respond. I am new here so i might be restricted to send messages for some time.

W00t? never heard of that before. But if you can see it I'll send another one with some contact info.
The Problem is not the problem. The problem is your attitude about the problem.
Do you understand?
Reply
(2016-03-29, 07:38)subzero79 Wrote:
(2016-03-28, 15:58)KenV99 Wrote: I'm not sure if it was the problem but I pushed a small update.
Try updating and see if it fixes it.


Hi KenV99, thanks for your time. I downloaded the zip file from github and pushed the folder to firetv. I've launched also an echo server to test. No variable argument get's passed to the url, neither in the webhook server or the echo server, looks like the variable is not expanding. I've attached a full debug kodi log if you're interested.

This is with webhook server http://hastebin.com/iqixedinod.coffee

This is the echo server http://hastebin.com/xevasuvayi.coffee

The logs in the webhook and echo server don't show the any arguments after kodi/

On my system I am still showing the echo server getting the title. I need a little more time to try on Android and see if it is a system specific problem.
Reply
Quote:On my system I am still showing the echo server getting the title. I need a little more time to try on Android and see if it is a system specific problem.

Sure, i can still work it out from the %fn variable, need to reassemble it in bash because slashes (/) are the separators for the arguments in this webhook server. So the script receives like 10 arguments. So for me is working ok now.
I'll test tomorrow from a rpi that i have with osmc to narrow this to Android and/or FireOS
Reply
I just tested from Rpi OSMC, and it works ok it sends the name as argument.

BTW I just noticed that you added POST, GET, etc. Gonna give them a try.
Reply
(2016-03-30, 03:56)subzero79 Wrote: I just tested from Rpi OSMC, and it works ok it sends the name as argument.

BTW I just noticed that you added POST, GET, etc. Gonna give them a try.

Yes, I pushed another update, including the other HTTP verbs available within the requests module and creates a session object for use during the send cycle.
This update also provides additional information in the log to see what the url that has been assembled.
It also includes everything possible to obtain a title for a file (I was concerned that the reason you weren't getting a title is that the addon couldn't resolve one).

I tested it using an Android emulator and it sends the title to my echo server, so hopefully this works for you.
Reply
  • 1
  • 5
  • 6
  • 7(current)
  • 8
  • 9
  • 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.