kodi-connect / kodi-connect-addon

MIT License
27 stars 15 forks source link

Python 3 support #35

Open BUGBEAR7 opened 3 years ago

BUGBEAR7 commented 3 years ago

Hello I have been using this addon for last 1 year in my Kodi Krypton , but recently have to update the Kodi because few addon now does not support in old Kodi build. Recently updated to Kodi Matrix as we all it does not support old python so I was wondering will there be any update for this addon

Thanks

LuKePicci commented 2 years ago

The error in @Motisu log is the same as it was on its September log and it's not related to mine.

LuKePicci commented 2 years ago

I see @Motisu is using Linux, AFAIK it uses the Python runtime from the OS environment, so I'd suggest you update it to 3.8 at least,

Motisu commented 2 years ago

I am using Linux, sort of. This a an Intel NUC box and it is running Libreelec. So technically, it is Linux, but not a version that I would like to start messing around with at that level.

captainfearless commented 2 years ago

hi tkislan, i have tried https://github.com/kodi-connect/kodi-connect-addon/files/7798775/plugin.video.kodiconnect-0.3.4.zip but it failed to connect. Would you kindly take a look? kodi.log

tkislan commented 2 years ago

@captainfearless That is a very weird error .. it fails with certificate being expired, but when visiting the web page, certificate is valid until "Expires: Tuesday, 1 March 2022"

captainfearless commented 2 years ago

Yes i read that, but didn’t know what an SSL certificate was!

What’s my best plan of attack?, start from scratch?

LuKePicci commented 2 years ago

Looks like it's client has the old let's encrypt cert.

I think it's all in a transitioning state, python3 in Kodi is not mature enough, libreelec has old python ecc.


