Jump to content

Emby for Kodi failed to sync


BiTeTHeBiGG

Recommended Posts

BiTeTHeBiGG

Hi, I have an emby install for mobile devices outside my home place and a mysql install of three kodi clients for home watching.

As I have to update both databases and set the watched status on both systems I triesd the Emby for Kodi add on and hoped I could keep Emby as my DB server and Kodi (still mysql) as a syncing client.

 

After the start of the addon I can choose my server, choose my profile and put the password in. On the question which database I will sync I choose All.

Then a second later I get a failed error.

 

hier the most important part of the log:

2020-02-22 15:14:49.911 T:3324  NOTICE: EMBY.sync -> starting sync with [u'b76ef1ba30ea2a6f2cae4a27edb2a50d', u'83678a05144f82182827985ec5df3fb1', u'f3bc1d9efa8ba3d5c20b995826989242', u'ece2e338969dd4bee64c0a6c005791ec', u'4a2def0cb12602fa980fb0ad9fbc883e', u'7a2175bccb1f1a94152cbd2b2bae8f6d', u'767bffe4f11c93ef34b805451a696a4e', 'Boxsets:']
2020-02-22 15:14:49.937 T:3324  NOTICE: EMBY.helper.wrapper -> Processing Anime (GER): b76ef1ba30ea2a6f2cae4a27edb2a50d
2020-02-22 15:14:50.071 T:3324  NOTICE: EMBY.database -> ERROR:: type: <class 'sqlite3.OperationalError'> value: no such table: tvshow

Is Emby for Kodi mysql compatible? The table tvshow is available on the mysql db / server. Just empty, but there.

 

Navigating over the dynamic links works but what I was expecting was a full sync to the "local" db of Kodi nevertheless it is local-sqlite or network-mysql.

 

Greets

Bite

Edited by BiTeTHeBiGG
Link to comment
Share on other sites

BiTeTHeBiGG

Hi Luke,
 
this morning I tried to remove the "advancedsettings.xml" file in Kodi to switch back from MySQL DB to local SQLite DB.
Kodi could not start anymore cause of a missing language file (seems to be a commong happening issue) so I decided to beginn again from scratch.
Without the "advancedsettings.xml" file I could sync with Emby for Kodi but an soon I put the "advancedsettings.xml" file back it didn't sync again.
So this means that the video addon still not working with a centralized db.
I know this part will be on the Emby side from now on ... BUT ... my thoughts were ... what if Emby crashes? Yes, I am still able to whatch on the Kodi devices but it will not be synced anymore through all devices, so the watched status as also new files must again be added to all other devices and this is what I don't like.

 

EDIT: Is there a possibility to easy migrate the watched status to Emby? At the moment my main db is on mysql and as of incompatibility I will have to do it all once again by hand on emby :(
 
Thank you and best regards
Bite

kodi.log

kodi_stacktrace-18.5 Git_20191116-37f51f6e63-20200223-002756.txt

Edited by BiTeTHeBiGG
Link to comment
Share on other sites

BiTeTHeBiGG

hmm, is there a way to trigger the changed watched status within kodi to send the new watched status back to emby manually?

I could export the status from mysql and update it in sqlite, but the emby addon will not sync back even after a manual resync.

I don't like the idea to use a online service.

Edited by BiTeTHeBiGG
Link to comment
Share on other sites

BiTeTHeBiGG

Yes, indeed, but I have a huge db growing over the last 15 years. There are more than 24'000 single items.

Ok may be I do it the other way to emby db so it will be replicated to kodi the next time i start it. i will do some tests.

Link to comment
Share on other sites

BiTeTHeBiGG

Hi Luke,

 

I don't figure out where the field "key" is coming. I see there is a value in the "UserDataKeys2" table. Or is it just a uuid? And how to generate it?

I could successfully add some records, but I'm not sure if the key is safe.

 

Thanks and best regards

Bite

Edited by BiTeTHeBiGG
Link to comment
Share on other sites

BiTeTHeBiGG

I have the concerned UserDataKeyId and just have to set the watched status with a sql script. Are there other scriptable possibility?

I don't want to use trakt.

 

For the couple of records in emby the status is showing right but in kodi it ill again not synced. so I guess I have to delete local database and sync again.

Link to comment
Share on other sites

It's generated internally by emby server, and the method for generating if will vary based on the type of media. It's not something you're going to be able to duplicate easily.

Link to comment
Share on other sites

BiTeTHeBiGG

Ok, but there is no reference to somerhing? I mean is it a random value?
I inserted the 24k lines and emby seems to work on my test environment. This time I also did set the actual time for the the last two fields and run in kodi the db update within addons db management over night and the wathed flags are now replicated.

 

Edit: The only thing I notice in general with this addos is that on tv shows if you have a dvd and a blueray version you will see in kodi only the bluray.

Edited by BiTeTHeBiGG
Link to comment
Share on other sites

It is often based on provider IDs, and sometimes based on the guid. And sometimes based on the value from a parent item

Link to comment
Share on other sites

BiTeTHeBiGG

Thank you. So to say it clear it is calculated out of different references depending on the item sources / type.

But it is unique and a hash of the parameters (sometimes).

But there is no other direct reference of this value in the rest of the library? Or to ask a clear question, will it be sufficent to generate a random unique hash or uuid (or just get the one from the UserDataKeys2) and all is ok, right?

Till now all seems to work for me. just some Logos are not synced (actually they did sync but it will not be displayed). I tried to resync that specific item over the 'c' option button in kodi but still nothing. May be it is a sort of caching issue. Just let's wait for 24h and see what happens.

 

With this method it took me 20 seconds on each db to extract the watched flag with pathname (kodi) and UserDataKeyId and pathname. Then using Excel to sync them row on row (I already had a similar need in the past and as the sources are the same and sorted alphabetically) another 5 - 10 minutes. After that put the INSERT / UPDATE (already in place from the old need mentioned) for new items or updating existing records (just copy & paste) and ran on the emby db about 1 minute long. I did not truncate local db on kodi, just resync over night and voilà.

 

May be with the use of trakt it would be faster and less complicated, but I generally do not trust online services. I am more the 'on premise' guy. To setup trakt just for this was a overkill to me. When I have internet downtime then I still want to watch tv. Online world is ok and when I am on the way or at the office is streaming (netflix, amazon and other on demand services ... and of course emby :)) just fine.

 

