Plex: Fix guids error on mark
parent
218037200c
commit
b960bccb86
46
src/plex.py
46
src/plex.py
|
|
@ -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,24 +223,30 @@ def update_user_watched(user, user_plex, library, videos, dryrun):
|
||||||
break
|
break
|
||||||
|
|
||||||
if not episode_found:
|
if not episode_found:
|
||||||
for episode_guid in episode_search.guids:
|
try:
|
||||||
episode_guid_source = (
|
for episode_guid in episode_search.guids:
|
||||||
re.search(r"(.*)://", episode_guid.id)
|
episode_guid_source = (
|
||||||
.group(1)
|
re.search(r"(.*)://", episode_guid.id)
|
||||||
.lower()
|
.group(1)
|
||||||
)
|
.lower()
|
||||||
episode_guid_id = re.search(
|
)
|
||||||
r"://(.*)", episode_guid.id
|
episode_guid_id = re.search(
|
||||||
).group(1)
|
r"://(.*)", episode_guid.id
|
||||||
|
).group(1)
|
||||||
|
|
||||||
# If episode provider source and episode provider id are in videos_episodes_ids exactly, then the episode is in the list
|
# If episode provider source and episode provider id are in videos_episodes_ids exactly, then the episode is in the list
|
||||||
if episode_guid_source in videos_episodes_ids.keys():
|
if episode_guid_source in videos_episodes_ids.keys():
|
||||||
if (
|
if (
|
||||||
episode_guid_id
|
episode_guid_id
|
||||||
in videos_episodes_ids[episode_guid_source]
|
in videos_episodes_ids[episode_guid_source]
|
||||||
):
|
):
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue