Opensubtitles
#1
I have Kodi 19.3 running on a Linux box (Elementory OS 5.1), and my Open Subtitles add-on is crazy slow for finding and downloading remote subs. Takes about 5 minutes to query OpenSubtitles and return the available choices, then another 5 minutes to actually download a sub.

On a Windows 10 machine (same network), Kodi 19.3 will query OpenSubtitles and return the list of subs in about 3 seconds, then download a sub in another 3 seconds.

Both machines are using wired ethernet and are plugged into the same switch. Logs from both boxes are below, the problem is on the slow LInux machine, but I've included a log from the fast Win 10 machine for comparison.

I upgraded the Linux machine to Kodi 19.4, removed the OpenSubtitles.com and .org plug-ins, then re-installed OpenSubtitles.org, and the issue is unchanged. The plug-in's Open Subtitles username and password are correct and are the same on both machines.

Can anyone see what the problem might be with the VERY slow Linux machine? 

Linux (slow) https://pastebin.com/prXhSA2u

Windows (fast) https://pastebin.com/eGARRrig
Reply
#2
Some observations on your Linux box...

2022-12-12 13:48:28.523 T:1741 INFO <general>: Enabled debug logging due to GUI setting. Level 2.
When you enable debugging, RESTART Kodi, so debugging can start from the very beginning. Now you activated it more than 1.5 hours after starting Kodi. Errors can evolve at any moment.

This is unrelated but it doesn't help...
Code:
SQL: [MyMusic82] Undefined MySQL error: Code (1305)
Your kodi database user probably has insufficient database rights, and thus view tables have not been created.

2022-12-12 12:59:55.222 T:4973 ERROR <general>: CCurlFile::Exists - Failed: Login denied(67) for ftp:..
This can create some waiting time.
Reply
#3
>> 2022-12-12 12:59:55.222 T:4973 ERROR <general>: CCurlFile::Exists - Failed: Login denied(67) for ftp:..
>> This can create some waiting time.

Ah, that was it. I had a defunct remote/ftp source on that machine and I guess Kodi was trying and failing to log onto that server every time it interacted with OpenSubtitles. I deleted the source & restarted Kodi, and OpenSubtitles is nice and fast again! I would never have found that without your help - thanks so much!

>> 2022-12-12 13:48:28.523 T:1741 INFO <general>: Enabled debug logging due to GUI setting. Level 2.
>> When you enable debugging, RESTART Kodi, so debugging can start from the very beginning. Now you activated it more than 1.5 hours after starting Kodi. Errors can evolve at any moment.

 Noted. My thought was to reduce the log to just the OpenSubtitles call for brevity but I'll try and remember to restart Kodi after enabling logging in the future.

>> This is unrelated but it doesn't help...
>> SQL: [MyMusic82] Undefined MySQL error: Code (1305)

The only way I know to check permissions is to check grants (below) and it looks like the kodi user has the run of the database. Is there something else I should check?

MariaDB [tandemda_tdom]> show grants for kodi;
+--------------------------------------------------------------------------------------------------------------+
| Grants for kodi@%                                                                                            |
+--------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'kodi'@'%' IDENTIFIED BY PASSWORD '*REDACTED*' |
+--------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Reply
#4
Hmm... I take it the views do exist in your Kodi database(s) ?
Reply
#5
I'm not familiar enough with the database to know what views you're asking about, but:
 
Code:
MariaDB [MyVideos119]> show tables like '%view%';
+--------------------------------+
| Tables_in_MyVideos119 (%view%) |
+--------------------------------+
| episode_view                   |
| movie_view                     |
| musicvideo_view                |
| season_view                    |
| tvshow_view                    |
| tvshowlinkpath_minview         |
+--------------------------------+
6 rows in set (0.00 sec)

MariaDB [MyVideos119]> select count(*) from episode_view;
+----------+
| count(*) |
+----------+
|    10930 |
+----------+
1 row in set (0.08 sec)

MariaDB [MyVideos119]> select count(*) from movie_view;
+----------+
| count(*) |
+----------+
|     1561 |
+----------+
1 row in set (0.02 sec)

MariaDB [MyVideos119]> select count(*) from musicvideo_view;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

MariaDB [MyVideos119]> select count(*) from season_view;
+----------+
| count(*) |
+----------+
|      757 |
+----------+
1 row in set (0.90 sec)

MariaDB [MyVideos119]> select count(*) from tvshow_view;
+----------+
| count(*) |
+----------+
|      197 |
+----------+
1 row in set (0.06 sec)

MariaDB [MyVideos119]> select count(*) from tvshowlinkpath_minview;
+----------+
| count(*) |
+----------+
|      197 |
+----------+
1 row in set (0.01 sec)

MariaDB [MyVideos119]>
Reply
#6
That's a listing for the video database, the error applies to the music database: SQL: [MyMusic82] Undefined MySQL error: Code (1305) .
Reply
#7
My bad. MyMusic82 views are below. If I run the query by itself, MySQL returns
 
Code:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '_'

which is complaining about the CASE statement's improperly escaped third OR condition (I can't seem to post the entire query here without having my post blocked, so I created a PasteBin for it https://pastebin.com/NVXMTr49):
 
