Plex: Fix guids error on mark

pull/44/head
Luigi311 2023-02-25 18:42:07 -07:00
parent 218037200c
commit b960bccb86
1 changed files with 26 additions and 20 deletions

View File

@ -1,4 +1,4 @@
import re, requests, os import re, requests, os, traceback
from urllib3.poolmanager import PoolManager from urllib3.poolmanager import PoolManager
from plexapi.server import PlexServer from plexapi.server import PlexServer
@ -52,7 +52,7 @@ def get_user_library_watched_show(show):
except: except:
logger( logger(
f"Plex: Failed to get guids for {episode.title} in {show.title}, Using location only", f"Plex: Failed to get guids for {episode.title} in {show.title}, Using location only",
4, 1,
) )
episode_guids_temp["locations"] = tuple( episode_guids_temp["locations"] = tuple(
@ -223,6 +223,7 @@ def update_user_watched(user, user_plex, library, videos, dryrun):
break break
if not episode_found: if not episode_found:
try:
for episode_guid in episode_search.guids: for episode_guid in episode_search.guids:
episode_guid_source = ( episode_guid_source = (
re.search(r"(.*)://", episode_guid.id) re.search(r"(.*)://", episode_guid.id)
@ -241,6 +242,11 @@ def update_user_watched(user, user_plex, library, videos, dryrun):
): ):
episode_found = True episode_found = True
break break
except Exception as e:
logger(
f"Plex: Failed to get episode guid for {episode_search.title}, Error: {e}",
1,
)
if episode_found: if episode_found:
msg = f"{show_search.title} {episode_search.title} as watched for {user.title} in {library} for Plex" msg = f"{show_search.title} {episode_search.title} as watched for {user.title} in {library} for Plex"
@ -271,7 +277,7 @@ def update_user_watched(user, user_plex, library, videos, dryrun):
f"Plex: Failed to update watched for {user.title} in library {library}, Error: {e}", f"Plex: Failed to update watched for {user.title} in library {library}, Error: {e}",
2, 2,
) )
raise Exception(e) logger(traceback.format_exc(), 2)
# class plex accept base url and token and username and password but default with none # class plex accept base url and token and username and password but default with none