Jump to content


Photo

Emby for Kodi failed to sync


  • This topic is locked This topic is locked
23 replies to this topic

#1 BiTeTHeBiGG OFFLINE  

BiTeTHeBiGG

    Advanced Member

  • Members
  • 36 posts
  • Local time: 09:23 PM

Posted 22 February 2020 - 10:36 AM

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, 22 February 2020 - 10:38 AM.


#2 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 156881 posts
  • Local time: 03:23 PM

Posted 22 February 2020 - 10:40 PM

Please please attach the kodi log. Also what version of Kodi and what version of the addon?



#3 BiTeTHeBiGG OFFLINE  

BiTeTHeBiGG

    Advanced Member

  • Members
  • 36 posts
  • Local time: 09:23 PM

Posted 23 February 2020 - 08:31 AM

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

Attached Files


Edited by BiTeTHeBiGG, 23 February 2020 - 08:50 AM.


#4 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 156881 posts
  • Local time: 03:23 PM

Posted 23 February 2020 - 03:31 PM

 

 

Is there a possibility to easy migrate the watched status to Emby? 

What about with trakt?



#5 BiTeTHeBiGG OFFLINE  

BiTeTHeBiGG

    Advanced Member

  • Members
  • 36 posts
  • Local time: 09:23 PM

Posted 23 February 2020 - 10:12 PM

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, 23 February 2020 - 10:14 PM.


#6 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 156881 posts
  • Local time: 03:23 PM

Posted 23 February 2020 - 11:20 PM

Why not just manually toggle it in Kodi? I bet that will do it.



#7 BiTeTHeBiGG OFFLINE  

BiTeTHeBiGG

    Advanced Member

  • Members
  • 36 posts
  • Local time: 09:23 PM

Posted 24 February 2020 - 03:11 AM

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.



#8 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 156881 posts
  • Local time: 03:23 PM

Posted 24 February 2020 - 01:25 PM

Let us know how you get on. Thanks.



#9 BiTeTHeBiGG OFFLINE  

BiTeTHeBiGG

    Advanced Member

  • Members
  • 36 posts
  • Local time: 09:23 PM

Posted 24 February 2020 - 01:29 PM

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, 24 February 2020 - 01:30 PM.


#10 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 156881 posts
  • Local time: 03:23 PM

Posted 24 February 2020 - 01:32 PM

Why do you need direct db access?



#11 BiTeTHeBiGG OFFLINE  

BiTeTHeBiGG

    Advanced Member

  • Members
  • 36 posts
  • Local time: 09:23 PM

Posted 24 February 2020 - 02:01 PM

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.



#12 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 156881 posts
  • Local time: 03:23 PM

Posted 24 February 2020 - 02:04 PM

Yea we don't currently have any documentation around this, although creating that is a possibility.



#13 BiTeTHeBiGG OFFLINE  

BiTeTHeBiGG

    Advanced Member

  • Members
  • 36 posts
  • Local time: 09:23 PM

Posted 24 February 2020 - 02:09 PM

can you please tell me about the key field so I will not mess up something?



#14 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 156881 posts
  • Local time: 03:23 PM

Posted 24 February 2020 - 10:52 PM

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.

#15 BiTeTHeBiGG OFFLINE  

BiTeTHeBiGG

    Advanced Member

  • Members
  • 36 posts
  • Local time: 09:23 PM

Posted 25 February 2020 - 05:30 AM

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, 25 February 2020 - 05:48 AM.


#16 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 156881 posts
  • Local time: 03:23 PM

Posted 25 February 2020 - 11:42 AM

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

#17 BiTeTHeBiGG OFFLINE  

BiTeTHeBiGG

    Advanced Member

  • Members
  • 36 posts
  • Local time: 09:23 PM

Posted 25 February 2020 - 08:12 PM

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



#18 TeamB OFFLINE  

TeamB

    Advanced Member

  • Developers
  • 465 posts
  • Local time: 05:23 AM

Posted 25 February 2020 - 08:38 PM

You could try some python using the Emby API to set watched status:
 
https://github.com/faush01/EmbyToolbox
 
have a look at the WatchedStatusBackup in the above repo.



#19 BiTeTHeBiGG OFFLINE  

BiTeTHeBiGG

    Advanced Member

  • Members
  • 36 posts
  • Local time: 09:23 PM

Posted 28 February 2020 - 08:35 AM

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, 28 February 2020 - 08:37 AM.


#20 BiTeTHeBiGG OFFLINE  

BiTeTHeBiGG

    Advanced Member

  • Members
  • 36 posts
  • Local time: 09:23 PM

Posted 01 March 2020 - 05:28 PM

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, 01 March 2020 - 10:22 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users