croneter / PlexKodiConnect

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

PKC 3.9.3 Movies Duplicate #2068

Closed labdiynez closed 5 months ago

labdiynez commented 5 months ago

Help yourself

Describe the bug

3.9.3 for Kodi Matrix and beyond (beta only) Direct Paths Movies Duplicate

image

To Reproduce

Steps to reproduce the behavior: If I use version 3.9.0 this problem does not occur.

Expected behavior

A clear and concise description of what you expected to happen.

kodi.log

croneter commented 5 months ago

I can confirm this bug. I fear that the culprit might be https://github.com/croneter/PlexKodiConnect/pull/2061 and a racing condition. Investigating....

Nope, that change is not the culprit.

thorindwarf commented 5 months ago

I'm also seeing duplicated movies in my Kodi. PKC 3.9.3.

croneter commented 5 months ago

The culprit is our new feature https://github.com/croneter/PlexKodiConnect/pull/2041. Movies that have several editions (e.g. director's cut, normal version) get an additional entry in the Kodi database on each restart of Kodi (or each full sync).

Can someone quickly confirm that please?

thorindwarf commented 5 months ago

You are right about the increasing after restart but I only have duplications for 1 movie (currently 121 of them) but it has one single edition/version.

croneter commented 5 months ago

OK this is a nasty one, because all of a sudden I don't have this issue anymore :cry:

@thorindwarf: could you please enable debug logging, restart Kodi, CHECK the number of duplicates you have, then additionally start a manual library sync (video => video add-ons => PlexKodiConnect => Perform manual library sync) 3 times (wait a while to make sure a sync completes), then check the number of duplicates again, then share the log file?

See https://github.com/croneter/PlexKodiConnect/wiki/How-to-Report-A-Bug

croneter commented 5 months ago

@thorindwarf I think I got it, fixing now... No need for log files :wink:

thorindwarf commented 5 months ago

I upgraded to 3.9.4, reset db of course and now I'm getting these in the log. Sorry for the bad formatting:

`2024-04-24 16:04:07.886 T:29418 info : PLEX.sync.sections: Starting synching sections from the PMS 2024-04-24 16:04:08.069 T:29330 error : EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--

2024-04-24 16:04:08.316 T:29248 error : GetDirectory - Error getting plugin://plugin.video.plexkodiconnect/?mode=browseplex&key=%2Fhubs%2FcontinueWatching&plex_type=mixed&reload=`

2024-04-24 16:05:07.936 T:29460 info <general>: PLEX.tvshows: ADD season plex_id 470375 - Season 5 2024-04-24 16:05:08.165 T:29460 info <general>: PLEX.sync.process_metadata: Finished processing section successfully: {'index': 3, 'name': 'TV Shows', 'section_id': 5, 'section_type': 'show', 'plex_type': 'season', 'sync_to_kodi': True, 'last_sync': None} 2024-04-24 16:05:08.173 T:29460 info <general>: PLEX.tvshows: ADD episode plex_id: 370470 - Принцът и дамата с чантата 2024-04-24 16:05:08.179 T:29460 error <general>: PLEX.sync: Exception encountered: name 'plex_guid' is not defined 2024-04-24 16:05:08.179 T:29460 error <general>: PLEX.utils: Error encountered: - name 'plex_guid' is not defined 2024-04-24 16:05:08.184 T:29460 error <general>: PLEX.utils: _____________________________________________________________ 2024-04-24 16:05:08.184 T:29460 error <general>: PLEX.utils: Traceback (most recent call last): 2024-04-24 16:05:08.184 T:29460 error <general>: PLEX.utils: File "/storage/.kodi/addons/plugin.video.plexkodiconnect/resources/lib/library_sync/common.py", line 31, in run 2024-04-24 16:05:08.185 T:29460 error <general>: PLEX.utils: self._run() 2024-04-24 16:05:08.185 T:29460 error <general>: PLEX.utils: File "/storage/.kodi/addons/plugin.video.plexkodiconnect/resources/lib/library_sync/process_metadata.py", line 81, in _run 2024-04-24 16:05:08.185 T:29460 error <general>: PLEX.utils: context.add_update(item['xml'][0], 2024-04-24 16:05:08.185 T:29460 error <general>: PLEX.utils: File "/storage/.kodi/addons/plugin.video.plexkodiconnect/resources/lib/itemtypes/tvshows.py", line 573, in add_update 2024-04-24 16:05:08.185 T:29460 error <general>: PLEX.utils: plex_guid=plex_guid, 2024-04-24 16:05:08.185 T:29460 error <general>: PLEX.utils: ^^^^^^^^^ 2024-04-24 16:05:08.185 T:29460 error <general>: PLEX.utils: NameError: name 'plex_guid' is not defined 2024-04-24 16:05:08.185 T:29460 error <general>: PLEX.utils: _____________________________________________________________ 2024-04-24 16:05:08.187 T:29418 info <general>: PLEX.utils: It took 0:00:41.053952 to run the function process_new_and_changed_items

croneter commented 5 months ago

@thorindwarf already fixed, but wait for 3.9.6 - coming up in like 3 min