Coder Social home page Coder Social logo

Kodi not working about apprise HOT 17 CLOSED

caronc avatar caronc commented on August 17, 2024
Kodi not working

from apprise.

Comments (17)

geeseven avatar geeseven commented on August 17, 2024 1

For now, I can use xbmc://. Feel free to push a new release when you think it is best. Seeing that the _payload_20 and _payload_60 are the same, some code clean up might be in order.

from apprise.

caronc avatar caronc commented on August 17, 2024

I'm using OpenELEC myself (which is a bit dated), but I'm quite certain it's using Kodi 17. I can say without a doubt thought that the kodi:// (v6 API) works great. I don't think i ever got the images/icons the work though; it always just put the icon provided by Kodi.
If you add -vvv you'll get enough verbosity that you can see the payload being sent to your (Kodi) server.

Rolling back to v2 (of the API) is still an option without any software changes; you can achieve this by just using xbmc:// instead of kodi:// (in apprise) if you want.

I've always applauded Kodi's ability to maintain backwards compatibility with all of it's APIs. It would have made sense if it was v2 (of the API) that didn't work and v6 did, but since it's the other way around it's almost seems like there might be a bug in the build of Kodi you're using.

All that said, from my end: I don't think there would be much effort involved in creating a flag such as ?version=X or something that you could add to the (apprise) URL if you think the protocol should be different then the default (v6). It would involve writing at least 6 new functions though (one for API v1, 3,4,5,7 & 8). So i don' t know if there is value here. Might be overkill though.

Your thoughts?

from apprise.

geeseven avatar geeseven commented on August 17, 2024

Hey @caronc,

Thanks for the timely reply. My testing was on LibreELEC 8.2.5 running Kodi 17.6 and the same version of Kodi from the Arch repositories. The LibreELEC box has been up and running for sometime with plenty of customization, so that is why I spun up a fresh copy on Arch. I get the following reply when issuing the JSONRPC.Version call on both Kodi instances:

{"id":1,"jsonrpc":"2.0","result":{"version":{"major":8,"minor":0,"patch":0}}}

Looking at the output of the apprise using xbmc:// and kodi:// with -vvv, the only difference is the jsonrpc version, 2 and 6.

Before you posted your results, I was thinking the jsonrpc number was the version of jsonrpc specification itself and not Kodi's API version. As looking over the Kodi API v2 docs, I do not see GUI.ShowNotification shown as an option. I am a bit confused at the moment.

from apprise.

caronc avatar caronc commented on August 17, 2024

As looking over the Kodi API v2 docs, I do not see GUI.ShowNotification shown as an option. I am a bit confused at the moment.

Fair point. I based the XBMC protocol off of the one found in Sickbeard back in 2014 (when apprise was originally just part of an NZBGet plugin); It worked for me at the time, so i just carelessly moved on. But good point that the API doesn't even say that it should be supported 😳 .

I wonder if just changing the Kodi version 6 to version 5 (in the payload) would work? My problem right now is I don't have a broken test environment like the one you you've described so I'm not very useful (yet). I also don't want to change the (Kodi) protocol in apprise too much to avoid breaking it's compatibility with all other versions. I will see if i can set up a broken environment like the one you describe (using Arch Linux in a docker container if at all possible). In the meantime, i'm asking for your help too if you don't mind! Please feel free change the (Apprise) code on your end and see if you can figure it out. Whatever you find and/or change that makes it work for you, I can make the change on mine too to see if what you adjusted is still compatible (with my version of Kodi for example). Hopefully this makes sense.

I'm also open to any other suggestion you might have. 😄

from apprise.

geeseven avatar geeseven commented on August 17, 2024

I based the XBMC protocol off of the one found in Sickbeard back in 2014 (when apprise was originally just part of an NZBGet plugin); It worked for me at the time, so i just carelessly moved on.

Carelessly, I disagree. Creating a test suite to cover all the remote services used by apprise is far from easy.

In the meantime, i'm asking for your help too if you don't mind!

I would be more than happy to help. I am curious on your thoughts on supporting EOL versions of Kodi or other services. Personally I am not a fan, clearly an Arch user. 🤣 The numerous Kodi 'appliance boxes' do present a different situation from services.

from apprise.

caronc avatar caronc commented on August 17, 2024

Carelessly, I disagree. Creating a test suite to cover all the remote services used by apprise is far from easy.

Hah thank you!

I am curious on your thoughts on supporting EOL versions of Kodi or other services. Personally I am not a fan

