Jump to content

Library Sync thread has exited


fonzie

Recommended Posts

fonzie

I have been successfully using the Emby addon with my Nvidia Shield running SPMC for a while now.  I just decided to add a new profile and scan the library once again for this new user.  I keep having an issue with the initial scan for the new user profile.  The error reads:

Emby for Kodi - Library sync thread has edited! You should restart Kodi now. Please report this on the forum.

I read through the forums and lowered the items to scan from 200 down to 100 but there was no improvement.  I don't think it's a timeout issue because one thing I noticed is that the library scan always fails on the same movie "Ant-Man" so I think it has something to do with that folder.

 

I've attached my log file

 

Any help would be appreciated. thank you.

 

Edit: It might also have something with SPMC database structure being modified from the original Kodi, since it is a fork.  If this is the case, does that mean the addon has to be patched in order for it to work?

spmc.log

Edited by fonzie
Link to comment
Share on other sites

Angelblue05

Its got something to do with your local trailers, if you have any for this movie remove them from Emby and try again.

 

What is weird is that Emby must be reporting there's a local trailer, because we verify first before querying for the actual local trailer. When we do, then, no result is returned. Seems like something is amiss. I've seen someone else report that same issue in another thread. I will remove the assumption that there should be a result to prevent from crashing, but something is still wrong and needs to be fixed server side.

Edited by Angelblue05
Link to comment
Share on other sites

Angelblue05

Honestly, I thought the verification was good enough, if the server reports there is a local trailer under the main item and actually doesn't have a trailer, that's like you said, a buggy corner case. I just hope Luke reads about these corner cases and actually look to fix them. I don't know if I should start reporting in Github - seems there's nothing in place in the forums to report api bugs.

 

I understand the code needs to be more robust. It will definitively get there, now that the base is solid. To me, get/if is not very successful for corner cases. You are slowing the entire process just for an oddity that will happen never happen to the majority of users. Maybe again, I'm underestimating the amount of corner case there is with emby... :) At try/except will be much faster, since it will be successful 99% of the time. 

 

 

@@fonzie

 

Give this build a try, or you can grab it off our no - sideloading method: http://emby.media/community/index.php?/topic/32196-new-fresh-install-method-no-side-loading/

Edited by Angelblue05
Link to comment
Share on other sites

Angelblue05

I personally use get() when I know it's normal for the key to be missing. For example, item.get('LocalTrailerCount'): If the content does not have a local trailer, the key will be missing. To me, that's a good usage for get(), because success is not "guaranteed".

 

Of course in cases like this, try/except will be slower because it will fail a lot. There's a time and place for everything. get/if is not the answer to everything just like try/except isn't either. I only use try/except in two cases: I know there's can be a corner case, but will likely never happen meaning success rate is really high. Or to make the code way easier to read/maintain than a bunch of redundant if statements.

 

We already had this conversation @ - Python allows for EAFP in specific scenarios and it's worth taking advantage of it. Exceptions are really cheap in Python, here's an example: http://stackoverflow.com/questions/3929837/python-if-vs-try-except

  • Like 1
Link to comment
Share on other sites

fonzie

Thanks for the tip, fellas!  Removing the local trailer for Ant-Man seems to have solved the scanning issue.  The process has been scanning successfully for a while now and I'm just waiting for it to finish up.

Link to comment
Share on other sites

dark_slayer

We already had this conversation @ - Python allows for EAFP in specific scenarios and it's worth taking advantage of it. Exceptions are really cheap in Python, here's an example: http://stackoverflow.com/questions/3929837/python-if-vs-try-except

FWIW, (and I don't expect it to be worth much) I think this direction makes the most sense. I have actually referenced the discussion between you two a few times in unrelated conversations elsewhere as both sides make plenty of sense. In a humorous, oversimplified view it relates to someone telling the python kids to stay off their lawn

  • Like 2
Link to comment
Share on other sites

Nazgulled

I'm also having this issue but in my particular case, the sync fails immediately at startup (or forcing a manual sync). And I don't have/use any kind of trailers, so that's probably not my issue.

 

Can anyone help me setup Emby for Kodi on SPMC?

Link to comment
Share on other sites

Angelblue05

Post your kodi log otherwise it's impossible to help.

 

 

Sent from my iPhone using Tapatalk

  • Like 1
Link to comment
Share on other sites

Nazgulled

Post your kodi log otherwise it's impossible to help.

 

 

Sent from my iPhone using Tapatalk

Sorry, I was in the process of generating a clean one with all the debug information... Here you go:

  • Like 1
Link to comment
Share on other sites

Nazgulled

Is there anything that can be done?

 

I don't understand why it's not working... I cleaned up my videos/music .db files, restarted SPMC and now I got an error message about incompatible Kodi version. Looking at the log, I got to this:

 

https://github.com/MediaBrowser/plugin.video.emby/blob/8bde429da41ac2cc70b8f2f11c44d2802f1c1088/resources/lib/librarysync.py#L1010

 

Looking a bit above, it seems that videoDb = utils.getKodiVideoDBPath() is called. Which leads me to here:

 

https://github.com/MediaBrowser/plugin.video.emby/blob/8bde429da41ac2cc70b8f2f11c44d2802f1c1088/resources/lib/utils.py#L91

 

Now, assuming kodibuild = xbmc.getInfoLabel('System.BuildVersion')[:2] returns 16 for SPMC (the version I'm running is 16.1.2) the video database file should be MyVideos99.db (same as current Kodi version).

 

Going back to the initial error message I can see that that message only appears if xbmcvfs.exists(videoDb) returns false. I have no knowledge of xbmcvfs but I'm assuming - by the name - that this is checking the virtual file system for the video database file existence. What exactly does this mean I don't know because I can't find the documentation for xbmcvfs. But the MyVideos99.db file does not exist on my filesystem, is that the problem? Because it's a clean install of SPMC, the database files do not exist at all, I want to use Emby to populate them.

 

What am I missing?

Edited by Nazgulled
Link to comment
Share on other sites

Angelblue05

You'd have to open the kodi database and see if the "tag" table is missing. If it is, then you could manually create it to fix the immediate issue, but if they are changing the entire database structure, at this time it is not something easily fixed.

We are set to add data to the database a certain way, if it's missing sections in the database, then the add-on will crash because the code is not built around that specific structure. You can use a database tool to modify the kodi database while Kodi is not running... Hope this helps clarify the situation.


Sent from my iPhone using Tapatalk

Edited by Angelblue05
Link to comment
Share on other sites

Nazgulled

I was able to fix this myself...

 

The problem was that the MyVideos99.db file (and the music one, but that's not relevant for now) did not exist at all and they were never recreated. Even if i deleted the whole Databases folder, some of the .db files were recreated but the videos/music ones. What I did was move my .spmc folder to spmc.bak and rerun SPMC. This created a new .spmc folder with empty databases for both videos (MyVideos99.db) and music (MyMusic56.db) and I renamed this to spmc.new. I restored my spmc.bak folder back to .spmc and copied the .db files from the spmc.new folder. This didn't quite work at first (looking at the log was now giving an error on the emby.db file, removing that and syncing again didn't work) but then I went to the Emby plugin options and use the menu entry to reset the local Emby database and syncing initiated and was sucessfull.

 

So there, in case anyone has this same problem, this is how you can fix it.

 

For now I think we can conclude that there are not differences between SPMC and Kodi databases, they have the same table structures and are currently using the same version numbers.

  • Like 1
Link to comment
Share on other sites

Angelblue05

Thanks for reporting back :) glad you were able to fix your issue.

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...