elgatito / plugin.video.elementum

Elementum add-on for Kodi. Development of this addon has been stopped!
http://elementum.surge.sh
MIT License
484 stars 159 forks source link

[Bug] Trakt lists isn't synced with their "watched" status #694

Closed burekas7 closed 10 months ago

burekas7 commented 3 years ago

Go to one of the Trakt lists, Movies or TV shows ("My Collection" for example)

The content there isn't synced with the "watched" status from Trakt. They are all shown as unwatched except few.

It was ok in 0.1.67 Clear Trakt cache didn't help here.

Kodi debug log: https://paste.ubuntu.com/p/vNnPDpbvQg/


Elementum 0.1.68 Kodi 17.6 Win10

burekas7 commented 3 years ago

EDIT: It seems that it's ok now. Maybe there was a temporary problem with Trakt server or Elementum has a delay with the sync progress, or even my local network. I don't know.

What makes me confuse it that Trakt lists still show their content from ELementum local db I guess. It relates by the way to this issue I opened: https://github.com/elgatito/plugin.video.elementum/issues/680

burekas7 commented 3 years ago

@elgatito Edit 2: It seems that something isn't stable with the sync of the 'watched' status. So take a look of the log and tell me if you see anything there.

Thanks.

elgatito commented 3 years ago

There were no changes with Trakt in latest versions.

burekas7 commented 3 years ago

@elgatito

I found the problem, I changed this setting of "library_update_delay" to high value, because I don't use it as a library right now. But it seems that it has an impact on the 'watched' status sync with Trakt even inside the addon itself.

By the way, the minimum for this setting is 10, can it be set also to be zero? (Which means immediately when Elementum start)

antonsoroko commented 3 years ago

@burekas7 as i can see in the code sync with trakt is done: 1) on plugin start, after library_update_delay (in order not to stress system much right after kodi start) seconds (default=300). so 10 seconds delay seems to be ok i think.