I partially agree; I personally like keeping 'some' backwards compatibility because it allows the package to target a much larger audience. I'm a CentOS 7.x user (I'm like the opposite of you - lol). I also have a jailbroken AppleTV2 still running the last supported version of Kodi (Frodo) that just works awesome with apprise (I'm to cheap to replace it and can no longer upgrade it 😏). So maybe just for selfish reasons, the Kodi protocol is the only one I'd like to keep 'some' backwards compatibility with... even if the url that it current uses (kodi://myappletv) becomes kodi://myappletv?version=6; that would be fine!

Also, on a side note; sorry for the delayed responses and lack of effort on my part right now. These past few months have been busy for me. I hope to get back into writing more code and enhancing all of my products soon. I truly do appreciate any effort or help you offer though!

from apprise.

geeseven avatar geeseven commented on August 17, 2024

@caronc,

Do you mind sharing the results of these commands for both of your Kodi installations?

curl -X POST -H "Content-Type: application/json" -d '{"id":1,"jsonrpc":"2.0","method":"JSONRPC.Version"}' http://user:pass@host:port/jsonrpc
curl -X POST -H "Content-Type: application/json" -d '{"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"title","message":"message"}}' http://user:pass@host:port/jsonrpc
curl -X POST -H "Content-Type: application/json" -d '{"id":1,"jsonrpc":"6.0","method":"GUI.ShowNotification","params":{"title":"title","message":"message"}}' http://user:pass@host:port/jsonrpc

from apprise.

caronc avatar caronc commented on August 17, 2024

@geeseven Sure!

AppleTV2 (Kodi - Frodo):

# URL=xbmc:[email protected]:8080/jsonrpc
# curl -X POST -H "Content-Type: application/json" -d '{"id":1,"jsonrpc":"2.0","method":"JSONRPC.Version"}' $URL
{"id":1,"jsonrpc":"2.0","result":{"version":{"major":6,"minor":0,"patch":3}}}

# curl -X POST -H "Content-Type: application/json" -d '{"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"title","message":"message"}}' $URL
{"id":1,"jsonrpc":"2.0","result":"OK"}

# curl -X POST -H "Content-Type: application/json" -d '{"id":1,"jsonrpc":"6.0","method":"GUI.ShowNotification","params":{"title":"title","message":"message"}}' $URL
{"error":{"code":-32600,"message":"Invalid request."},"id":1,"jsonrpc":"2.0"}

OpenELEC (on a Raspberry Pi2b):

# URL=kodi.server.address/jsonrpc
# curl -X POST -H "Content-Type: application/json" -d '{"id":1,"jsonrpc":"2.0","method":"JSONRPC.Version"}' $URL
{"id":1,"jsonrpc":"2.0","result":{"version":{"major":8,"minor":0,"patch":0}}}

# curl -X POST -H "Content-Type: application/json" -d '{"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"title","message":"message"}}' $URL
{"id":1,"jsonrpc":"2.0","result":"OK"}

# curl -X POST -H "Content-Type: application/json" -d '{"id":1,"jsonrpc":"6.0","method":"GUI.ShowNotification","params":{"title":"title","message":"message"}}' $URL
{"error":{"code":-32600,"message":"Invalid request."},"id":1,"jsonrpc":"2.0"}

from apprise.

geeseven avatar geeseven commented on August 17, 2024

Can you confirm if the notifications were shown within Kodi for the second and third command?

from apprise.

caronc avatar caronc commented on August 17, 2024

Sure, in all cases the 3rd command did not send anything to either of the systems. The first 2 worked fine though.

from apprise.

geeseven avatar geeseven commented on August 17, 2024

Sure, in all cases the 3rd command did not send anything to either of the systems. The first 2 worked fine though.

I got the same results on my end and I am even more confused why kodi:// works for you. It seems that "jsonrpc":"6.0" should not work. Does xbmc:// work?

In regards to backwards compatibility, I think supporting the modern end of the JSON-RPC API, v6 and newer, is reasonable. That version was released with Frodo in 2013. The API calls between v6, v8 and v9 (not yet released) look the same.

from apprise.

caronc avatar caronc commented on August 17, 2024

I think you just observed a very good thing i completely missed. If you look at the source for the Kodi/XBMC plugin you'll see that i pass in "jsonrpc":"2.0" for both. In fact; both payloads are the same 😳 (in both _payload_20 and _payload_60)

       # prepare JSON Object
        payload = {
            'jsonrpc': '2.0',
            'method': 'GUI.ShowNotification',
            'params': {
                'title': title,
                'message': body,
                # displaytime is defined in microseconds
                'displaytime': 12000,
            },
            'id': 1,
        }

So here's a good example of where my 100% test coverage fails me; i should probably be testing the outputs too... (oops).

apprise was born from extracting it out of NZBNotify; here is the old version of this plugin (i can spot differences already) form an old fork. Not sure if it helps (or didn't work back then either and i just never noticed).

from apprise.

geeseven avatar geeseven commented on August 17, 2024

Ah, now I see. This issue got corrected in cc61519. There has not been a new release, so it has not been fixed in PyPI. I could have sworn, I checked HEAD. Also, I should have also included installation information when first posting this issue.

Is there anything preventing a new release? Maybe also remove Toasty, as it appears to be dead??

from apprise.

caronc avatar caronc commented on August 17, 2024

Is there anything preventing a new release?

No not at all... i usually wait until a few bugfixes and updates have transpired and then i just increment the version and do another release. But i can push what is there this evening if i can remember (worst case sometime this week).

Maybe also remove Toasty, as it appears to be dead??

It's probably worth keeping this around for a little bit; it's site is still online even though it's for pretty dated technology.

from apprise.

caronc avatar caronc commented on August 17, 2024

So the differences are subtle between v6 and v2; but they do exist. One of the minor things is just passing Kodi the type of message (Error/Info/Warning).

But i fixed the Image display (so that should show up now in Kodi - at least it does for me using the V6 protocol). Since the Notification doesn't change at all between 6 and 8, i'd be curious if you just gave this code base another shot and let me know how it goes.

Edit: pypi is updated now too so you can update using pip too if you like.

from apprise.

geeseven avatar geeseven commented on August 17, 2024

After upgrading to 0.0.9, both xbmc:// and kodi:// result in the same behaviour for me. Notifications are displayed with no errors. The image display works with the default theme, but not on a custom theme.

We can close this issue, thanks. 🍻

from apprise.

caronc avatar caronc commented on August 17, 2024

The problem is that Kodi requires a web hosted image. It won't read from local ones. If you want to host the images locally, you'll also need a small nginx/apache server to host them. You can then provide the overide url (in Asset object) which might be something like http//localhost/path/to/custom/images/{template entries}.png

from apprise.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.