Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Only syncing to jellyfin and not to plex #108

Open
1 of 2 tasks
joshoram80 opened this issue Sep 27, 2023 · 26 comments
Open
1 of 2 tasks

[BUG] Only syncing to jellyfin and not to plex #108

joshoram80 opened this issue Sep 27, 2023 · 26 comments

Comments

@joshoram80
Copy link

joshoram80 commented Sep 27, 2023

Describe the bug
Syncing Plex -> Jellyfin works but not Jellyfin -> Plex

To Reproduce
Steps to reproduce the behavior:

  1. SYNC_FROM_PLEX_TO_JELLYFIN=True
    SYNC_FROM_JELLYFIN_TO_PLEX=True
  2. Run docker container and monitor logs

Expected behavior
Plex Syncs to Jellyfin and vice versa

Logs
If marked as watched in Plex

Marked Black Mirror Season 1 Episode 2 Fifteen Million Merits as watched for xxxx in Shows for Jellyfin
Marked Black Mirror Season 1 Episode 3 The Entire History of You as watched for xxxx in Shows for Jellyfin
Marked Black Mirror Season 2 Episode 1 Be Right Back as watched for xxxx in Shows for Jellyfin
Marked Black Mirror Season 2 Episode 2 White Bear as watched for xxxx in Shows for Jellyfin
Marked Black Mirror Season 2 Episode 3 The Waldo Moment as watched for xxxx in Shows for Jellyfin

If marked in Jellyfin first
[DEBUG]: Plex: Skipping show Black Mirror as it is not in mark list for xxx
Type:

  • Docker
  • Native

Additional context
Using :latest tag

@nebb00
Copy link

nebb00 commented Sep 28, 2023

Probably the same as #107

@luigi311
Copy link
Owner

Looks like plex had a api change and the python plex library was updated to resolve it. Can you guys try the dev branch

@joshoram80
Copy link
Author

No change for me using dev branch. Plex -> JF sync still working but not the other way around.

@joshoram80
Copy link
Author

Is this still being looked at? I'm still having issues no matter what I try. Jellyfin will update Plex status, but not the other way around.

@luigi311 luigi311 changed the title [BUG] [BUG] Only syncing to jellyfin and not to plex Nov 13, 2023
@luigi311
Copy link
Owner

Jellyfin will update Plex status, but not the other way around.

Do you mean the other way Plex will update Jellyfin but Jellyfin will not update Plex? That seems like what you described in the initial ticket.

Either way i dont seem to be running into this issue and im not sure what is causing it to happen on your side. I see you said you were using the latest tag, can you try the dev tag? I added in a [MARK] and [DRYRUN] that you can search in the log file and see if you are still having issues.

@joshoram80
Copy link
Author

Yes sorry, Plex will update Jellyfin but not the other way around. I can't see any errors in the log, but it says that every single show is not in the mark list for Plex

[DEBUG]: Plex: Skipping show Bargain as it is not in mark list for Stuntman

As a test I just marked this as watched in Jellyfin and it didn't mark in Plex. That's literally the only thing I can see in the logs. There doesn't seem to any errors. I can mark the exact same show in Plex and it updates Jelly correctly.

@luigi311
Copy link
Owner

Can you attach the full log file or email it to me at [email protected] if you dont feel comfortable posting it publicly. Can also add your env file/docker command without your url or token.

@joshoram80
Copy link
Author

Emailed logs and compose

@ikolsteren
Copy link

I am seeing the same - Plex updates Jellyfin but not back. Been using Jellyfin more now

@luigi311
Copy link
Owner

Looks like someone was able to potentially identify the issue, can you guys check the dev tag and see if that fixes the issue for you guys.

@joshoram80
Copy link
Author

Doesn't seem to change anything.

