croneter / PlexKodiConnect

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

Issue syncing music #2012

Closed ChaosAtGitHub closed 10 months ago

ChaosAtGitHub commented 10 months ago

Dear Croneter, dear Community

I've (almost) successfully setup my Kodi + Plex + PKC and I'm able to sync so far movies and tvshows without any problems but have an issue with music. I get a "SQL logic" error.

Before posting this issue, I tried it with different MP3s, have reset the kodi DB, even re-installed Kodi from scratch and just to get 100% sure I also have reset my Xbox but that doesn't help.

Setup: I'm running it on a XBox One (the old version without any X or S or whatever) Plex + Kodi + PKC is installed on the Xbox, too. Server is a regular synology NAS with plex installed.

How to reproduce the error: I just gave them a lot of music to sync. It starts syncing the artists and can complete this. Then it starts syncing the albums + songs itself and somewhere between album 200 and 250 it usually crashes. "Somewhere" is to some extend reproducable. If I just reset Kodi DB it crashes at exactly same place. If I remove the music from plex then it fails with some different music files. My first assumption was that maybe the MP3 itself is somehow corrupt but if you carve that out into an own library it can then be synched. It just seems to be that it cannot handle more than a few hundred or maybe few thousand of music files. Sounds also strange...

Attached full log but this is the short version 03 kodi.log : 2024-01-14 22:57:44.512 T:5104 info : PLEX.music: ADD album plex_id: 13074 - Name: Take a Look in the Mirror 2024-01-14 22:57:44.515 T:5104 info : PLEX.music: ADD song plex_id: 13075 - Right Now 2024-01-14 22:57:44.520 T:5104 info : PLEX.music: ADD song plex_id: 13076 - Break Some Off 2024-01-14 22:57:44.526 T:5104 info : PLEX.music: ADD song plex_id: 13077 - Counting On Me 2024-01-14 22:57:44.530 T:5104 info : PLEX.music: ADD song plex_id: 13078 - Here It Comes Again 2024-01-14 22:57:44.536 T:5104 info : PLEX.music: ADD song plexid: 13079 - Deep Inside 2024-01-14 22:57:44.544 T:5104 error : PLEX.sync: Exception encountered: SQL logic error 2024-01-14 22:57:44.544 T:5104 error : PLEX.utils: Error encountered: - SQL logic error 2024-01-14 22:57:44.549 T:5104 error : PLEX.utils: ____ 2024-01-14 22:57:44.549 T:5104 error : PLEX.utils: Traceback (most recent call last): 2024-01-14 22:57:44.549 T:5104 error : PLEX.utils: File "U:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\plugin.video.plexkodiconnect\resources\lib\library_sync\common.py", line 31, in run 2024-01-14 22:57:44.550 T:5104 error : PLEX.utils: self._run() 2024-01-14 22:57:44.550 T:5104 error : PLEX.utils: File "U:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\plugin.video.plexkodiconnect\resources\lib\library_sync\process_metadata.py", line 81, in _run 2024-01-14 22:57:44.550 T:5104 error : PLEX.utils: context.add_update(item['xml'][0], 2024-01-14 22:57:44.550 T:5104 error : PLEX.utils: File "U:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\plugin.video.plexkodiconnect\resources\lib\itemtypes\music.py", line 325, in add_update 2024-01-14 22:57:44.551 T:5104 error : PLEX.utils: context.add_update(song, 2024-01-14 22:57:44.551 T:5104 error : PLEX.utils: File "U:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\plugin.video.plexkodiconnect\resources\lib\itemtypes\music.py", line 492, in add_update 2024-01-14 22:57:44.551 T:5104 error : PLEX.utils: self.kodidb.add_song(kodi_id, 2024-01-14 22:57:44.551 T:5104 error : PLEX.utils: File "U:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\plugin.video.plexkodiconnect\resources\lib\db.py", line 28, in wrapper 2024-01-14 22:57:44.552 T:5104 error : PLEX.utils: return method(self, *args, **kwargs) 2024-01-14 22:57:44.552 T:5104 error : PLEX.utils: File "U:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\plugin.video.plexkodiconnect\resources\lib\kodi_db\music.py", line 310, in addsong 2024-01-14 22:57:44.552 T:5104 error : PLEX.utils: self.cursor.execute(''' 2024-01-14 22:57:44.552 T:5104 error : PLEX.utils: sqlite3.OperationalError: SQL logic error 2024-01-14 22:57:44.553 T:5104 error : PLEX.utils: ____ 2024-01-14 22:57:44.553 T:5104 debug : PLEX.sync: ##===--- ProcessMetadataThread Stopped ---===## 2024-01-14 22:57:44.565 T:5244 debug : ------ Window Init (DialogNotification.xml) ------ 2024-01-14 22:57:44.566 T:3600 info : CActiveAESink::OpenSink - initialize sink 2024-01-14 22:57:44.566 T:3600 debug : CActiveAESink::OpenSink - trying to open device XAUDIO:default 2024-01-14 22:57:44.610 T:3600 info : CAESinkXAudio::InitializeInternal: Format is Supported - will attempt to Initialize 2024-01-14 22:57:44.610 T:3600 info : CAESinkXAudio::InitializeInternal: XAudio Sink Initialized using: AE_FMT_FLOAT, 44100, 2

Kind Regards -Dirk

ChaosAtGitHub commented 10 months ago

One important update. I tested the same setup today but on my win10 pc. Here absolutely no issues with syncing the videos and music. Does the xbox work somehow differently ?

croneter commented 10 months ago

Thanks for the detailed issue description, @ChaosAtGitHub! Having looked into sqlite3.OperationalError: SQL logic error I can tell you that it does not look good, unfortunately :cry:. It's definitely not some bug in PKC but a bug in an underlying Python package. Can you somehow update your XBox and/or the Python packages on your Xbox? That might help.

It's impossible to fix from the PKC side - I'd have to completely rewire the DB-logic.

The fact that you can use PKC on Windows proves this, I guess.

ChaosAtGitHub commented 10 months ago

Dear croneter,

thanks for checking this. XBox is more difficult than the other systems because of the very limited access you have. I was only able to transfer the logs because Kodi has built in SMB and a filemanager support so that I was able to transfer to my NAS.

Honestly said I'm not even sure if Python comes directly with XBox or if Kodi deliveres it somehow. It seems to be possible to get developer access for a one time fee but then it is still difficult to exchange pyhton directly. Not even sure if I can with that kind of access modify existing packages from a 3rd party. Besides that my Python knowledge is limited. Overall said, I think this is a dead end street.

I see that with next Kodi version there will be an update with Pyhton. Indicates that it comes with the Kodi package itself but it's for sure worth a shot and wait for it.

Maybe I can at least give a recommendation to make bugfixing a bit easier in future. Would it help if you add another sheet in the expert-Settings of Kodi / PKC which simply shows the most significant variables, lengths or Python versions?

Kind Regards -Dirk

croneter commented 10 months ago

Y s, hopefully the next major Kodi release fixes this.

As for info about Python: there's the log for that ;-)