luigi311 / JellyPlex-Watched

Sync watched between jellyfin and plex locally
GNU General Public License v3.0
398 stars 22 forks source link

TV Shows not syncing to jellyfin #24

Closed VossenTech closed 2 years ago

VossenTech commented 2 years ago

Running in docker trying to sync plex watched to jellyfin, I was able to successfully sync my movies, movies 4k, and tv shows 4k libraries but my main tv shows library doesn't seem to work. There is no errors logged with debug enabled. It shows the list of changes and says its syncing to jellyfin but nothing seems to happen on the jellyfin side and it immediately goes to looping. Watched status is successfully synced from jellyfin to plex.

I've attached a log from a run with a test user

log.log

luigi311 commented 2 years ago

Can you try setting DEBUG_LEVEL = "debug" it will increase the amount in the log and it will tell you if something gets skipped when trying to mark the show in jellyfin as marked.

VossenTech commented 2 years ago

That log is already with the debug logging on unfortunately.

Additional logging information

DEBUG = "True"

Debugging level, "info" is default, "debug" is more verbose

DEBUG_LEVEL = "debug"

However I may have solved it. I noticed some match differences between plex and jellyfin so I went though and cleaned them up so everything matched. None of the mis-matches were watched for either account I have been testing with. After that I tried to sync again and my test user was then able to update all the watched items in jellyfin. I enabled my main user again and its currently running but has not finished yet. I will update you to let you know if it works or not.

VossenTech commented 2 years ago

Well that defiantly solved my initial issue. I was able to get successfully sync about half and then ran into this error:

--Start of error ERROR: Jellyfin: Error updating watched for user2 in library TV Shows ERROR: Jellyfin: Error updating watched

ERROR: Traceback (most recent call last): File "/app/src/jellyfin.py", line 248, in update_user_watched msg = f"{jellyfin_episode['SeriesName']} {jellyfin_episode['SeasonName']} Episode {jellyfin_episode['IndexNumber']} {jellyfin_episode['Name']} as watched for {user} in {library} for Jellyfin" KeyError: 'IndexNumber'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/app/src/functions.py", line 145, in future_thread_executor result = future.result() File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 446, in result return self.get_result() File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 391, in get_result raise self._exception File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/app/src/jellyfin.py", line 257, in update_user_watched raise Exception(e) Exception: 'IndexNumber'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/app/src/jellyfin.py", line 316, in update_watched future_thread_executor(args) File "/app/src/functions.py", line 148, in future_thread_executor raise Exception(e) Exception: 'IndexNumber'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/app/src/functions.py", line 145, in future_thread_executor result = future.result() File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 446, in result return self.get_result() File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 391, in get_result raise self._exception File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/app/src/jellyfin.py", line 319, in update_watched raise Exception(e) Exception: 'IndexNumber'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/app/src/main.py", line 424, in main main_loop() File "/app/src/main.py", line 417, in main_loop future_thread_executor(args) File "/app/src/functions.py", line 148, in future_thread_executor raise Exception(e) Exception: 'IndexNumber' --End of error

Which was caused by having watched episodes with the following daily episode naming convention: TVShows/Show Name/Season 2021/Show Name - 2021-01-11 - Show Title [HDTV-720p-2.0].mkv

After renaming those using for example S2021E02 instead of 2021-01-11 they worked fine and I was able to successfully sync.

As a side note it would be really nice if you could add time stamps to log entries and the ability to save x number of previous run logs. With just two users and two servers a sync takes over an hour so I am imagining when I get all of my users and up to six servers during the transition from plex to jellyfin each sync may take 10+ hours. Having to be available between when it completes/errors out and the next scheduled run if you want to see a log is a little rough.