Results None
Session is closed
[ERROR]: Jellyfin: Query get /Shows/be44016e225b1da7b186c3f3051241f0/Episodes?seasonId=7a6ee8dd2a1ef00aa34de471f73a9826&userId=9db32164d51b48ea9d40eb99d1a42ac0&isPlaceHolder=false&Filters=IsPlayed&Fields=ProviderIds,MediaSources
Results None
Session is closed
[ERROR]: Jellyfin: Query get /Shows/be44016e225b1da7b186c3f3051241f0/Episodes?seasonId=7a6ee8dd2a1ef00aa34de471f73a9826&userId=9db32164d51b48ea9d40eb99d1a42ac0&isPlaceHolder=false&Filters=IsResumable&Fields=ProviderIds,MediaSources
Results None
Session is closed
[ERROR]: Jellyfin: Query get /Shows/bd82d0b59e61db87131f2a0c202d7f11/Episodes?seasonId=e8862be8eef4e2453f58c74110834b75&userId=9db32164d51b48ea9d40eb99d1a42ac0&isPlaceHolder=false&Filters=IsPlayed&Fields=ProviderIds,MediaSources
Results None
Session is closed
[ERROR]: Jellyfin: Query get /Shows/bd82d0b59e61db87131f2a0c202d7f11/Episodes?seasonId=e8862be8eef4e2453f58c74110834b75&userId=9db32164d51b48ea9d40eb99d1a42ac0&isPlaceHolder=false&Filters=IsResumable&Fields=ProviderIds,MediaSources
Results None
[ERROR]: Traceback (most recent call last):
  File "/app/src/jellyfin.py", line 334, in get_user_library_watched
    season_identifiers["season_index"] = season[
                                         ^^^^^^^
KeyError: 'IndexNumber'
    raise RuntimeError("Session is closed")
    raise RuntimeError("Session is closed")
    async with session.get(
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1187, in __aenter__
    self._resp = await self._coro

I have a lot of those errors now that I haven't seen before

There's a lot of

[MARK]: Jellyfin: Breaking Bad Season 3 Episode 10 Fly as watched for XXXX in TV
[MARK]: Jellyfin: Breaking Bad Season 3 Episode 11 Abiquiu as watched for XXXX in TV
[MARK]: Jellyfin: Breaking Bad Season 3 Episode 12 Half Measures as watched for XXXX in TV
[MARK]: Jellyfin: Breaking Bad Season 3 Episode 13 Full Measure as watched for XXXX in TV
[MARK]: Jellyfin: Breaking Bad Season 4 Episode 1 Box Cutter as watched for XXXX in TV

but I can't see a single [MARK] for Plex. As a Test I marked Ahsoka in Jellyfin as watched, but in the log

[DEBUG]: Plex: Skipping show Ahsoka as it is not in mark list for XXXXX

It is skipped

@Mossrat
Copy link

Mossrat commented Jan 15, 2024

My instance exhibits the same symptoms as joshoram80 notes above with identical debug logs aside from show name of course. Also using dev branch. Plex to Jellyfin perfect. Jellyfin back to Plex not syncing. Appreciate all the efforts to date.

@luigi311
Copy link
Owner

Looks like your issue is something else, it looks like jellyfin is failing to return some objects so your jellyfin list is coming up empty so its marking everything you have on the plex side to jellyfin but theres nothing to mark from jellyfin to plex since its empty.

@joshoram80
Copy link
Author

This has only happened since using the :dev image. I never saw those errors before that, it just wouldn't mark anything in Plex

@ikolsteren
Copy link

I am still working through my logs
I do see [INFO]: Plex: Failed to get any guids for XXXXXX on a lot of items
Wondering if it how my metadata is on the Plex side?
Currently running the Dev version
I seems to run through the Plex, then Jellyfin but I don't see a Jellyfin to Plex step

@luigi311
Copy link
Owner

luigi311 commented Jan 16, 2024

Can you guys try the "fixes" branch and see if that fixes your issues :fixes image

@joshoram80
Copy link
Author

The only Plex activity I can see in the logs is

[INFO]: Plex: Failed to get any guids for The Seven Deadly Sins[INFO]: Plex: Failed to get any guids for Mash Burnedead and the Baleful Bully[INFO]: Plex: Failed to get any guids for The Seven Deadly Sins
[INFO]: Plex: Failed to get any guids for Mash Burnedead and the Unpopular Classmate
[INFO]: Plex: Failed to get any guids for Mash Burnedead and the Accelerated Battery

but there is 1000s of

[MARK]: Jellyfin:

And I'm pretty sure they were already marked as Watched in Jellyfin anyway. Every time I run the script, It literally tries to mark my entire collection in Jellyfin every time, over and over again, regardless of it it's already marked or not, but it doesn't touch anything in Plex.

@luigi311
Copy link
Owner

luigi311 commented Jan 16, 2024

can you email me your compose and logs again at [email protected] I should have time to go through it this time. For some reason it sounds like your jellyfin still isnt generating anything so it things its empty so it marks everything from your plex side to it.

@Mossrat
Copy link

Mossrat commented Jan 16, 2024

I can confirm 'Movie' watch states are now syncing from Jellyfin to Plex and note the mark flag for Plex in the Debug logs for Movies.

TV Show watch states remain not syncing. Something amiss there maybe, @joshoram80 potentially try a movie watch state update from Jellyfin to Plex. Library mappings appear right for me.

I note in the logs when gathering Show watch states from Jellyfin there's a final entry as below, might be something or nothing:

[ERROR]: Jellyfin: Failed to get watched for username in library Shows, Error: 'IndexNumber'
[ERROR]: Traceback (most recent call last):
File "/app/src/jellyfin.py", line 314, in get_user_library_watched
season_identifiers["season_index"] = season["IndexNumber"]

@luigi311
Copy link
Owner

Thats interesting that you are gettinig an error on IndexNumber, that would mean that one of your seasons in your show does not have a season number associated with it which is odd. Does it show you what the name of the show is? If so can you attach a screenshot of what it looks like in jellyfin, thats not something ive encountered. That would probably explain why then since its failing and causing that library to return nothing

@luigi311
Copy link
Owner

@Mossrat I added in a check for IndexNumber to skip the season if it doesnt exist for some reason, can you give that :fixes image a try again and see if that works, it should also output "Skipping show {show name} season {season name} as it has no index number" so you should be able to check to see what show is causing issues in your library and it should hopefully not fail. I wasnt able to test it though since i dont have that issue.

@Mossrat
Copy link

Mossrat commented Jan 16, 2024

@luigi311 - cracked it for me sir. Many thanks.
Jellyfin Shows watch states now syncing to Plex TV Shows.
Identified a season folder anamoly on your advice above.
A movie had found its way into the TV show folder structure creating an unexpected folder.

@luigi311
Copy link
Owner

@joshoram80 Looks like you have the exact same issue ethat @Mossrat did
[ERROR]: Jellyfin: Failed to get watched for josh in library TV, Error: 'IndexNumber'
[ERROR]: Traceback (most recent call last):
File "/app/src/jellyfin.py", line 314, in get_user_library_watched
season_identifiers["season_index"] = season["IndexNumber"]
~~~~~~^^^^^^^^^^^^^^^
KeyError: 'IndexNumber'

Can you do another pull on :fixes and see if that fixes it for you

@cvzero89
Copy link

Hey there. This feels like the same thing, although I am not 100% it is.

[DEBUG]: Removing 1 from Modern Family because it is empty
[DEBUG]: Removing Modern Family because it is empty
[ERROR]: 'season'
[ERROR]: Traceback (most recent call last):
  File "/app/src/main.py", line 394, in main
    main_loop()
  File "/app/src/main.py", line 355, in main_loop
    server_2_watched_filtered = cleanup_watched(
                                ^^^^^^^^^^^^^^^^
  File "/app/src/watched.py", line 129, in cleanup_watched
    filter_episode_watched_list_2_keys_dict(
  File "/app/src/watched.py", line 243, in filter_episode_watched_list_2_keys_dict
    episode_watched_list_2_keys_dict["season"]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'season'
Retrying in 600.0

Move from Plex to Jellyfin worked great. Now I had to re-install Plex so I was syncing back only using Jellyfin to Plex, I am on the latest image. Checked for anything out of the ordinary on my libraries but everything has a season and are properly identified.

@luigi311
Copy link
Owner

I added a condition check in 84899ae to handle issues like that for you guys. Can you check the dev branch and see if that fixes the issue? The underlying issue with the library will still be there but it atleast wont error on mapping it over.

@cvzero89
Copy link

Magic! That worked like a charm, everything looks good now. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants