opensubtitles / service.subtitles.opensubtitles_by_opensubtitles

KODI OpenSubtitles.org addon modified by opensubtitles, works without login
https://forum.opensubtitles.org/viewtopic.php?f=8&p=36070
94 stars 37 forks source link

Can't find subtitles, new result data format #16

Closed velp closed 6 years ago

velp commented 6 years ago

Addon fails with error in log file:

 - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.AttributeError'>
Error Contents: 'dict' object has no attribute 'sort'
Traceback (most recent call last):
  File "/storage/.kodi/addons/service.subtitles.opensubtitles_by_opensubtitles-master/service.py", line 210, in <module>
    Search(item)
  File "/storage/.kodi/addons/service.subtitles.opensubtitles_by_opensubtitles-master/service.py", line 43, in Search
    search_data.sort(key=lambda x: [not x['MatchedBy'] == 'moviehash',
AttributeError: 'dict' object has no attribute 'sort'
-->End of Python script error report<--

because received data has a new format, for example, see: https://pastebin.com/QgpMjJAq it's data which received in line: https://github.com/opensubtitles/service.subtitles.opensubtitles_by_opensubtitles/blob/master/service.py#L36 In the new format data is a dict not a list.

Trefex commented 6 years ago

Seems to work. Please @burekas7 @opensubtitles merge the MR soon 👍

burekas7 commented 6 years ago

Thanks, I checked you fix and it's ok. But I don't have the write access to confirm the PR.

You should write about this in the official forum: https://forum.opensubtitles.org/viewforum.php?f=8&sid=211c93c1d97334f5e4476691e3f22215

I will try to remind him also with private message.

velp commented 6 years ago

I see other user already has this problem: https://forum.opensubtitles.org/viewtopic.php?f=8&t=15847&start=105#p39738 I wrote post in the official forum but it awaits moderation.

ironashram commented 6 years ago

applied patch manually and i confirm it's working well

vid0 commented 6 years ago

patch works like a charm 👍

issy1978 commented 6 years ago

what i have to patch where to get it fixed please not to familiar with github and things like this sorry

issy1978 commented 6 years ago

@velp @vid0 @ironashram what do i have to do exactly to get the addon fixed please

ironashram commented 6 years ago

@issy1978
browse your Kodi setup to something like C:\Users\YourUser\AppData\Roaming\Kodi\addons\service.subtitles.opensubtitles_by_opensubtitles
Edit service.py with a text editor and add the lines modified in the following commit https://github.com/velp/service.subtitles.opensubtitles_by_opensubtitles/commit/6b25c9eea0ca32ccadda006a46ad84fdf07f7ca2 after line: if search_data != None:

issy1978 commented 6 years ago

@ironashram cant open this link get 404 error

velp commented 6 years ago

@issy1978, for manually fix, you can:

  1. go to addon's directory (for example Kodi in OpenELEC is using: ~/.kodi/addons/service.subtitles.opensubtitles_by_opensubtitles-master)
  2. open file service.py in a text editor
  3. add string search_data = search_data.values() after line if search_data != None: (line number 43)

But you should not forget to add 4 spaces to the beginning of the new line from point 3, it's very important. Eventually, you must see something like:

  if search_data != None:
    search_data = search_data.values()
bezik46 commented 6 years ago

@ velp, so either 3 lines or this one liner, thanks!

opensubtitles commented 6 years ago

it is fixed now. Sorry. There was reordering by SCORE done, but index stays, so it produces this error. Please check yourself. Also we are introducing REST for search, example: https://rest.opensubtitles.org/search/imdbid-0133093/sublanguageid-eng (you can use any valid arguments same like in SearchSubtitles). It is cached, fast and effective

velp commented 6 years ago

@scerazy, the three-line option more correct because of checks old format.

velp commented 6 years ago

@opensubtitles, where can I see some documentation about new API? Maybe I fix the addon to work with the new API.

pitsi commented 6 years ago

When can we expect the patch to be merged with upstream and a new, patched version of service.subtitles.opensubtitles_by_opensubtitles ready for installation in kodi?

velp commented 6 years ago

@pitsi, AFAIU currently addon works fine without this patch. This issue will be closed.

hadifarnoud commented 6 years ago

@velp addon does not work for me with or without this patch!