Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 2.x support - Kodi <19 #2

Closed
JimmyS83 opened this issue Sep 7, 2022 · 15 comments
Closed

Python 2.x support - Kodi <19 #2

JimmyS83 opened this issue Sep 7, 2022 · 15 comments

Comments

@JimmyS83
Copy link

JimmyS83 commented Sep 7, 2022

Hi,

Are you interested to make a branch for Python2, used until Kodi19? There is quite a lot of devices on Kodi's <19

@opensubtitlesdev
Copy link
Owner

opensubtitlesdev commented Sep 8, 2022 via email

@JimmyS83
Copy link
Author

JimmyS83 commented Sep 8, 2022

@opensubtitlesdev @jujudellago

Thanks for reply!

Yes.. Currently, this addon is compatible with Kodi > 18, since its written in python3.

Historically between all Kodi's prior to k19, there is python2 under hood, since k19 and after, python3. So there was quite a lot addons, which needs to be updated, and usually splitted into branches before and after k19, ie. python2 and python3 branches.

I think a LOT of people use original OS addon, which using old API, and still being on Kodi version < 19. If I can guess, that this old API will be shutdowned, old addon will break.

Kodi > 19 users just install this new one, opensubtitles.com from Kodi official repository, but until this new addon opensubtitles.com will be backported for python2, rest of users will be in dark. So I wondered, if there is thought about python2 version for older Kodi's, or they are considered as obsolete and deprecated.

@jujudellago
Copy link
Contributor

jujudellago commented Sep 13, 2022 via email

@navyseai
Copy link

navyseai commented Jan 4, 2024

im using retropie (kodi leia) and if i try to install this from the zip i will get an issue not being able to satisfy dependencies due to python3 im assuming. Just hit on thisbe cause opensubtitles.org API has just ended its support few days ago.
So I'm guessing lots of people may be looking to install this as an alternative

@cpascual
Copy link

cpascual commented Jan 27, 2024

Hi, I am also stuck with kodi leia (because that is the newest version that supports HD video decoding on a RaspberryPi3).
Since this addon is only compatible with python3 and the OS.org addon is no longer working , I've lost access to opensubtitles.

According to @opensubtitlesdev @jujudellago, it should be easy to backport this addon... but that was with code of 2 years ago, and the py2 ancestor is not in this repo history 😢

Therefore I tried to just convert the py3 code to py2 with the help of 3to2 and then some additional manual changes.
The result is in this branch in my fork.

Unfortunately it is not working yet (it installs fine on Kodi Leia and can be configured with the OS.com user and password, but gives an error when searching for subtitles).

This is my first contact with kodi addons development, so I don't even know how to properly debug it. If someone more experienced could have a look or point me in the right direction, we might solve this issue that probably affects many people now that OS.org addon stopped working.

UPDATE: I got it working (I can search and download in using Kodi Leia).

Regarding distribution/installation: I am not familiar with the details of submission of kodi plugins to official repos, so for now anyone interested can get it from my fork and install it from zip. If there is interest from the official devs to distribute this for Kodi<19, I'd be happy to contribute if they let me know how.

@TiVa85
Copy link

TiVa85 commented Jan 29, 2024

I was hoping to use your python 2 version but I can't find a way to login... Is there a workaround to get my credentials in your python 2 version?

@opensubtitlesdev
Copy link
Owner

there was really just tiny syntax changes to switch from python 2.0 to 3.0
the project was orignally a fork from the os.org plugin https://github.com/juokelis/service.subtitles.opensubtitles/tree/OScom you can see where it was when I took over, and what's been done to make it both work and convert it to python 3.0

I'm a php and ruby developper, I learned just enough python to finish this plugin. I can help out but please learn the basics of python, try to figure out what is happening in the plugin, learn where is the log file, and how to put informations in it, then the usage of the api is very simple.

@cpascual
Copy link

cpascual commented Jan 30, 2024

Hi @opensubtitlesdev , as I mentioned in the "update" of my message, I already managed to solve the issues, and my version is working fine (as far as I can tell).

Note that the code is py2 only so I'd say that it can't be merged with the original one.

I submitted the backport to the leia branch of xbmc/repo-scripts repo but if you (@opensubtitlesdev) would prefer to do that yourself, or you prefer that I use a different addon ID, just let me know (my intention is to constructively contribute, not to highjack the code 😅 ).

In the meanwhile, my releases can be downloaded from my github project

@cpascual
Copy link

@TiVa85