From: captainfearless @.> Sent: Thursday, January 6, 2022 2:37:57 PM To: kodi-connect/kodi-connect-addon @.> Cc: Luca Piccirillo @.>; Mention @.> Subject: Re: [kodi-connect/kodi-connect-addon] Python 3 support (#35)

Yes i read that, but didn’t know what an SSL certificate was!

What’s my best plan of attack?, start from scratch?

— Reply to this email directly, view it on GitHubhttps://github.com/kodi-connect/kodi-connect-addon/issues/35#issuecomment-1006598741, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACCRPNTGON7RGHKM5BM6GPTUUWLLLANCNFSM45PEWHGQ. You are receiving this because you were mentioned.Message ID: @.***>

captainfearless commented 2 years ago

So what should i do boys?, leave it installed and keep trying? I‘ve been waiting for the return of my number 1 add on, and now it’s back i can’t use it!

tkislan commented 2 years ago

@captainfearless Sorry, but I actually don't know Windows platform that well, to be able to solve this issue It seems like it has outdated certificates installed? Because I'm using Letsencrypt as SSL certificate provider, which is pretty standard

captainfearless commented 2 years ago

Thanks for clarifying Tomas, and for responding as always. I didn’t realise the SSL issue was a local one! I will google and resolve that way.

Paul Constance

On 8 Jan 2022, at 08:38, Tomas Kislan @.***> wrote:

 @captainfearless Sorry, but I actually don't know Windows platform that well, to be able to solve this issue It seems like it has outdated certificates installed? Because I'm using Letsencrypt as SSL certificate provider, which is pretty standard

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.

LuKePicci commented 2 years ago

@tkislan I think @captainfearless is not using Windows otherwise it's CA certs would have been updated. I guess it is using an old kodi box/distro (either Linux or Android) which has not been updated with new CA certs.

CA cert of Let's Encrypt is expired a few months ago, old boxes without the new CA would not connect anymore to Let's Encrypt HTTPS websites.

Once again I confirm this add-on now works fine on Windows (UWP Kodi version 19.3)

captainfearless commented 2 years ago

Hi, just to confirm, i am running kodi on a PC with Windows 10, i am just 1 update behind, which is installing now.

captainfearless commented 2 years ago

Log is the same after updating, also manually imported a new certificate earlier.

captainfearless commented 2 years ago

Over on the Kodi forums i received this explanation.

your target server https://138.68.100.216 is using a self-signed certificate, which is unknown to kodi. You should use a proper DNS name and valid certificate.

I'm confused by all of this, all i did was install a new version of Kodi Connect on a previously working set up.

Is the target server my home PC? If so how can i ''use a proper DNS name and valid certificate''

captainfearless commented 2 years ago

Another great explanation, but i don’t know in laymans terms what to do!

tkislan commented 2 years ago

@captainfearless The thing is, that the code is connecting to http://kodiconnect.kislan.sk .. and not through the IP address So I guess the issue might be with the python package on the windows platform .. but it is unlikely, that you are the only windows user here

captainfearless commented 2 years ago

Well i updated my Python package which didn’t fix it. It’s one of those things where some random update will fix it, so i’ll keep reinstalling.

LuKePicci commented 2 years ago

your target server https://138.68.100.216 is using a self-signed certificate, which is unknown to kodi. You should use a proper DNS name and valid certificate.

I'm not sure they correctly troubleshot this. I mean. that IP is the correct IP address of kodi-connect services, but when you contact that IP with correct hostname it responds with a valid certificate and no error is givem.

It is correct for that IP to respond with such invalid self-signed cert when you reach it without using the kodi-connect hostname.

So, why your kodi is using https://IP and not https://kodiconnect.kislan.sk/ ? I'm under windows too and its working fine here so this is a bit strange at least. Maybe you could try from another windows box?

Otherwise, their troubleshooting is wrong and the issue is about the other proper let's encrypt cert as I previously guessed.

captainfearless commented 2 years ago

I do appreciate your interest Luke. I’m baffled, i wonder if there is a way of forcing it to connect to https://kodiconnect.kislan.sk/? I was also wondering if my VPN could be the cause?

LuKePicci commented 2 years ago

Ok, it is definitely worth to try without the VPN. Also if you link us the Kodi forum where you asked for help I would be interested in reading it.

captainfearless commented 2 years ago

https://forum.kodi.tv/showthread.php?tid=366429

I will try again without the VPN.

captainfearless commented 2 years ago

Still failed. Also when Kodi Connect is installed, Kodi hangs on exiting.

LuKePicci commented 2 years ago

I confirm the troubleshoot done on kodi forums is likely wrong. The ssl error clearly states the cert is expired which has nothing to do with self-signing. As additional proof of what I'm saying, that self-signed cert is not expired.

The user on kodi forum has been fooled by that misleading error message where the pure IP is shown.

Try visiting https://kodiconnect.kislan.sk/ from your PC, using different browsers and see if any of them gives you certificate errors. Make sure you have no expired certs in their respective cert stores. If none of them give errors and you have no expired CA certs installed, then Kodi (or the Python interpreter) is using its own CA store and there is no valid CA for letsencrypt in there.

Try using Kodi UWP (Windows Store) if you didn't so far.

captainfearless commented 2 years ago

Update! My PC died, so i had to reset it, and now KC is working perfectly.

Motisu commented 2 years ago

Hi Tkislan, Anything new with this bug? can I hope for it to be closed or should I just give up? :(

tkislan commented 2 years ago

@Motisu I will revisit this .. but to be honest, it will most likely require a lot bigger rewrite to support all the different platforms No idea why it has such different behaviours with different platforms and different Python versions ...

Motisu commented 2 years ago

Well, thanks for trying. I am managing without it now on my main box but it runs very well on my bedroom TV. I guess a 1/2 is better than none, and I wish you good luck in solving the bug. I'll still be waiting patiently. :-)

ZedeN1 commented 2 years ago

I get the same/very simmilar error as @Motisu on Kodi 19.4 running LibreELEC 10.0.2 on Rasberry Pi 4B. Log file: https://paste.kodi.tv/aqukugonov.kodi

LibreELEC:~ # python --version
Python 3.8.9
karl500 commented 2 years ago

Hi @tkislan,

Firstly thank you for this great add-on and also for the time and effort you have put into this. Unfortunately i'm still having some issues. When i run the add-on it exits with an error that there is no event loop in thread where the connection to your site is started. I also looked into it a little bit and there seems to be some kind of change in asyncio where the creation of event loops is not done automatically in threads anymore.

Anyway, if you can please look into it further, it would be much appreciated.

Here's a link to the issue i found: https://stackoverflow.com/questions/51038793/error-happen-python3-6-while-using-tornado-in-multi-threading

and also my debug log from kodi: kodi.log

MartinsVision commented 2 years ago

Is this up and running yet ?? Great app by the way 👏

hindsight2021 commented 1 year ago

I had success asking GPT4 to fix the addon, give this a try ya’ll - it worked for me on Kodi v21 omega.

plugin.video.kodiconnect-0.3.6-fixed.zip

Update - once the skill was connected after I updated with my zip in kodi I have full control w/alexa again. I hope it works for you too.

Changelog for plugin.video.kodiconnect-0.3.6-fixed

Fixed

Notes

Developer's Changelog for plugin.video.kodiconnect-0.3.6-fixed

Detailed Modifications:

  1. File: resources/lib/tornado/httputil.py
    • Change: Updated the import statement for compatibility with recent Python versions.
    • Original Line: class HTTPHeaders(collections.MutableMapping):
    • Modified Line: class HTTPHeaders(collections.abc.MutableMapping):
MartinsVision commented 11 months ago

I can now connect but no commands work from Alexa

captainfearless commented 7 months ago

Has anyone currently got this working?

MartinsVision commented 7 months ago

I haven't yet