Best regards

Bite

Link to comment
Share on other sites

BiTeTHeBiGG

Thank you TeamB,

 

I do not have python on my own (yes, I am one of those (old) php script kiddies  :) ). I used in the past python to fix a kodi addon but this was about six years ago the last (and first) time.

I converted the scripts to php and had problems with the response list as some parameters are not available in movies and tvshows (at least not for all records). Also php need more headers to work well and with gziped results.

I was able to backup my library with 51844 items in about 29 seconds. 30 seconds is the default php timeout :ph34r: and had to hassle with some other default limitations because of volume of data  :D .

 

If someone is interested for the php files I will post them here as soon as I'm done with the recovery scripts and they really works.

At the moment just emby_client.php and backup.php are done.

 

Next step then will be to try to reformat (or optionally extend as a backup is always welcome) the output schema, so I can use that stream and the export from kodi to compare and then write back to emby (or if needed to kodi)  B) .

 

Best regards

Bite

Edited by BiTeTHeBiGG
Link to comment
Share on other sites

BiTeTHeBiGG

Hi, with the scripts  I have now a equal formated export of both db, emby and kodi (with emby for kodi).

I'm missing 72 items out of 51844.

How can i debug this without messing up my emby db to understand why it is not replicated over to kodis db?

As far as I understand for each item in the emby db there should be a replica to kodi with the direct link (native mode), right?

 

Thanks for any advise

Bite

 

EDIT: OK, it seems that on shows when either season and episode number are not available (custom file without numbering) then it will not be synced, This is not fine with my structure, so I have to work around this. Actually only for 72 items so it is not that tragic. Have to check further if it matches with this assumption.  :huh: Assumption is wrong. One file without season and episode number and synced. There are two other files named 00_2.mp4 and 00_3.mp4. Those are not synced and I dont get it. But it seems I discovered some behaviours (or may be bugs) in emby as there is another file named 99.mp4 (still same show as above). I can not find it when I'm browsing the show itself but I can find it using the search function and the season is "Season unknow". This is also not synced. And finally another file not even in the emby db.

 

EDIT2: Also it seems that the API will not export all episodes from the emby db. I have four versions for one episode and the export contains only one file, one version and synced will be another one. Can someone help me to get a whole export over the API? When I give a search term then I also get only one version.

Edited by BiTeTHeBiGG
Link to comment
Share on other sites

Hi, the reason you only get one from the group is because you would only see one in the user interface. The others are part of the mediasource list for the item.

Link to comment
Share on other sites

BiTeTHeBiGG

ok, I can understand that, but how can I see that there are more in the list.? I don't see in the json response a hint for that.

Is it possible to get those informations over the api?

Edited by BiTeTHeBiGG
Link to comment
Share on other sites

BiTeTHeBiGG

No. As not all records are exported, I will miss them in wmby for kodi.

I'm only using the API for an export, but at the moment the only way I see for an export is to shut down emby server and copy over the db and then export via SQL.

My main target is to compare the kodi with MySQL and emby so they are inline and then to use emby as server in the future and kodi with the help of the emby for kodi addon.

 

May be what I'm finding out here is usefull for further developing or enhancement of emby for kodi. But no, I'm not a developer of emby for kodi, just a developer in other things.

May I ask you why you are asking me?

Link to comment
Share on other sites

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