croneter / PlexKodiConnect

Plex integration in Kodi done right
GNU General Public License v2.0
1.17k stars 78 forks source link

Huge Plex database: Open a tv show is very slow (8-9 seconds) #1209

Open Noustaa opened 4 years ago

Noustaa commented 4 years ago

Hi, i made a short video so you can see it easily: https://streamable.com/7gglfg

When i open/browse a tv show it takes a lot of time to load it (between 8 and 9 seconds). Is it normal that it is so slow ? Is there a way to speed up that process ?

I assume the problem is not with my PC specs: i7 9700K GTX 1070 16GO DDR4 3200 mhz SSD samsung

Do you have any ideas please ?

croneter commented 4 years ago

No it's not normal, but chances are 99% that this is not an issue with PlexKodiConnect but Kodi.

Please provide a DEBUG log file of you navigating into a series, see here: https://github.com/croneter/PlexKodiConnect/wiki/How-to-Report-A-Bug

Noustaa commented 4 years ago

Hello Croneter thank you for your help! Here is the log while i was navigating through tv shows

I just replaced my server address in the log, hope nothing else is confidential inside it.

I first opened the tv show: "2 broke girls" then "13 reasons why" and then "24".

Hope that helps !

croneter commented 4 years ago

Thanks for the log!

Unfortunately, you did not delete the Plex tokens as explained in the link above. Please immediately follow the instructions I published my Plex token to some forum or Github. Anyone can now access my Plex Server!

croneter commented 4 years ago

So here you go:

  1. Try to reset the Kodi: in the PlexKodiConnect settings, go to Advanced, then Reset the Kodi database... (in red). Hit YES, then NO. Let Kodi restart and rescan
  2. If that does not help, then your issue is with Kodi (and not PlexKodiConnect) and most likely caused by the Kodi add-on plugin.video.themoviedb.helper. Please take this issue to the Kodi forums then, nothing I can help you with...

Excerpts from your log file regarding 2):

2020-08-10 12:39:19.981 T:16988  NOTICE: [plugin.video.themoviedb.helper]
                                            No JSON object could be decoded
2020-08-10 12:39:19.984 T:16988   DEBUG: CAddonSettings[plugin.video.themoviedb.helper]: loading setting definitions
2020-08-10 12:39:19.984 T:16988   DEBUG: CAddonSettings[plugin.video.themoviedb.helper]: trying to load setting definitions from old format...
2020-08-10 12:39:19.984 T:16988  NOTICE: [plugin.video.themoviedb.helper]
                                            No JSON object could be decoded
2020-08-10 12:39:19.987 T:16988   DEBUG: CAddonSettings[plugin.video.themoviedb.helper]: loading setting definitions
2020-08-10 12:39:19.987 T:16988   DEBUG: CAddonSettings[plugin.video.themoviedb.helper]: trying to load setting definitions from old format...
2020-08-10 12:39:19.987 T:16988  NOTICE: [plugin.video.themoviedb.helper]
                                            No JSON object could be decoded
2020-08-10 12:39:19.995 T:5496   DEBUG: XFILE::CPluginDirectory::StartScript - calling plugin TheMovieDb Helper('plugin://plugin.video.themoviedb.helper/','15','?info=genre&widget=True&type=movie&tmdb_id=10751','resume:false')
2020-08-10 12:39:19.995 T:16000   DEBUG: Thread LanguageInvoker start, auto delete: false
2020-08-10 12:39:19.995 T:16000    INFO: initializing python engine.
2020-08-10 12:39:19.995 T:16000   DEBUG: CPythonInvoker(21, C:\Users\Noustaa\AppData\Roaming\Kodi\addons\plugin.video.themoviedb.helper\plugin.py): start processing
2020-08-10 12:39:19.995 T:16988    INFO: CPythonInvoker(19, C:\Users\Noustaa\AppData\Roaming\Kodi\addons\plugin.video.themoviedb.helper\plugin.py): script successfully run
2020-08-10 12:39:19.995 T:16988   DEBUG: CPythonInvoker::onExecutionDone(19, C:\Users\Noustaa\AppData\Roaming\Kodi\addons\plugin.video.themoviedb.helper\plugin.py)
2020-08-10 12:39:20.021 T:3488  NOTICE: [plugin.video.themoviedb.helper]
                                            HTTP Error Code: 422
                                            Request: https://api.themoviedb.org/3/search/tv?api_key=a07324c669cac4d96789197134ce272b&query=#blackAF&language=en-US&include_image_language=en,null
2020-08-10 12:39:20.021 T:3488   DEBUG: [plugin.video.themoviedb.helper]
                                            TMDb Get Details: No Item Type or TMDb ID!
                                            tv None
Noustaa commented 4 years ago

Hey, i did remove the log from my old comment is it enough?

Here is a new log (without token i hope) kodi.log

I did reset kodi, then uninstall to make a fresh new install without any skin and any addons expect PKC. It is still slow, could you please still confirm that it is KODI issue and not PKC so i can go to KODI forum to get help ?

Thanks for your help ! :)

croneter commented 4 years ago

Unfortunately, it is not enough if you just delete the log from you old comment - the internet never forgets! So please follow the instructions. Very sorry for that 😢

croneter commented 4 years ago

Looking at the log it seems like you uninstalling Kodi did NOT completely reset it. Please shut down Kodi, then simply delete the Kodi userdata folder completely. That can also work wonders 😉.

I see the following in your log:

2020-08-10 14:02:13.540 T:204   DEBUG: ------ Window Init (DialogBusy.xml) ------
2020-08-10 14:02:13.593 T:10508   DEBUG: PLEX.plex_functions: Waiting for download to finish
2020-08-10 14:02:17.751 T:10508   DEBUG: Previous line repeats 19 times.
2020-08-10 14:02:17.751 T:10508   DEBUG: PLEX.sync.full_sync: Processing 629 playstates for library section {'index': 0, 'name': 'Anime', 'section_id': 4, 'section_type': 'show', 'sync_to_kodi': True, 'last_sync': 1597057957}
2020-08-10 14:02:17.807 T:10508   DEBUG: PLEX.sync.full_sync: Processing 865 playstates for library section {'index': 1, 'name': 'Kids TV', 'section_id': 3, 'section_type': 'show', 'sync_to_kodi': True, 'last_sync': 1597057957}
2020-08-10 14:02:17.885 T:10508   DEBUG: PLEX.sync.full_sync: Processing 7367 playstates for library section {'index': 3, 'name': 'TV Shows', 'section_id': 2, 'section_type': 'show', 'sync_to_kodi': True, 'last_sync': 1597057957}
2020-08-10 14:02:17.951 T:10508   DEBUG: PLEX.plex_functions: Waiting for download to finish
2020-08-10 14:02:19.582 T:10508   DEBUG: Previous line repeats 12 times.
2020-08-10 14:02:19.582 T:10508   DEBUG: PLEX.sync.full_sync: Processing 1119 playstates for library section {'index': 0, 'name': 'Anime', 'section_id': 4, 'section_type': 'show', 'sync_to_kodi': True, 'last_sync': 1597057957}
2020-08-10 14:02:19.622 T:10508   DEBUG: PLEX.sync.full_sync: Processing 2190 playstates for library section {'index': 1, 'name': 'Kids TV', 'section_id': 3, 'section_type': 'show', 'sync_to_kodi': True, 'last_sync': 1597057957}
2020-08-10 14:02:19.677 T:10508   DEBUG: PLEX.plex_functions: Waiting for download to finish
2020-08-10 14:02:19.793 T:10508   DEBUG: PLEX.sync.full_sync: Processing 17953 playstates for library section {'index': 3, 'name': 'TV Shows', 'section_id': 2, 'section_type': 'show', 'sync_to_kodi': True, 'last_sync': 1597057957}
2020-08-10 14:02:19.859 T:10508   DEBUG: PLEX.plex_functions: Waiting for download to finish
2020-08-10 14:02:20.984 T:16768   DEBUG: Previous line repeats 7 times.
2020-08-10 14:02:20.984 T:16768   DEBUG: Thread waiting 16768 terminating
2020-08-10 14:02:20.986 T:204   DEBUG: ------ Window Deinit (DialogBusy.xml) ------

So it took 7 seconds between Window Init and Window Deinit, which is indeed way too long.

PlexKodiConnect is still synching in the background (startup sync). This obviously messes with the Kodi database.

Does it help if you start Kodi, WAIT for 1-2 minutes, then try to navigate to a show?

croneter commented 4 years ago

So tv show loading is just a very unfortunate coincidence: PKC was synching in the background. This happens in the very beginning after Kodi startup and once an hour and should only take a couple of seconds. (like 7 seconds 😉 )

Noustaa commented 4 years ago

Alright i follow the procedure here https://github.com/croneter/PlexKodiConnect/wiki/How-to-Report-A-Bug#i-published-my-plex-token-to-some-forum-or-github-anyone-can-now-access-my-plex-server Thanks ! :)

I did what you say, wait 1 minutes until the end of the sync (i have activate the option to show the background sync so i know when it is done). Unfortunately, same issue. here is the log kodi.log

Well i will try on KODI forum hopefully somebody can find a solution ! Thank you :)

croneter commented 4 years ago

Do wait 2-3min please - pkc syncs playstates in the background without showing a dialog.

Noustaa commented 4 years ago

Hi Croneter! I have wait way more than 2 minutes and still the same... Now i'm trying to cache all image to kodi's cache (i dont even know what it is for but im trying all i can :D ) I have open an issue on Kodi's forum: https://forum.kodi.tv/showthread.php?tid=356335

Also, i have tried something else, reset my local library then synced again but i synced like 1/4 of all my tv shows. Here the browsing was smooth (like less than 1 sec to open the tv show)! Then i synced the rest of the tv show and here slow again (8-9 seconds)! Is it possible that the problem is because of a too big database ? If so, is the issue from Kodi or from the Addon ?

What are your though on that ?

Thanks for your help!

croneter commented 4 years ago

Please share another debug log of you navigating into a series - after you've let Kodi sit for at least 5min.

Noustaa commented 4 years ago

Hi Croneter, please see last answer from Karellen https://forum.kodi.tv/showthread.php?tid=356335

I will do what you asked me to and will send you the log in a few minutes

Noustaa commented 4 years ago

Here the log you asked for ! I waited 10 minutes after kodi was open and still the same issue kodi.log

croneter commented 4 years ago

You did not enable debug logging, unfortunately. Could you be so kind and try again - restart Kodi, let it sit for 10min, then open a TV show, then share the debug log file?

I have an idea what's causing the issue and the log would really help...

Noustaa commented 4 years ago

I do apologize didnt pay attention ! Here is the new one ! Thank you so much for helping me with that !

kodi.log

If it is still not okay please let me know and i will do it again !

Noustaa commented 4 years ago

Hi Croneter please see my last answer here with the last log file with all caching OFF

https://forum.kodi.tv/showthread.php?tid=356335&pid=2969877#pid2969877

Noustaa commented 4 years ago

Hi Croneter! As i discovered kodi 19 matrix is faster to load the tv series (you can refer to my last post on my kodi forum thread). I am willing to be your alpha/beta tester for matrix 19 when PKC will be ready for python 3. You can count on me.

cheers

Noustaa commented 3 years ago

Hi @croneter ! I'm back with your last PKC beta version for Matrix :) I confirm this issue is solved with Kodi 19 matrix