luigi311 / JellyPlex-Watched

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

[BUG] Unable to run if WHITELIST_USERS not specified #53

Closed meestark closed 1 year ago

meestark commented 1 year ago

Describe the bug The process is unable to run if WHITELIST_USERS variable doesn't have anything in it

To Reproduce Steps to reproduce the behavior:

  1. Deploy docker with req'd env vars
  2. Do not provide the WHITELIST_USERS var

Expected behavior A clear and concise description of what you expected to happen.

Logs

[INFO]: Dryrun: False
[INFO]: Creating (black/white)lists
[INFO]: Blacklist Library: []
[INFO]: Blacklist Library Type: []
[INFO]: Blacklist Users: []
[INFO]: Whitelist Library: []
[INFO]: Whitelist Library Type: []
[INFO]: Whitelist Users: []
[INFO]: Creating server connections
[INFO]: Creating users list
[INFO]: User list that exist on both servers { <REMOVED> }
[INFO]: Filtered user list {<REMOVED>}
[INFO]: Server 1 users: [<REMOVED - but was many MyPlexUser: and a single MyPlexAccount: >]
[INFO]: Creating watched lists
[ERROR]: Plex: Failed to login, Error: No complete plex credentials provided
[ERROR]: Plex: Failed to get watched, Error: No complete plex credentials provided
[ERROR]: No complete plex credentials provided
[ERROR]: Traceback (most recent call last):
  File "/app/src/plex.py", line 269, in login
    raise Exception("No complete plex credentials provided")
Exception: No complete plex credentials provided
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/src/plex.py", line 310, in get_watched
    user_plex = self.login(
                ^^^^^^^^^^^
  File "/app/src/plex.py", line 278, in login
    raise Exception(e)
Exception: No complete plex credentials provided
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/src/main.py", line 373, in main
    main_loop()
  File "/app/src/main.py", line 306, in main_loop
    server_1_watched = get_server_watched(
                       ^^^^^^^^^^^^^^^^^^^
  File "/app/src/main.py", line 155, in get_server_watched
    return server_connection[1].get_watched(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/src/plex.py", line 348, in get_watched
    raise Exception(e)
Exception: No complete plex credentials provided
Retrying in 3600.0

Type:

Additional context Works perfectly fine if I provide users in the WHITELIST_USERS variable. I tried both my account in the WHITELIST_USERS, as well as just a user's account and there was no difference, successful run every time.

meestark commented 1 year ago

Hmm additional context - I provided the full list of users into the WHITELIST_USERS field and it also failed...

luigi311 commented 1 year ago

Looking at the logs it looks like its complaining about your Plex credentials. Are you syncing two Plex servers? Did you include the baseurl and token for both?

meestark commented 1 year ago

Yup, both servers baseURLs are provided as well as token (the token is the same for both servers as they're both from my Account, imagine Plex01 and Plex02)

eg. PLEX_BASEURL: "http://10.10.100.40:32407, http://10.10.100.40:32405" PLEX_TOKEN: "ababa, ababa"

As mentioned, with a smaller list of users, it seems to be fine. I'm suspecting one of the users, so going through and trying to identify which user and what's unique...

luigi311 commented 1 year ago

Hmm that's bizarre. The whitelist user variable shouldnt affect that login process that is failing. Let me take a look and get back to you.

meestark commented 1 year ago

Managed to narrow it down - had two users, 1 who had no shares to any server, and 1 who only had shares from 1 of the servers. With those added to BLACKLIST_USERS the rest run fine.

luigi311 commented 1 year ago

Interesting thank you very much for finding that. I'll see if I can do a check so it doesn't fail like this and will just skip the user.

luigi311 commented 1 year ago

Can you try the Dev branch, i think i got a fix implemented so it will skip over generating the watch list and marking watched for the user that has no access to libraries.

luigi311 commented 1 year ago

I believe this is solved now per my personal testing. I created a test user on both jellyfin and plex and in plex i did not provide the user any library access. In cases like this the user does not have a token for the server as such it was causing errors. This now skips the user for getting watched and marking. This does not seem to be an issue with jellyfin based on some quick testing but if something comes up on the jellyfin side we can create a new ticket for it.