I was hoping to use your python 2 version but I can't find a way to login... Is there a workaround to get my credentials in your python 2 version?

if you refer to login to opensubtitles.com, then the procedure is the same as with the py3 version: you need to first get the credentials by visiting https://www.opensubtitles.com (click on "register")

Once you have your credentials, you can enter them via the configuration menu for this addon in Kodi

@opensubtitlesdev
Copy link
Owner

Hi @opensubtitlesdev , as I mentioned in the "update" of my message, I already managed to solve the issues, and my version is working fine (as far as I can tell).

Note that the code is py2 only so I'd say that it can't be merged with the original one.

I submitted the backport to the leia branch of xbmc/repo-scripts repo but if you (@opensubtitlesdev) would prefer to do that yourself, or you prefer that I use a different addon ID, just let me know (my intention is to constructively contribute, not to highjack the code 😅 ).

In the meanwhile, my releases can be downloaded from my github project

oh sorry I didn't see the reply saying you solved the problems.... I think it should be fine the way you named and submitted the addon.

no issue for us if you manage that branch, more like thank you for taking care of it, it's nice to have a version for the older kodi.

will keep in touch if there was important changes in future releases

@TiVa85
Copy link

TiVa85 commented Feb 1, 2024

@TiVa85

I was hoping to use your python 2 version but I can't find a way to login... Is there a workaround to get my credentials in your python 2 version?

if you refer to login to opensubtitles.com, then the procedure is the same as with the py3 version: you need to first get the credentials by visiting https://www.opensubtitles.com (click on "register")

Once you have your credentials, you can enter them via the configuration menu for this addon in Kodi

I think my Kodi setup is really too old to expect that these things can be fixed. I am still on Kyrpton, not Leia, but as they run the same python version I hoped it was compatible...
When I go into the plugin, and go to configuration menu, I couldn't, set the credentials. problably something missing in krypton that is in leia...

Anyway, reverted back to my very old Kodi setup. I'm still rocking 17.6 as on my 6 year old philips android TV. I tried updating several times but I have issues playing h265 files with kodi >17.6... I tried updating once more a few days ago but reverted back again to 17.6... It's a shame 17.6 is working flawlessly and more up to date version of kodi are giving issues... I just added a few more subtitle providors to emby and switched to bsplayer subtitles + addicted in the case something isn't picked up by emby

@cpascual
Copy link

cpascual commented Feb 2, 2024

@TiVa85

I am still on Kyrpton, not Leia,

Ah sorry. As I mentioned, this was my first contact with kodi addon development, so I did not really investigate the API differences between kodi versions: my backport approach was just to fix the errors as I saw them on my Leia system. I am afraid I do not have any krypton system around...

When I go into the plugin, and go to configuration menu, I couldn't, set the credentials.

I see. In Kodi 18, the OS.com credentials end up stored in:

<userdata>/addon_data/service.subtitles.opensubtitles-com/settings.xml

where <userdata> depends on your OS and can be found in this table.

In my case it looks as follows (redacted):

<settings version="2">
    <setting id="APIKey" default="true">AN_API_KEY</setting>
    <setting id="foreign_parts_only" default="true">include</setting>
    <setting id="hearing_impaired" default="true">exclude</setting>
    <setting id="machine_translated" default="true">exclude</setting>
    <setting id="OSpass">MY_OS_COM_PASSWORD</setting>
    <setting id="OSuser">MY_OS_COM_USER</setting>
</settings>

I do not know if the file is the same or similar for kodi 17 but if so, you could try editing it and replacing the values of MY_OS_COM_PASSWORD and MY_OS_COM_USER by yours.

I hope that helps

@TiVa85
Copy link

TiVa85 commented Feb 4, 2024

Thanks! I'm gonna try to install 17.6 on an emulator when I have a holiday next week and will look into this!

It's hard debugging on an Android tv to be honest... I know I can attack an USB mouse but the emulator will make sure I don't always have to revert back on my working setup

@cpascual
Copy link

cpascual commented Feb 6, 2024

Just for closure: the PR to the official repo was rejected (they are not accepting new addons for old kodi versions), so I'll keep distributing it in https://github.com/cpascual/service.subtitles.opensubtitles-com/releases.

@opensubtitlesdev
Copy link
Owner

Thanks for the update.

As it's pretty common to have to trick a little to get things working with kodi, specially with older versions, it should be acceptable for users to install this from zip.

I'm preparing a tutorial/faq dedicated to kodi, will link your version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants