Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Support for XBMC2 plugin (formerly XBMCRepeat)

Questions and comments specific to a particular plugin should go here.
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib »

eirik226 wrote:One more question - is it possible to automate the shutdown process after the library update? Right now I have "Wait some time 240 sec" (It will take around that time to update the library) then shutdown, but i'm afraid it might take longer sometimes and EG force a shutdown in the middle of the update - anyway around this?
If you activate JSON-RPC notifications (In XBMC2s settings) you should get an event:

Code: Select all

XBMC2.VideoLibrary.OnScanFinished
When Kodi has finished a library scan.

@bengalih: Thanks for helping out with the support.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
eirik226
Experienced User
Posts: 142
Joined: Wed Nov 07, 2012 5:22 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by eirik226 »

Thanks for your quick answer - but all I seem to get is:

Code: Select all

   Result:
   "OK"
I have enabled the Json notification - could it perhaps be a problem with my port?
bengalih
Posts: 48
Joined: Sat Feb 25, 2012 1:13 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by bengalih »

eirik226 wrote:Thank you so much - if your reply was the it's more XMBC question then EG (before edit), the reason I asked was exectly what you showed me - how I could do it in EG, anyway thanks for your reply, helped me out a lot!

The reason I must do this in EG:

I run kodi and all other stuff on a Intel NUC (small computer) that is on 24/7 - but I use it for a lot more then just Kodi, so I use directory watcher to see if any new files have been created, if so, EG starts kodi, sends update command, wait some time and then exit the application. (So it's like the update never happend)

One more question - is it possible to automate the shutdown process after the library update? Right now I have "Wait some time 240 sec" (It will take around that time to update the library) then shutdown, but i'm afraid it might take longer sometimes and EG force a shutdown in the middle of the update - anyway around this?
You can enable JSON-RPC notifications in the XBMC2 plugin as shown here:
enable json notifications
enable json notifications
Then, you will start to receive JSON events FROM XBMC into event ghost...you will see the following:
json clean events
json clean events
You can use that .OnScanFinished event to trigger a shutdown.

Of course, if you do that, you will shutdown Kodi EVERY TIME a scan finishes. So if you are triggering a manual scan while you are in Kodi, it will shut down afterwards too.. not ideal.
To work around this you would have to create some additional logic.
Below is an example of some logic that should work, but it is probably not the only solution.
shut down logic
shut down logic
shut down logic.png (11.86 KiB) Viewed 4815 times
Personally, this seems like a lot of effort. I'm not sure why you take 2 mins+ to update the library. Mine takes maybe 20 seconds max even over an smb source.
As such I just update the library on start.
bengalih
Posts: 48
Joined: Sat Feb 25, 2012 1:13 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by bengalih »

eirik226 wrote:Thanks for your quick answer - but all I seem to get is:

Code: Select all

   Result:
   "OK"
I have enabled the Json notification - could it perhaps be a problem with my port?
Yes, probably. It defaults to 9090. Other things (like sabNZB) may be using that port.
You can either change the other apps, or change the kodi listening port:

http://kodi.wiki/view/Advancedsettings.xml#jsonrpc
eirik226
Experienced User
Posts: 142
Joined: Wed Nov 07, 2012 5:22 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by eirik226 »

bengalih wrote:
eirik226 wrote:Thanks for your quick answer - but all I seem to get is:

Code: Select all

   Result:
   "OK"
I have enabled the Json notification - could it perhaps be a problem with my port?
Yes, probably. It defaults to 9090. Other things (like sabNZB) may be using that port.
You can either change the other apps, or change the kodi listening port:

http://kodi.wiki/view/Advancedsettings.xml#jsonrpc
I've tried changing ports 4 times now, and I've tried to check my windows firewall (without getting any smarter) to me, it seems everything is good as it is.

Here is what I get:

Code: Select all

JSON-RPC connected
HTTP API connected
XBMC2: Deactivating JSON-RPC notifications
XBMC2: Activating JSON-RPC notifications
JSON-RPC connected
HTTP API connected
XBMC2: Deactivating JSON-RPC notifications
XBMC2: Activating JSON-RPC notifications
XBMC2: JSONRPC: VideoLibrary.Scan
   Result:
   "OK"
System.Idle
Anyone got any ideas?
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib »

eirik226 wrote:Anyone got any ideas?
You are not getting this when starting Kodi?

Code: Select all

XBMC2: Connected to XBMC ( 192.168.1.100 : 9090 ), ready to recive JSON-RPC notifications.
Then you probably don't have UPnP activated in Kodi check this post.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
bengalih
Posts: 48
Joined: Sat Feb 25, 2012 1:13 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by bengalih »

bengalih wrote:
eirik226 wrote:Thanks for your quick answer - but all I seem to get is:

Code: Select all

   Result:
   "OK"
I have enabled the Json notification - could it perhaps be a problem with my port?
Yes, probably. It defaults to 9090. Other things (like sabNZB) may be using that port.
You can either change the other apps, or change the kodi listening port:

http://kodi.wiki/view/Advancedsettings.xml#jsonrpc
I'm seeing issues here as well on doing tests:

The problem is that after Kodi quits, I get the following events:

10:32:13 XBMC2.System.OnQuit {u'exitcode': 0}
10:32:14 XBMC2: Disconnected from XBMC, not receiving JSON-RPC notifications.

But then, after I start it up again I don't get any connection. I've played with this for 15 minutes and the majority of my restarts don't initiate a connection.

I have tried playing around with all the different config options in "Services" on Kodi:
- allow remote control via UPnP
- allow remote control by programs *
- zeroconf
- airplay

It seemed that when I had everything enabled I was getting good results in terms of a connection being picked up each time. I restarted about 5 times in a row and each time got the notifications:

10:48:57 XBMC2: Connected to XBMC ( 127.0.0.1 : 9090 ), ready to recive JSON-RPC notifications.
10:48:57 XBMC2.System.OnStart

I messed around trying to figure out which one was doing it, but now I have inconsistent results.
Right now I have them all enabled again, and it still isn't working.

Honestly, I've tried just about every combination. Having them all enabled (just for safety) and then disabling and re-enabling the plugin seems to be the most effective, but even this isn't guaranteed to work.

I believe that the only options that need to be enabled for this to work are:
- Web server
- Remote Control > "Allow remote control by programs on this system" .... And I think only this one is needed for it to honor the Quit command...

I don't know if this is a bug with the plugin, Kodi, or both. I don't know the architecture well enough yet of how Kodi is supposed to notify that it is online.
I'm wondering if this is some sort of port timeout/hang issue due to the inconsistencies, I generally leave my Kodi running, but sometimes I need to restart it remotely because of focus/resolution issues.
This weird behavior may explain why I've seen some other control inconsistencies in the past.
eirik226
Experienced User
Posts: 142
Joined: Wed Nov 07, 2012 5:22 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by eirik226 »

jonib wrote:
eirik226 wrote:Anyone got any ideas?
You are not getting this when starting Kodi?

Code: Select all

XBMC2: Connected to XBMC ( 192.168.1.100 : 9090 ), ready to recive JSON-RPC notifications.
Then you probably don't have UPnP activated in Kodi check this post.

jonib
I feel really stupid now, I had a feeling this would be a dumb problem, but it's really hard to search in this post (It's biiiig) - Thank you so much for all the help and a big thanks to bengalih for giving the best support with pictures I've seen in a long time! I'll take your example and spread joy. You guys made my day.
bengalih
Posts: 48
Joined: Sat Feb 25, 2012 1:13 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by bengalih »

