opensubtitlesdev / service.subtitles.opensubtitles-com

Opensubtitles.com Kodi extension
GNU General Public License v2.0
10 stars 13 forks source link

Python 2.x support - Kodi <19 #2

Closed JimmyS83 closed 7 months ago

JimmyS83 commented 1 year ago

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 commented 1 year ago

-- reply above this line -- DEAR OPENSUBTITLESDEV/SERVICE OPENSUBTITLES-COM, ──────────────────────────────────────────────── Hi,

Oh, you mean this current extension doesn't work prior to kodi 19 ? 

this extension is just a fork of the very old original extension that's been around forever, I don't even know for what python version it was made.

cheers

os_dev

Your OpenSubtitles.org Team, ────────────────────────────────────────────────────────────────────────────────────────── We hope this response has sufficiently answered your questions. If not, please do not send another email. Instead, reply to this email or [l̲o̲gi̲n̲ t̲o̲ yo̲u̲r̲ a̲c̲c̲o̲u̲n̲t̲][1] for a complete archive of all your support requests and responses.


[1] http://support.opensubtitles.org/view.php?auth=o1x5rdaaaftrmaaaIU6GS30LDXN1vA%3D%3D Ref-Mid: @.***

JimmyS83 commented 1 year ago

@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 commented 1 year ago

The extension was written in python 2, less than 10 lines of change to make it python 3 compatible

Really not the time to deal with that now sorry, if somebody need i just have to go back 2 git commits and make an archive

Le mar. 13 sept. 2022 à 14:45, JimmyS83 @.***> a écrit :

@opensubtitlesdev https://github.com/opensubtitlesdev @jujudellago https://github.com/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.

— Reply to this email directly, view it on GitHub https://github.com/opensubtitlesdev/service.subtitles.opensubtitles-com/issues/2#issuecomment-1240620296, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACIJBNFCW5JRJHG4QKWMDV6BZPVANCNFSM6AAAAAAQGXNIPE . You are receiving this because you were mentioned.Message ID: <opensubtitlesdev/service.subtitles.opensubtitles-com/issues/2/1240620296@ github.com>

navyseai commented 7 months ago

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 commented 7 months ago

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 :cry:

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 commented 7 months ago

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 commented 7 months ago

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 commented 7 months ago

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 :sweat_smile: ).

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

cpascual commented 7 months ago

@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 commented 7 months ago

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 commented 6 months ago

@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 commented 6 months ago

@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 commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

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.