Add more logging to debug
This commit is contained in:
@@ -104,6 +104,7 @@ class Jellyfin:
|
|||||||
and "MediaSources" in movie
|
and "MediaSources" in movie
|
||||||
and movie["MediaSources"] is not {}
|
and movie["MediaSources"] is not {}
|
||||||
):
|
):
|
||||||
|
logger(f"Jellyfin: Adding {movie['Name']} to {user_name} watched list", 3)
|
||||||
# Create a dictionary for the movie with its title
|
# Create a dictionary for the movie with its title
|
||||||
movie_guids = {"title": movie["Name"]}
|
movie_guids = {"title": movie["Name"]}
|
||||||
|
|
||||||
@@ -127,6 +128,7 @@ class Jellyfin:
|
|||||||
|
|
||||||
# Append the movie dictionary to the list for the given user and library
|
# Append the movie dictionary to the list for the given user and library
|
||||||
user_watched[user_name][library_title].append(movie_guids)
|
user_watched[user_name][library_title].append(movie_guids)
|
||||||
|
logger(f"Jellyfin: Added {movie_guids} to {user_name} watched list", 3)
|
||||||
|
|
||||||
# TV Shows
|
# TV Shows
|
||||||
if library_type == "Series":
|
if library_type == "Series":
|
||||||
@@ -151,6 +153,7 @@ class Jellyfin:
|
|||||||
# Create a list of tasks to retrieve the seasons of each watched show
|
# Create a list of tasks to retrieve the seasons of each watched show
|
||||||
seasons_tasks = []
|
seasons_tasks = []
|
||||||
for show in watched_shows_filtered:
|
for show in watched_shows_filtered:
|
||||||
|
logger(f"Jellyfin: Adding {show['Name']} to {user_name} watched list", 3)
|
||||||
show_guids = {
|
show_guids = {
|
||||||
k.lower(): v for k, v in show["ProviderIds"].items()
|
k.lower(): v for k, v in show["ProviderIds"].items()
|
||||||
}
|
}
|
||||||
@@ -269,10 +272,16 @@ class Jellyfin:
|
|||||||
][season_dict["Identifiers"]["season_name"]] = season_dict[
|
][season_dict["Identifiers"]["season_name"]] = season_dict[
|
||||||
"Episodes"
|
"Episodes"
|
||||||
]
|
]
|
||||||
|
logger(f"Jellyfin: Added {season_dict['Episodes']} to {user_name} {season_dict['Identifiers']['show_guids']} watched list", 1)
|
||||||
|
|
||||||
logger(
|
logger(
|
||||||
f"Jellyfin: Got watched for {user_name} in library {library_title}", 1
|
f"Jellyfin: Got watched for {user_name} in library {library_title}", 1
|
||||||
)
|
)
|
||||||
|
if library_title in user_watched[user_name]:
|
||||||
|
logger(
|
||||||
|
f"Jellyfin: {user_watched[user_name][library_title]}", 3
|
||||||
|
)
|
||||||
|
|
||||||
return user_watched
|
return user_watched
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger(
|
logger(
|
||||||
|
|||||||
14
src/plex.py
14
src/plex.py
@@ -35,11 +35,13 @@ def get_user_library_watched(user, user_plex, library):
|
|||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
library_videos = user_plex.library.section(library.title)
|
||||||
|
|
||||||
if library.type == "movie":
|
if library.type == "movie":
|
||||||
user_watched[user_name][library.title] = []
|
user_watched[user_name][library.title] = []
|
||||||
|
|
||||||
library_videos = user_plex.library.section(library.title)
|
|
||||||
for video in library_videos.search(unwatched=False):
|
for video in library_videos.search(unwatched=False):
|
||||||
|
logger(f"Plex: Adding {video.title} to {user_name} watched list", 3)
|
||||||
movie_guids = {}
|
movie_guids = {}
|
||||||
for guid in video.guids:
|
for guid in video.guids:
|
||||||
# Extract source and id from guid.id
|
# Extract source and id from guid.id
|
||||||
@@ -53,13 +55,13 @@ def get_user_library_watched(user, user_plex, library):
|
|||||||
)
|
)
|
||||||
|
|
||||||
user_watched[user_name][library.title].append(movie_guids)
|
user_watched[user_name][library.title].append(movie_guids)
|
||||||
|
logger(f"Plex: Added {movie_guids} to {user_name} watched list", 3)
|
||||||
|
|
||||||
elif library.type == "show":
|
elif library.type == "show":
|
||||||
user_watched[user_name][library.title] = {}
|
user_watched[user_name][library.title] = {}
|
||||||
|
|
||||||
library_videos = user_plex.library.section(library.title)
|
for show in library_videos.search(unwatched=False):
|
||||||
shows = library_videos.search(unwatched=False)
|
logger(f"Plex: Adding {show.title} to {user_name} watched list", 3)
|
||||||
for show in shows:
|
|
||||||
show_guids = {}
|
show_guids = {}
|
||||||
for show_guid in show.guids:
|
for show_guid in show.guids:
|
||||||
# Extract source and id from guid.id
|
# Extract source and id from guid.id
|
||||||
@@ -97,8 +99,12 @@ def get_user_library_watched(user, user_plex, library):
|
|||||||
user_watched[user_name][library.title][show_guids] = {}
|
user_watched[user_name][library.title][show_guids] = {}
|
||||||
|
|
||||||
user_watched[user_name][library.title][show_guids] = episode_guids
|
user_watched[user_name][library.title][show_guids] = episode_guids
|
||||||
|
logger(f"Plex: Added {episode_guids} to {user_name} {show_guids} watched list", 3)
|
||||||
|
|
||||||
logger(f"Plex: Got watched for {user_name} in library {library.title}", 1)
|
logger(f"Plex: Got watched for {user_name} in library {library.title}", 1)
|
||||||
|
if library.title in user_watched[user_name]:
|
||||||
|
logger(f"Plex: {user_watched[user_name][library.title]}", 3)
|
||||||
|
|
||||||
return user_watched
|
return user_watched
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger(
|
logger(
|
||||||
|
|||||||
Reference in New Issue
Block a user