Code:
 [color=#c0392b] albumview.strAlbum LIKE 'The_ 1.116364E+93SCAPE '_'[/color]
Code:
MariaDB [tandemda_tdom]> use MyMusic82
Database changed
MariaDB [MyMusic82]> show tables like '%_view';
+------------------------------+
| Tables_in_MyMusic82 (%_view) |
+------------------------------+
| albumartistview              |
| albumview                    |
| artistview                   |
| songartistview               |
| songview                     |
+------------------------------+
5 rows in set (0.00 sec)

MariaDB [MyMusic82]> select count(*) from albumartistview;
+----------+
| count(*) |
+----------+
|     2658 |
+----------+
1 row in set (0.00 sec)

MariaDB [MyMusic82]> select count(*) from albumview;
+----------+
| count(*) |
+----------+
|     2641 |
+----------+
1 row in set (0.00 sec)

MariaDB [MyMusic82]> select count(*) from artistview;
+----------+
| count(*) |
+----------+
|     5090 |
+----------+
1 row in set (0.01 sec)

MariaDB [MyMusic82]> select count(*) from songartistview;
+----------+
| count(*) |
+----------+
|    39326 |
+----------+
1 row in set (0.05 sec)

MariaDB [MyMusic82]> select count(*) from songview;
+----------+
| count(*) |
+----------+
|    26056 |
+----------+
1 row in set (0.06 sec)

MariaDB [MyMusic82]>
Reply
#8
(2022-12-17, 17:04)charlesmayo53 Wrote: If I run the query by itself, MySQL returns

Okay, so the views are there. Can you provide the full query that is going wrong? Kodi/MariaDB says it's a typo of some sorts.
Reply
#9
I can't post the SQL here without triggering a security block. Check the pastebin at https://pastebin.com/NVXMTr49 and the  CASE statement's third OR condition,
Code:
albumview.strAlbum LIKE 'The_ 1.116364E+93SCAPE '_'
Reply
#10
Yep, that's not right. Anything with only 3 (double) quotes in computer software on 1 such line will have a problem.

TBH, I have no music database running at the moment because of moving my media files to other drives, so I cannot really reproduce this.
Is this from a generic query, or something you "created" via playlists or anything? Perhaps do a check/fix on all your database tables?
Reply
#11
Yeah, I dumped the music database, deleted from MySQL and re-created it, then imported the dumped records and restarted Kodi... it's still throwing that error. The log contains the query it thinks it's going to run and the correct OR condition is 
Code:
OR albumview.strAlbum LIKE 'The_%' ESCAPE '_'
but the code or the database is corrupting that query into
Code:
OR albumview.strAlbum LIKE 'The_ 1.116364E+93SCAPE '_'

which is unbalancing the string terminators. This is alll internal Kodi; nothing I've done. Usually when a string gets blown out like that it's because the query contans an unescaped string terminator. I'm not particularly concerned... it's probably down to a weird character in a music filename somewhere, but doesn't seem to be causing any real problems (and I don't use the music DB all that often).

Thanks a lot for your help in identifying the bad video source that was killing OpenSubtitles - that's made a huge improvement for me.
Reply
#12
(2022-12-17, 20:19)charlesmayo53 Wrote: OR albumview.strAlbum LIKE 'The_%' ESCAPE '_'

It's confusing, because as I see, anything after a %-sign would/should be superfluous.
I don't know why an escaped underscore at the back would even matter in that query.

Just a brainfart: you are running MariaDB (Connected to version 10.1.48-MariaDB-0ubuntu0.18.04.1).
I'm curious as to what MySQL would make of it. MariaDB has had some hiccups in the past, so...
Not asking you to install MySQL as well, but I'm simply wondering if your database server is doing some weird computational translation.

IMO, any problematic video/music source shouldn't affect local add-ons, theoretically it should affect all of Kodi and not just some subtitles add-on. But stranger things have happened.
Reply
#13
Yeah, I don't know what that ESCAPE statement is supposed to do. Like you, I'd assume that the "%" wildcard would match anything except "%" so if anything had to be additionally escaped, it should have been the percent sign. Oh well.

I guess could spin up a VM and install Oracle MySQL, but I'm really not that curious. I may just delete the music database and let Kodi recreate it from scratch, then start adding music files in groups and see if I can spot the group that starts throwing the error. If I ever figure out what's causing the error, I'll come back and update this thread.

Cheers,

Chuck Mayo
Reply
#14
does it work on Nexus?
I have login issue whenever use this add on on Nexus Kodi, I test it on web logon and it's fine, but on Kodi no..
Reply
#15
(2023-07-19, 13:42)Sentinel11 Wrote: does it work on Nexus?
I have login issue whenever use this add on on Nexus Kodi, I test it on web logon and it's fine, but on Kodi no..
Seems like there was an issue a few years ago where an updated OpenSubtitles add-on broke the authentication and I had to downgrade the OpenSubtitles add-on to an earlier version to get it to work again. I think the version I downloaded at the time was 5.2.14 and now on Kodi Nexus 20.1, the installed version of OpenSubtitles seems to be an even earlier version; 5.1.14.
Quote:Changelog:
5.1.14
- Users are able to download subtitles as anonymous without authentication. Updated descriptions, icons, screenshots, fanart etc

So you might want to check your OpenSubtitles version and/or research along those lines.
Reply

Logout Mark Read Team Forum Stats Members Help
Opensubtitles0