2) in a background, every trakt_sync_frequency_min minutes (default=5). It gets last activities (see https://trakt.docs.apiary.io/#reference/sync/last-activities/get-last-activity) from trakt and update things correspondingly. maybe you set this value to some big value. or there were some trakt server issues.

it works fine for me, but sure, it can be improved by also checking if list was updated right before we render list (currently, as i mentioned, check is done only in a backgrounds with interval).

burekas7 commented 3 years ago

@elgatito

Regarding version 0.1.76 It seems there is a problem with the sync of Trakt -> Movies Collection. Some movies that have been watched recently are still marked as unwatached in Elementum. Even after using the "Clear Trakt cache".

Here one of them: (You can see that it marked as watched in Trakt but not in Elementum) image image

Do you need any log here?

antonsoroko commented 3 years ago

probably unconnected to this issue but just curious was it watched via elementum? what is value for Percents of playback to mark as watched option?

burekas7 commented 3 years ago

@antonsoroko No, It seems that if you update Trakt from other source or addon Elementum doesn't know about it (In this case I toggle watched by using the Trakt Context menu and as I show in Trakt it does marked as watched), So this is what I mentioned in my last comment here, it seems that Elementum doesn't sync the watched status of Trakt Movies Collection (Maybe also with other lists such as TV Shows but I didn't check it yet)

antonsoroko commented 3 years ago

@burekas7

i do not use collections but i just checked how it works and it works fine for me:

  1. i added a 1st movie
  2. restarted kodi, opened my collection - 1st movie is there and marked as unwatched
  3. i marked 1st movie as watched in trakt
  4. waited 5m (update interval in settings) - 1st is there and marked as watched
  5. i added new movie, waited 5m (update interval in settings) - 2nd movie is there and marked as unwatched
  6. i marked 2nd movie as watched in trakt
  7. waited 5m (update interval in settings) - 2nd is there and marked as watched (with 1st movie of course)
  8. i marked 2nd movie as unwatched in trakt
  9. waited 5m (update interval in settings) - 2nd is there and marked as unwatched

in log file you should see the following:

  1. when you add movie

    2021-05-19 14:30:20.391 T:1276950 WARNING <general>: [plugin.video.elementum] INFO  library      ▶ RefreshTrakt     Running Trakt sync
    2021-05-19 14:30:22.552 T:1276950 WARNING <general>: [plugin.video.elementum] NOTI  library      ▶ SyncMoviesList   Movies list (collection) added
    2021-05-19 14:30:22.568 T:1276950 WARNING <general>: [plugin.video.elementum] DEBU  library      ▶ func1            Trakt sync movies collection finished in 1.470575041s

    this is triggered by movies.collected_at field from https://trakt.docs.apiary.io/#reference/sync/last-activities/get-last-activity

  2. when you mark movie as watched/unwatched

2021-05-19 14:35:20.392 T:1276950 WARNING <general>: [plugin.video.elementum] INFO  library      ▶ RefreshTrakt     Running Trakt sync
2021-05-19 14:35:22.061 T:1276950 WARNING <general>: [plugin.video.elementum] DEBU  library      ▶ func1            Trakt sync watched for '0' finished in 989.959206ms

(0 is type for movie)

this is triggered by movies.watched_at field from https://trakt.docs.apiary.io/#reference/sync/last-activities/get-last-activity

could you please do the same steps as i did and check your log for the messages i posted above?

also, do you have anything not standard about your collection?


also when you do "Clear Trakt cache" it definitely should get the new info from scratch.


there is a chance that you hit some rare situation that leads to failure of sync, but i am afraid current logging is not able to show the reason (if there is a reason).

could you please try to check your use case on some fresh environment (e.g. fresh kodi and elementum)? if it still reproduces, then we can try add some additional logging and give you a debug build of elementum to collect extra info/logs.

burekas7 commented 3 years ago

@antonsoroko

Where did you add and mark as watched, inside the addon or in the Trakt site? I marked and rated in other machine (Android box) and as you can see it set it ok in Trakt site. But in my other maching (Laptop) the addon doesn't sync the correct wathced status from Trakt. Also after the "Clear Trakt cache" and I tried also "Update Trakt" from Trakt tab.

antonsoroko commented 3 years ago

@burekas7

i marked 1st movie as watched in trakt

here and after i meant website.

antonsoroko commented 3 years ago

@burekas7

1.

could you please do the same steps as i did and check your log for the messages i posted above?

do this on your laptop plz. maybe kodi/elementum there is broken somehow.

2.

also, do you have anything not standard about your collection?

apart from "rated" which should not affect synchronization.

3.

could you please try to check your use case on some fresh environment (e.g. fresh kodi and elementum)?

burekas7 commented 3 years ago

In the past I had similar issue with TV Shows that @elgatito fixed.

But I will try.

antonsoroko commented 3 years ago

i mean, generally speaking, without reproducible steps nobody will be able to fix issue (if issue exists). i was not able to reproduce the issue you described, for example.

i also have dev PC with linux and android tv box. both of them received changes from trakt website.

antonsoroko commented 3 years ago

@burekas7 any update?

burekas7 commented 3 years ago

@antonsoroko I haven't tested it yet with a different setup, but with the last realease 0.1.78 it's the same. Watched statuses aren't sync with their status in Trakt site (For those that was marked manually and in a another machine)

These are the only lines I found in the log after "Clear Trakt cache" and go into Trakt->My Collection (Movies)

00:18:48.968 T:2828   DEBUG: CGUIMediaWindow::GetDirectory (plugin://plugin.video.elementum/movies/trakt/collection)
00:18:48.968 T:2828   DEBUG:   ParentPath = [plugin://plugin.video.elementum/movies/]
00:18:48.982 T:21104   DEBUG: CAddonDatabase::SetLastUsed[plugin.video.elementum] took 15 ms
00:18:48.983 T:27644   DEBUG: XFILE::CPluginDirectory::StartScript - calling plugin Elementum('plugin://plugin.video.elementum/movies/trakt/collection','20','')
00:18:48.985 T:21076   DEBUG: Thread LanguageInvoker start, auto delete: false
00:18:48.986 T:21076    INFO: initializing python engine.
00:18:48.986 T:21076   DEBUG: CPythonInvoker(55, C:\Users\aUser\AppData\Roaming\Kodi\addons\plugin.video.elementum\navigation.py): start processing
00:18:49.110 T:21076   DEBUG: -->Python Interpreter Initialized<--
00:18:49.110 T:21076   DEBUG: CPythonInvoker(55, C:\Users\aUser\AppData\Roaming\Kodi\addons\plugin.video.elementum\navigation.py): the source file to load is "C:\Users\aUser\AppData\Roaming\Kodi\addons\plugin.video.elementum\navigation.py"
00:18:49.111 T:21076   DEBUG: CPythonInvoker(55, C:\Users\aUser\AppData\Roaming\Kodi\addons\plugin.video.elementum\navigation.py): setting the Python path to C:\Users\aUser\AppData\Roaming\Kodi\addons\plugin.video.elementum;C:\Users\aUser\AppData\Roaming\Kodi\addons\script.module.kodi-six\libs;C:\Program Files (x86)\Kodi\system\python\DLLs;C:\Program Files (x86)\Kodi\system\python\Lib;C:\Program Files (x86)\Kodi\python27.zip;C:\Program Files (x86)\Kodi\system\python\lib\plat-win;C:\Program Files (x86)\Kodi\system\python\lib\lib-tk;C:\Program Files (x86)\Kodi;C:\Program Files (x86)\Kodi\system\python;C:\Program Files (x86)\Kodi\system\python\lib\site-packages
00:18:49.111 T:21076   DEBUG: CPythonInvoker(55, C:\Users\aUser\AppData\Roaming\Kodi\addons\plugin.video.elementum\navigation.py): entering source directory C:\Users\aUser\AppData\Roaming\Kodi\addons\plugin.video.elementum
00:18:49.112 T:21076   DEBUG: CPythonInvoker(55, C:\Users\aUser\AppData\Roaming\Kodi\addons\plugin.video.elementum\navigation.py): instantiating addon using automatically obtained id of "plugin.video.elementum" dependent on version 0.0.0 of the xbmc.python api
00:18:49.470 T:2828   DEBUG: ------ Window Init (DialogBusy.xml) ------
00:18:49.864 T:21076   DEBUG: [plugin.video.elementum] Requesting http://127.0.0.1:65220/movies/trakt/collection from ['plugin://plugin.video.elementum/movies/trakt/collection', '20', '']
00:18:53.994 T:2828   DEBUG: ------ Window Deinit (Pointer.xml) ------
00:19:01.313 T:7320  NOTICE: [plugin.video.elementum] [GIN] 2021/06/06 - 00:19:01 | 200 |   11.4012208s |       127.0.0.1 | GET      "/movies/trakt/collection"
00:19:02.293 T:21076    INFO: CPythonInvoker(55, C:\Users\aUser\AppData\Roaming\Kodi\addons\plugin.video.elementum\navigation.py): script successfully run
00:19:02.348 T:2828   DEBUG: Saving fileitems [plugin://plugin.video.elementum/movies/trakt/collection]
00:19:02.356 T:2828   DEBUG:   -- items: 167, sort method: 0, ascending: false
00:19:02.384 T:2828   DEBUG: CVideoDatabase::RunQuery took 8 ms for 212 items query: SELECT  files.strFilename, files.playCount,  bookmark.timeInSeconds, bookmark.totalTimeInSeconds FROM files  LEFT JOIN bookmark ON    files.idFile = bookmark.idFile AND bookmark.type = 1  WHERE files.idPath=1539
00:19:02.454 T:28428   DEBUG: Thread BackgroundLoader start, auto delete: false
00:19:02.528 T:21076    INFO: Python script stopped
00:19:02.528 T:21076   DEBUG: Thread LanguageInvoker 21076 terminating
antonsoroko commented 3 years ago

unfortunately this info does not give anything for debug purposes.

so we will wait for answers for questions described here https://github.com/elgatito/plugin.video.elementum/issues/694#issuecomment-846629702

btw, for future - do you have "debug" log level in elementum settings as well? (last tab)

antonsoroko commented 3 years ago

@burekas7 i have a good guess - i can see in your log file that you have not enabled LibrarySyncEnabled and LibrarySyncPlaybackEnabled. enable them and try again plz. you don't need to set up library in kodi, just enable these option in elementum:

"Enable Kodi library synchronization" "Enable synchronization while playback"


w/o them many features, like "start playback N seconds earlier" will not work, and others.

antonsoroko commented 3 years ago

@burekas7 did it help?

burekas7 commented 3 years ago

@antonsoroko Still the same. Maybe something else is making the sync to be failed or something.

Btw I mention the Movies Collection but maybe it happens also with the TV Shows Colleciton.

antonsoroko commented 3 years ago

I can't imagine why it happens. It works for me. I still suggest to try with clean environment - it might give us some new insights about this issue.