jonib wrote:
eirik226 wrote:Anyone got any ideas?
You are not getting this when starting Kodi?

Code: Select all

XBMC2: Connected to XBMC ( 192.168.1.100 : 9090 ), ready to recive JSON-RPC notifications.
Then you probably don't have UPnP activated in Kodi check this post.

jonib
Jonib - after reading this I started to focus just on having this enabled.
It does however seem that if I don't also have both remote control options (control programs from this computer and from others) that I never get the .Onstart and follow up events.

Even then, it seems that if any options are off or switched around the plugin does not always work unless it is first disabled and enabled again.

If I could urge you to do some tests where after you have it working you close and reopen Kodi multiple times, perhaps you will see this issue as well.

For reference this is latest EG, Kodi 13.1, Win 7x64
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib »

bengalih wrote:It does however seem that if I don't also have both remote control options (control programs from this computer and from others) that I never get the .Onstart and follow up events.
Yes those are needed for for the plugin, The UPnP setting is needed to make the notifications work.
Even then, it seems that if any options are off or switched around the plugin does not always work unless it is first disabled and enabled again.
There have been some problems with detection, but I have not been able to reproduce them when testing before, so I would need more specific data.

Have you tried this(0.6.23) test version? It has some tweaks to the notifications. If you activate the debug option in the settings that might give more details when there is a problem.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib »

So you got it working now?
eirik226 wrote:I feel really stupid now, I had a feeling this would be a dumb problem,
Well it's easy to feel stupid when there is no documentation.
but it's really hard to search in this post (It's biiiig)
That's what she said :D :oops:
Thank you so much for all the help and a big thanks to bengalih for giving the best support with pictures I've seen in a long time! I'll take your example and spread joy. You guys made my day.
I used to do support with pictures too, but then I got old. :cry:

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
bengalih
Posts: 48
Joined: Sat Feb 25, 2012 1:13 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by bengalih »

jonib wrote:
bengalih wrote:It does however seem that if I don't also have both remote control options (control programs from this computer and from others) that I never get the .Onstart and follow up events.
Yes those are needed for for the plugin, The UPnP setting is needed to make the notifications work.
Even then, it seems that if any options are off or switched around the plugin does not always work unless it is first disabled and enabled again.
There have been some problems with detection, but I have not been able to reproduce them when testing before, so I would need more specific data.

Have you tried this(0.6.23) test version? It has some tweaks to the notifications. If you activate the debug option in the settings that might give more details when there is a problem.

jonib
What I meant specifically was I had to have the following enabled:
1) Remote Control > Allow remote control by programs on this system
2) Remote Control > Allow remote control by programs on other systems
3) UPnP/DLNA > Allow remote control via UPnP

I'm surprised that #2 is needed, but it appears that at least on this version of Kodi, it makes the decision NOT to send out any notify packets if it assumes no other systems can control it ??

I downloaded your debug copy, and basically what was happening was it was just waiting on SSDP events.
I can pretty much guarantee that Kodi was sending these events, because I could restart Kodi 10 times and it would never pick up.
But, if I restarted EG and then Kodi, it would pick up - after having done no configuration changes to Kodi.
Since Kodi is entirely self contained (no services), shutting it down should be a complete "reboot" of it - so I think there must be some issue with sometimes picking up the packets that are being sent.

I was recreating the issue the same with the debug version, but now for the past 10 minutes I've restarted it like 20 times and there is no problem.
So I really can't isolate what is going on either.

Wouldn't it be possible to also just add an event that re-establishes the JSON-RPC notifications over 1900?
It seems the whole issue is that we sit idle waiting for an SSDP packet so we can see the box is live and then make the connection to receive notifications.
But why not provide an event that will make the connection even without an SSDP packet?
That would at least be some workaround.

Please note, I don't think I'm having this issue seriously on my production box, it was just in my testing today for answering these questions that I noticed this.

thanks
Ztrust
Posts: 5
Joined: Fri Oct 16, 2015 7:26 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by Ztrust »

hej I have been using this plugin for a long time and was very happy when you added the built in functions but the last coupple of days they have been broken when I try to update them i get this in the log
XBMC2: Error: Can't connect to "https://raw.githubusercontent.com/xbmc/ ... iltins.cpp" to update "BuiltInFunctions".
I am using latest plugin version on page 72 and latest eventghost.
thank you I hope you can help
Ztrust
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib »

Ztrust wrote:hej I have been using this plugin for a long time and was very happy when you added the built in functions but the last coupple of days they have been broken when I try to update them i get this in the log
XBMC2: Error: Can't connect to "https://raw.githubusercontent.com/xbmc/ ... iltins.cpp" to update "BuiltInFunctions".
Looks like the code where the functions are listed has changed, and they seem to have been split up in several files, I'll have to figure out where and how they are listed now. hopefully I have time in a couple of days. (depending on how big change it is)

Thanks for reporting it

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
Ztrust
Posts: 5
Joined: Fri Oct 16, 2015 7:26 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by Ztrust »

thanks for fast reply and for looking in to it ;)
Post Reply