commit
a397ceb54e
|
|
@ -184,7 +184,7 @@ class JellyfinEmby:
|
||||||
response = self.query(query_string, "get")
|
response = self.query(query_string, "get")
|
||||||
|
|
||||||
if response:
|
if response:
|
||||||
return f"{response['ServerName']}: {response['Version']}"
|
return f"{self.server_type} {response['ServerName']}: {response['Version']}"
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
@ -229,38 +229,42 @@ class JellyfinEmby:
|
||||||
f"/Users/{user_id}/Items"
|
f"/Users/{user_id}/Items"
|
||||||
+ f"?ParentId={library_id}&Filters=IsPlayed&IncludeItemTypes=Movie&Recursive=True&Fields=ItemCounts,ProviderIds,MediaSources",
|
+ f"?ParentId={library_id}&Filters=IsPlayed&IncludeItemTypes=Movie&Recursive=True&Fields=ItemCounts,ProviderIds,MediaSources",
|
||||||
"get",
|
"get",
|
||||||
)
|
).get("Items", [])
|
||||||
|
|
||||||
in_progress = self.query(
|
in_progress = self.query(
|
||||||
f"/Users/{user_id}/Items"
|
f"/Users/{user_id}/Items"
|
||||||
+ f"?ParentId={library_id}&Filters=IsResumable&IncludeItemTypes=Movie&Recursive=True&Fields=ItemCounts,ProviderIds,MediaSources",
|
+ f"?ParentId={library_id}&Filters=IsResumable&IncludeItemTypes=Movie&Recursive=True&Fields=ItemCounts,ProviderIds,MediaSources",
|
||||||
"get",
|
"get",
|
||||||
)
|
).get("Items", [])
|
||||||
|
|
||||||
for movie in watched["Items"] + in_progress["Items"]:
|
for movie in watched + in_progress:
|
||||||
if "MediaSources" in movie and movie["MediaSources"] != {}:
|
# Skip if theres no user data which means the movie has not been watched
|
||||||
if "UserData" not in movie:
|
if "UserData" not in movie:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Skip if not watched or watched less than a minute
|
# Skip if theres no media tied to the movie
|
||||||
if (
|
if "MediaSources" not in movie or movie["MediaSources"] == {}:
|
||||||
movie["UserData"]["Played"] == True
|
continue
|
||||||
or movie["UserData"]["PlaybackPositionTicks"] > 600000000
|
|
||||||
):
|
|
||||||
logger(
|
|
||||||
f"{self.server_type}: Adding {movie.get('Name')} to {user_name} watched list",
|
|
||||||
3,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Get the movie's GUIDs
|
# Skip if not watched or watched less than a minute
|
||||||
movie_guids = get_guids(self.server_type, movie)
|
if (
|
||||||
|
movie["UserData"]["Played"] == True
|
||||||
|
or movie["UserData"]["PlaybackPositionTicks"] > 600000000
|
||||||
|
):
|
||||||
|
logger(
|
||||||
|
f"{self.server_type}: Adding {movie.get('Name')} to {user_name} watched list",
|
||||||
|
3,
|
||||||
|
)
|
||||||
|
|
||||||
# Append the movie dictionary to the list for the given user and library
|
# Get the movie's GUIDs
|
||||||
user_watched[user_name][library_title].append(movie_guids)
|
movie_guids = get_guids(self.server_type, movie)
|
||||||
logger(
|
|
||||||
f"{self.server_type}: Added {movie_guids} to {user_name} watched list",
|
# Append the movie dictionary to the list for the given user and library
|
||||||
3,
|
user_watched[user_name][library_title].append(movie_guids)
|
||||||
)
|
logger(
|
||||||
|
f"{self.server_type}: Added {movie_guids} to {user_name} watched list",
|
||||||
|
3,
|
||||||
|
)
|
||||||
|
|
||||||
# TV Shows
|
# TV Shows
|
||||||
if library_type in ["Series", "Episode"]:
|
if library_type in ["Series", "Episode"]:
|
||||||
|
|
@ -272,20 +276,19 @@ class JellyfinEmby:
|
||||||
f"/Users/{user_id}/Items"
|
f"/Users/{user_id}/Items"
|
||||||
+ f"?ParentId={library_id}&isPlaceHolder=false&IncludeItemTypes=Series&Recursive=True&Fields=ProviderIds,Path,RecursiveItemCount",
|
+ f"?ParentId={library_id}&isPlaceHolder=false&IncludeItemTypes=Series&Recursive=True&Fields=ProviderIds,Path,RecursiveItemCount",
|
||||||
"get",
|
"get",
|
||||||
)
|
).get("Items", [])
|
||||||
|
|
||||||
# Filter the list of shows to only include those that have been partially or fully watched
|
# Filter the list of shows to only include those that have been partially or fully watched
|
||||||
watched_shows_filtered = []
|
watched_shows_filtered = []
|
||||||
for show in watched_shows["Items"]:
|
for show in watched_shows:
|
||||||
if not "UserData" in show:
|
if "UserData" not in show:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if "PlayedPercentage" in show["UserData"]:
|
if "PlayedPercentage" in show["UserData"]:
|
||||||
if show["UserData"]["PlayedPercentage"] > 0:
|
if show["UserData"]["PlayedPercentage"] > 0:
|
||||||
watched_shows_filtered.append(show)
|
watched_shows_filtered.append(show)
|
||||||
|
|
||||||
# Retrieve the seasons of each watched show
|
# Retrieve the watched/partially watched list of episodes of each watched show
|
||||||
seasons_watched = []
|
|
||||||
for show in watched_shows_filtered:
|
for show in watched_shows_filtered:
|
||||||
logger(
|
logger(
|
||||||
f"{self.server_type}: Adding {show.get('Name')} to {user_name} watched list",
|
f"{self.server_type}: Adding {show.get('Name')} to {user_name} watched list",
|
||||||
|
|
@ -298,118 +301,54 @@ class JellyfinEmby:
|
||||||
if "Path" in show
|
if "Path" in show
|
||||||
else tuple()
|
else tuple()
|
||||||
)
|
)
|
||||||
show_guids = frozenset(show_guids.items())
|
show_display_name = (
|
||||||
show_identifiers = {
|
show_guids["title"]
|
||||||
"show_guids": show_guids,
|
if show_guids["title"]
|
||||||
"show_id": show["Id"],
|
else show_guids["locations"]
|
||||||
}
|
|
||||||
|
|
||||||
seasons_watched.append(
|
|
||||||
self.query(
|
|
||||||
f"/Shows/{show['Id']}/Seasons"
|
|
||||||
+ f"?userId={user_id}&isPlaceHolder=false&Fields=ProviderIds,RecursiveItemCount",
|
|
||||||
"get",
|
|
||||||
identifiers=frozenset(show_identifiers.items()),
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Filter the list of seasons to only include those that have been partially or fully watched
|
show_guids = frozenset(show_guids.items())
|
||||||
seasons_watched_filtered = []
|
|
||||||
for seasons in seasons_watched:
|
|
||||||
seasons_watched_filtered_dict = {}
|
|
||||||
seasons_watched_filtered_dict["Identifiers"] = seasons[
|
|
||||||
"Identifiers"
|
|
||||||
]
|
|
||||||
seasons_watched_filtered_dict["Items"] = []
|
|
||||||
for season in seasons["Items"]:
|
|
||||||
if "PlayedPercentage" in season["UserData"]:
|
|
||||||
if season["UserData"]["PlayedPercentage"] > 0:
|
|
||||||
seasons_watched_filtered_dict["Items"].append(season)
|
|
||||||
|
|
||||||
if seasons_watched_filtered_dict["Items"]:
|
show_episodes = self.query(
|
||||||
seasons_watched_filtered.append(seasons_watched_filtered_dict)
|
f"/Shows/{show['Id']}/Episodes"
|
||||||
|
+ f"?userId={user_id}&isPlaceHolder=false&Fields=ProviderIds,MediaSources",
|
||||||
|
"get",
|
||||||
|
).get("Items", [])
|
||||||
|
|
||||||
# Create a list of tasks to retrieve the episodes of each watched season
|
# Iterate through the episodes
|
||||||
watched_episodes = []
|
# Create a list to store the episodes
|
||||||
for seasons in seasons_watched_filtered:
|
mark_episodes_list = []
|
||||||
if len(seasons["Items"]) > 0:
|
for episode in show_episodes:
|
||||||
for season in seasons["Items"]:
|
if "UserData" not in episode:
|
||||||
if "IndexNumber" not in season:
|
continue
|
||||||
logger(
|
|
||||||
f"Jellyfin: Skipping show {season.get('SeriesName')} season {season.get('Name')} as it has no index number",
|
|
||||||
3,
|
|
||||||
)
|
|
||||||
|
|
||||||
continue
|
|
||||||
season_identifiers = dict(seasons["Identifiers"])
|
|
||||||
season_identifiers["season_index"] = season["IndexNumber"]
|
|
||||||
watched_task = self.query(
|
|
||||||
f"/Shows/{season_identifiers['show_id']}/Episodes"
|
|
||||||
+ f"?seasonId={season['Id']}&userId={user_id}&isPlaceHolder=false&Filters=IsPlayed&Fields=ProviderIds,MediaSources",
|
|
||||||
"get",
|
|
||||||
identifiers=frozenset(season_identifiers.items()),
|
|
||||||
)
|
|
||||||
|
|
||||||
in_progress_task = self.query(
|
|
||||||
f"/Shows/{season_identifiers['show_id']}/Episodes"
|
|
||||||
+ f"?seasonId={season['Id']}&userId={user_id}&isPlaceHolder=false&Filters=IsResumable&Fields=ProviderIds,MediaSources",
|
|
||||||
"get",
|
|
||||||
identifiers=frozenset(season_identifiers.items()),
|
|
||||||
)
|
|
||||||
watched_episodes.append(watched_task)
|
|
||||||
watched_episodes.append(in_progress_task)
|
|
||||||
|
|
||||||
# Iterate through the watched episodes
|
|
||||||
for episodes in watched_episodes:
|
|
||||||
# If the season has any watched episodes
|
|
||||||
if len(episodes["Items"]) > 0:
|
|
||||||
# Create a dictionary for the season with its identifier and episodes
|
|
||||||
season_dict = {}
|
|
||||||
season_dict["Identifiers"] = dict(episodes["Identifiers"])
|
|
||||||
season_dict["Episodes"] = []
|
|
||||||
for episode in episodes["Items"]:
|
|
||||||
if (
|
|
||||||
"MediaSources" in episode
|
|
||||||
and episode["MediaSources"] != {}
|
|
||||||
):
|
|
||||||
# If watched or watched more than a minute
|
|
||||||
if (
|
|
||||||
episode["UserData"]["Played"] == True
|
|
||||||
or episode["UserData"]["PlaybackPositionTicks"]
|
|
||||||
> 600000000
|
|
||||||
):
|
|
||||||
episode_dict = get_guids(self.server_type, episode)
|
|
||||||
# Add the episode dictionary to the season's list of episodes
|
|
||||||
season_dict["Episodes"].append(episode_dict)
|
|
||||||
|
|
||||||
# Add the season dictionary to the show's list of seasons
|
|
||||||
if (
|
|
||||||
season_dict["Identifiers"]["show_guids"]
|
|
||||||
not in user_watched[user_name][library_title]
|
|
||||||
):
|
|
||||||
user_watched[user_name][library_title][
|
|
||||||
season_dict["Identifiers"]["show_guids"]
|
|
||||||
] = {}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
season_dict["Identifiers"]["season_index"]
|
"MediaSources" not in episode
|
||||||
not in user_watched[user_name][library_title][
|
or episode["MediaSources"] == {}
|
||||||
season_dict["Identifiers"]["show_guids"]
|
|
||||||
]
|
|
||||||
):
|
):
|
||||||
user_watched[user_name][library_title][
|
continue
|
||||||
season_dict["Identifiers"]["show_guids"]
|
|
||||||
][season_dict["Identifiers"]["season_index"]] = []
|
# If watched or watched more than a minute
|
||||||
|
if (
|
||||||
|
episode["UserData"]["Played"] == True
|
||||||
|
or episode["UserData"]["PlaybackPositionTicks"] > 600000000
|
||||||
|
):
|
||||||
|
episode_guids = get_guids(self.server_type, episode)
|
||||||
|
mark_episodes_list.append(episode_guids)
|
||||||
|
|
||||||
|
if mark_episodes_list:
|
||||||
|
# Add the show dictionary to the user's watched list
|
||||||
|
if show_guids not in user_watched[user_name][library_title]:
|
||||||
|
user_watched[user_name][library_title][show_guids] = []
|
||||||
|
|
||||||
user_watched[user_name][library_title][
|
user_watched[user_name][library_title][
|
||||||
season_dict["Identifiers"]["show_guids"]
|
show_guids
|
||||||
][season_dict["Identifiers"]["season_index"]] = season_dict[
|
] = mark_episodes_list
|
||||||
"Episodes"
|
for episode in mark_episodes_list:
|
||||||
]
|
logger(
|
||||||
logger(
|
f"{self.server_type}: Added {episode} to {user_name} {show_display_name} watched list",
|
||||||
f"{self.server_type}: Added {season_dict['Episodes']} to {user_name} {season_dict['Identifiers']['show_guids']} watched list",
|
1,
|
||||||
1,
|
)
|
||||||
)
|
|
||||||
|
|
||||||
logger(
|
logger(
|
||||||
f"{self.server_type}: Got watched for {user_name} in library {library_title}",
|
f"{self.server_type}: Got watched for {user_name} in library {library_title}",
|
||||||
|
|
@ -674,7 +613,7 @@ class JellyfinEmby:
|
||||||
is not None
|
is not None
|
||||||
):
|
):
|
||||||
show_found = True
|
show_found = True
|
||||||
for shows, seasons in videos.items():
|
for shows, episodes in videos.items():
|
||||||
show = {k: v for k, v in shows}
|
show = {k: v for k, v in shows}
|
||||||
if (
|
if (
|
||||||
contains_nested(
|
contains_nested(
|
||||||
|
|
@ -683,9 +622,8 @@ class JellyfinEmby:
|
||||||
)
|
)
|
||||||
is not None
|
is not None
|
||||||
):
|
):
|
||||||
for season in seasons.values():
|
for episode in episodes:
|
||||||
for episode in season:
|
episode_videos.append(episode)
|
||||||
episode_videos.append(episode)
|
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
@ -702,14 +640,13 @@ class JellyfinEmby:
|
||||||
]
|
]
|
||||||
):
|
):
|
||||||
show_found = True
|
show_found = True
|
||||||
for show, seasons in videos.items():
|
for show, episodes in videos.items():
|
||||||
show = {k: v for k, v in show}
|
show = {k: v for k, v in show}
|
||||||
if show_provider_id.lower() in show.get(
|
if show_provider_id.lower() in show.get(
|
||||||
show_provider_source.lower(), []
|
show_provider_source.lower(), []
|
||||||
):
|
):
|
||||||
for season in seasons.values():
|
for episode in episodes:
|
||||||
for episode in season:
|
episode_videos.append(episode)
|
||||||
episode_videos.append(episode)
|
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,63 +169,53 @@ def episode_title_dict(user_list: dict):
|
||||||
episode_output_dict["time"] = []
|
episode_output_dict["time"] = []
|
||||||
episode_output_dict["locations"] = []
|
episode_output_dict["locations"] = []
|
||||||
episode_output_dict["show"] = []
|
episode_output_dict["show"] = []
|
||||||
episode_output_dict["season"] = []
|
|
||||||
episode_counter = 0 # Initialize a counter for the current episode position
|
episode_counter = 0 # Initialize a counter for the current episode position
|
||||||
|
|
||||||
# Iterate through the shows, seasons, and episodes in user_list
|
# Iterate through the shows and episodes in user_list
|
||||||
for show in user_list:
|
for show in user_list:
|
||||||
for season in user_list[show]:
|
|
||||||
for episode in user_list[show][season]:
|
|
||||||
# Add the show title to the episode_output_dict if it doesn't exist
|
|
||||||
if "show" not in episode_output_dict:
|
|
||||||
episode_output_dict["show"] = [None] * episode_counter
|
|
||||||
|
|
||||||
# Add the season number to the episode_output_dict if it doesn't exist
|
for episode in user_list[show]:
|
||||||
if "season" not in episode_output_dict:
|
# Add the show title to the episode_output_dict if it doesn't exist
|
||||||
episode_output_dict["season"] = [None] * episode_counter
|
if "show" not in episode_output_dict:
|
||||||
|
episode_output_dict["show"] = [None] * episode_counter
|
||||||
|
|
||||||
# Add the show title to the episode_output_dict
|
# Add the show title to the episode_output_dict
|
||||||
episode_output_dict["show"].append(dict(show))
|
episode_output_dict["show"].append(dict(show))
|
||||||
|
|
||||||
# Add the season number to the episode_output_dict
|
# Iterate through the keys and values in each episode
|
||||||
episode_output_dict["season"].append(season)
|
for episode_key, episode_value in episode.items():
|
||||||
|
# If the key is not "status", add the key to episode_output_dict if it doesn't exist
|
||||||
|
if episode_key != "status":
|
||||||
|
if episode_key.lower() not in episode_output_dict:
|
||||||
|
# Initialize the list with None values up to the current episode position
|
||||||
|
episode_output_dict[episode_key.lower()] = [
|
||||||
|
None
|
||||||
|
] * episode_counter
|
||||||
|
|
||||||
# Iterate through the keys and values in each episode
|
# If the key is "locations", append each location to the list
|
||||||
for episode_key, episode_value in episode.items():
|
if episode_key == "locations":
|
||||||
# If the key is not "status", add the key to episode_output_dict if it doesn't exist
|
episode_output_dict[episode_key.lower()].append(episode_value)
|
||||||
if episode_key != "status":
|
|
||||||
if episode_key.lower() not in episode_output_dict:
|
|
||||||
# Initialize the list with None values up to the current episode position
|
|
||||||
episode_output_dict[episode_key.lower()] = [
|
|
||||||
None
|
|
||||||
] * episode_counter
|
|
||||||
|
|
||||||
# If the key is "locations", append each location to the list
|
# If the key is "status", append the "completed" and "time" values
|
||||||
if episode_key == "locations":
|
elif episode_key == "status":
|
||||||
episode_output_dict[episode_key.lower()].append(
|
episode_output_dict["completed"].append(
|
||||||
episode_value
|
episode_value["completed"]
|
||||||
)
|
)
|
||||||
|
episode_output_dict["time"].append(episode_value["time"])
|
||||||
|
|
||||||
# If the key is "status", append the "completed" and "time" values
|
# For other keys, append the value to the list
|
||||||
elif episode_key == "status":
|
else:
|
||||||
episode_output_dict["completed"].append(
|
episode_output_dict[episode_key.lower()].append(
|
||||||
episode_value["completed"]
|
episode_value.lower()
|
||||||
)
|
)
|
||||||
episode_output_dict["time"].append(episode_value["time"])
|
|
||||||
|
|
||||||
# For other keys, append the value to the list
|
# Increment the episode_counter
|
||||||
else:
|
episode_counter += 1
|
||||||
episode_output_dict[episode_key.lower()].append(
|
|
||||||
episode_value.lower()
|
|
||||||
)
|
|
||||||
|
|
||||||
# Increment the episode_counter
|
# Extend the lists in episode_output_dict with None values to match the current episode_counter
|
||||||
episode_counter += 1
|
for key in episode_output_dict:
|
||||||
|
if len(episode_output_dict[key]) < episode_counter:
|
||||||
# Extend the lists in episode_output_dict with None values to match the current episode_counter
|
episode_output_dict[key].append(None)
|
||||||
for key in episode_output_dict:
|
|
||||||
if len(episode_output_dict[key]) < episode_counter:
|
|
||||||
episode_output_dict[key].append(None)
|
|
||||||
|
|
||||||
return episode_output_dict
|
return episode_output_dict
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
||||||
22
src/plex.py
22
src/plex.py
|
|
@ -117,11 +117,9 @@ def get_user_library_watched_show(show, process_episodes, threads=None):
|
||||||
episode_guids_args, threads=threads
|
episode_guids_args, threads=threads
|
||||||
)
|
)
|
||||||
|
|
||||||
episode_guids = {}
|
episode_guids = []
|
||||||
for index, episode in enumerate(process_episodes):
|
for index, episode in enumerate(process_episodes):
|
||||||
if episode.parentIndex not in episode_guids:
|
episode_guids.append(episode_guids_results[index])
|
||||||
episode_guids[episode.parentIndex] = []
|
|
||||||
episode_guids[episode.parentIndex].append(episode_guids_results[index])
|
|
||||||
|
|
||||||
return show_guids, episode_guids
|
return show_guids, episode_guids
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
@ -220,7 +218,7 @@ def find_video(plex_search, video_ids, videos=None):
|
||||||
):
|
):
|
||||||
episode_videos = []
|
episode_videos = []
|
||||||
if videos:
|
if videos:
|
||||||
for show, seasons in videos.items():
|
for show, episodes in videos.items():
|
||||||
show = {k: v for k, v in show}
|
show = {k: v for k, v in show}
|
||||||
if (
|
if (
|
||||||
contains_nested(
|
contains_nested(
|
||||||
|
|
@ -228,9 +226,8 @@ def find_video(plex_search, video_ids, videos=None):
|
||||||
)
|
)
|
||||||
is not None
|
is not None
|
||||||
):
|
):
|
||||||
for season in seasons.values():
|
for episode in episodes:
|
||||||
for episode in season:
|
episode_videos.append(episode)
|
||||||
episode_videos.append(episode)
|
|
||||||
|
|
||||||
return True, episode_videos
|
return True, episode_videos
|
||||||
|
|
||||||
|
|
@ -243,13 +240,12 @@ def find_video(plex_search, video_ids, videos=None):
|
||||||
if guid_id in video_ids[guid_source]:
|
if guid_id in video_ids[guid_source]:
|
||||||
episode_videos = []
|
episode_videos = []
|
||||||
if videos:
|
if videos:
|
||||||
for show, seasons in videos.items():
|
for show, episodes in videos.items():
|
||||||
show = {k: v for k, v in show}
|
show = {k: v for k, v in show}
|
||||||
if guid_source in show.keys():
|
if guid_source in show.keys():
|
||||||
if guid_id == show[guid_source]:
|
if guid_id == show[guid_source]:
|
||||||
for season in seasons.values():
|
for episode in episodes:
|
||||||
for episode in season:
|
episode_videos.append(episode)
|
||||||
episode_videos.append(episode)
|
|
||||||
|
|
||||||
return True, episode_videos
|
return True, episode_videos
|
||||||
|
|
||||||
|
|
@ -456,7 +452,7 @@ class Plex:
|
||||||
raise Exception(e)
|
raise Exception(e)
|
||||||
|
|
||||||
def info(self) -> str:
|
def info(self) -> str:
|
||||||
return f"{self.plex.friendlyName}: {self.plex.version}"
|
return f"Plex {self.plex.friendlyName}: {self.plex.version}"
|
||||||
|
|
||||||
def get_users(self):
|
def get_users(self):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -122,53 +122,27 @@ def cleanup_watched(
|
||||||
for show_key_1 in watched_list_1[user_1][library_1].keys():
|
for show_key_1 in watched_list_1[user_1][library_1].keys():
|
||||||
show_key_dict = dict(show_key_1)
|
show_key_dict = dict(show_key_1)
|
||||||
|
|
||||||
for season in watched_list_1[user_1][library_1][show_key_1]:
|
# Filter the episode_watched_list_2_keys_dict dictionary to handle cases
|
||||||
# Filter the episode_watched_list_2_keys_dict dictionary to handle cases
|
# where episode location names are not unique such as S01E01.mkv
|
||||||
# where episode location names are not unique such as S01E01.mkv
|
filtered_episode_watched_list_2_keys_dict = (
|
||||||
filtered_episode_watched_list_2_keys_dict = (
|
filter_episode_watched_list_2_keys_dict(
|
||||||
filter_episode_watched_list_2_keys_dict(
|
episode_watched_list_2_keys_dict, show_key_dict
|
||||||
episode_watched_list_2_keys_dict, show_key_dict, season
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
for episode in watched_list_1[user_1][library_1][show_key_1][
|
)
|
||||||
season
|
for episode in watched_list_1[user_1][library_1][show_key_1]:
|
||||||
]:
|
episode_index = get_episode_index_in_dict(
|
||||||
episode_index = get_episode_index_in_dict(
|
episode, filtered_episode_watched_list_2_keys_dict
|
||||||
episode, filtered_episode_watched_list_2_keys_dict
|
)
|
||||||
)
|
if episode_index is not None:
|
||||||
if episode_index is not None:
|
if check_remove_entry(
|
||||||
if check_remove_entry(
|
episode,
|
||||||
episode,
|
library_1,
|
||||||
library_1,
|
episode_index,
|
||||||
episode_index,
|
episode_watched_list_2_keys_dict,
|
||||||
episode_watched_list_2_keys_dict,
|
|
||||||
):
|
|
||||||
modified_watched_list_1[user_1][library_1][
|
|
||||||
show_key_1
|
|
||||||
][season].remove(episode)
|
|
||||||
|
|
||||||
# Remove empty seasons
|
|
||||||
if (
|
|
||||||
len(
|
|
||||||
modified_watched_list_1[user_1][library_1][show_key_1][
|
|
||||||
season
|
|
||||||
]
|
|
||||||
)
|
|
||||||
== 0
|
|
||||||
):
|
|
||||||
if (
|
|
||||||
season
|
|
||||||
in modified_watched_list_1[user_1][library_1][
|
|
||||||
show_key_1
|
|
||||||
]
|
|
||||||
):
|
):
|
||||||
logger(
|
modified_watched_list_1[user_1][library_1][
|
||||||
f"Removing {season} from {show_key_dict['title']} because it is empty",
|
|
||||||
3,
|
|
||||||
)
|
|
||||||
del modified_watched_list_1[user_1][library_1][
|
|
||||||
show_key_1
|
show_key_1
|
||||||
][season]
|
].remove(episode)
|
||||||
|
|
||||||
# Remove empty shows
|
# Remove empty shows
|
||||||
if len(modified_watched_list_1[user_1][library_1][show_key_1]) == 0:
|
if len(modified_watched_list_1[user_1][library_1][show_key_1]) == 0:
|
||||||
|
|
@ -231,27 +205,18 @@ def get_movie_index_in_dict(movie, movies_watched_list_2_keys_dict):
|
||||||
|
|
||||||
|
|
||||||
def filter_episode_watched_list_2_keys_dict(
|
def filter_episode_watched_list_2_keys_dict(
|
||||||
episode_watched_list_2_keys_dict, show_key_dict, season
|
episode_watched_list_2_keys_dict, show_key_dict
|
||||||
):
|
):
|
||||||
# If the episode_watched_list_2_keys_dict dictionary is empty, missing season or show then return an empty dictionary
|
# If the episode_watched_list_2_keys_dict dictionary is empty, missing show then return an empty dictionary
|
||||||
if (
|
if (
|
||||||
len(episode_watched_list_2_keys_dict) == 0
|
len(episode_watched_list_2_keys_dict) == 0
|
||||||
or "season" not in episode_watched_list_2_keys_dict.keys()
|
|
||||||
or "show" not in episode_watched_list_2_keys_dict.keys()
|
or "show" not in episode_watched_list_2_keys_dict.keys()
|
||||||
):
|
):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
# Filter the episode_watched_list_2_keys_dict dictionary to only include values for the correct show and season
|
# Filter the episode_watched_list_2_keys_dict dictionary to only include values for the correct show
|
||||||
filtered_episode_watched_list_2_keys_dict = {}
|
filtered_episode_watched_list_2_keys_dict = {}
|
||||||
show_indecies = []
|
show_indecies = []
|
||||||
season_indecies = []
|
|
||||||
|
|
||||||
# Iterate through episode_watched_list_2_keys_dict["season"] and find the indecies that match season
|
|
||||||
for season_index, season_value in enumerate(
|
|
||||||
episode_watched_list_2_keys_dict.get("season")
|
|
||||||
):
|
|
||||||
if season_value == season:
|
|
||||||
season_indecies.append(season_index)
|
|
||||||
|
|
||||||
# Iterate through episode_watched_list_2_keys_dict["show"] and find the indecies that match show_key_dict
|
# Iterate through episode_watched_list_2_keys_dict["show"] and find the indecies that match show_key_dict
|
||||||
for show_index, show_value in enumerate(episode_watched_list_2_keys_dict["show"]):
|
for show_index, show_value in enumerate(episode_watched_list_2_keys_dict["show"]):
|
||||||
|
|
@ -273,14 +238,14 @@ def filter_episode_watched_list_2_keys_dict(
|
||||||
show_indecies.append(show_index)
|
show_indecies.append(show_index)
|
||||||
break
|
break
|
||||||
|
|
||||||
# Find the intersection of the show_indecies and season_indecies lists
|
# lists
|
||||||
indecies = list(set(show_indecies) & set(season_indecies))
|
indecies = list(set(show_indecies))
|
||||||
|
|
||||||
# If there are no indecies that match the show and season, return an empty dictionary
|
# If there are no indecies that match the show, return an empty dictionary
|
||||||
if len(indecies) == 0:
|
if len(indecies) == 0:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
# Create a copy of the dictionary with indecies that match the show and season and none that don't
|
# Create a copy of the dictionary with indecies that match the show and none that don't
|
||||||
for key, value in episode_watched_list_2_keys_dict.items():
|
for key, value in episode_watched_list_2_keys_dict.items():
|
||||||
if key not in filtered_episode_watched_list_2_keys_dict:
|
if key not in filtered_episode_watched_list_2_keys_dict:
|
||||||
filtered_episode_watched_list_2_keys_dict[key] = []
|
filtered_episode_watched_list_2_keys_dict[key] = []
|
||||||
|
|
|
||||||
|
|
@ -42,21 +42,19 @@ show_list = {
|
||||||
("tvdb", "392256"),
|
("tvdb", "392256"),
|
||||||
("title", "The Last of Us"),
|
("title", "The Last of Us"),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
"Season 1": [
|
{
|
||||||
{
|
"imdb": "tt11957006",
|
||||||
"imdb": "tt11957006",
|
"tmdb": "2181581",
|
||||||
"tmdb": "2181581",
|
"tvdb": "8444132",
|
||||||
"tvdb": "8444132",
|
"locations": (
|
||||||
"locations": (
|
(
|
||||||
(
|
"The Last of Us - S01E01 - When You're Lost in the Darkness WEBDL-1080p.mkv",
|
||||||
"The Last of Us - S01E01 - When You're Lost in the Darkness WEBDL-1080p.mkv",
|
)
|
||||||
)
|
),
|
||||||
),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
}
|
||||||
}
|
]
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
movie_list = [
|
movie_list = [
|
||||||
{
|
{
|
||||||
|
|
@ -83,7 +81,6 @@ episode_titles = {
|
||||||
"tvdb": ["8444132"],
|
"tvdb": ["8444132"],
|
||||||
"completed": [True],
|
"completed": [True],
|
||||||
"time": [0],
|
"time": [0],
|
||||||
"season": ["Season 1"],
|
|
||||||
"show": [
|
"show": [
|
||||||
{
|
{
|
||||||
"imdb": "tt3581920",
|
"imdb": "tt3581920",
|
||||||
|
|
|
||||||
|
|
@ -24,34 +24,32 @@ tv_shows_watched_list_1 = {
|
||||||
("tvdb", "78804"),
|
("tvdb", "78804"),
|
||||||
("title", "Doctor Who (2005)"),
|
("title", "Doctor Who (2005)"),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
1: [
|
{
|
||||||
{
|
"imdb": "tt0563001",
|
||||||
"imdb": "tt0563001",
|
"tmdb": "968589",
|
||||||
"tmdb": "968589",
|
"tvdb": "295296",
|
||||||
"tvdb": "295296",
|
"title": "The Unquiet Dead",
|
||||||
"title": "The Unquiet Dead",
|
"locations": ("S01E03.mkv",),
|
||||||
"locations": ("S01E03.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
{
|
||||||
{
|
"imdb": "tt0562985",
|
||||||
"imdb": "tt0562985",
|
"tmdb": "968590",
|
||||||
"tmdb": "968590",
|
"tvdb": "295297",
|
||||||
"tvdb": "295297",
|
"title": "Aliens of London (1)",
|
||||||
"title": "Aliens of London (1)",
|
"locations": ("S01E04.mkv",),
|
||||||
"locations": ("S01E04.mkv",),
|
"status": {"completed": False, "time": 240000},
|
||||||
"status": {"completed": False, "time": 240000},
|
},
|
||||||
},
|
{
|
||||||
{
|
"imdb": "tt0563003",
|
||||||
"imdb": "tt0563003",
|
"tmdb": "968592",
|
||||||
"tmdb": "968592",
|
"tvdb": "295298",
|
||||||
"tvdb": "295298",
|
"title": "World War Three (2)",
|
||||||
"title": "World War Three (2)",
|
"locations": ("S01E05.mkv",),
|
||||||
"locations": ("S01E05.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
],
|
||||||
]
|
|
||||||
},
|
|
||||||
frozenset(
|
frozenset(
|
||||||
{
|
{
|
||||||
("title", "Monarch: Legacy of Monsters"),
|
("title", "Monarch: Legacy of Monsters"),
|
||||||
|
|
@ -63,34 +61,32 @@ tv_shows_watched_list_1 = {
|
||||||
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
|
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
1: [
|
{
|
||||||
{
|
"imdb": "tt21255044",
|
||||||
"imdb": "tt21255044",
|
"tmdb": "4661246",
|
||||||
"tmdb": "4661246",
|
"tvdb": "10009418",
|
||||||
"tvdb": "10009418",
|
"title": "Secrets and Lies",
|
||||||
"title": "Secrets and Lies",
|
"locations": ("S01E03.mkv",),
|
||||||
"locations": ("S01E03.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
{
|
||||||
{
|
"imdb": "tt21255050",
|
||||||
"imdb": "tt21255050",
|
"tmdb": "4712059",
|
||||||
"tmdb": "4712059",
|
"tvdb": "10009419",
|
||||||
"tvdb": "10009419",
|
"title": "Parallels and Interiors",
|
||||||
"title": "Parallels and Interiors",
|
"locations": ("S01E04.mkv",),
|
||||||
"locations": ("S01E04.mkv",),
|
"status": {"completed": False, "time": 240000},
|
||||||
"status": {"completed": False, "time": 240000},
|
},
|
||||||
},
|
{
|
||||||
{
|
"imdb": "tt23787572",
|
||||||
"imdb": "tt23787572",
|
"tmdb": "4712061",
|
||||||
"tmdb": "4712061",
|
"tvdb": "10009420",
|
||||||
"tvdb": "10009420",
|
"title": "The Way Out",
|
||||||
"title": "The Way Out",
|
"locations": ("S01E05.mkv",),
|
||||||
"locations": ("S01E05.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
],
|
||||||
]
|
|
||||||
},
|
|
||||||
frozenset(
|
frozenset(
|
||||||
{
|
{
|
||||||
("tmdb", "125928"),
|
("tmdb", "125928"),
|
||||||
|
|
@ -102,34 +98,32 @@ tv_shows_watched_list_1 = {
|
||||||
),
|
),
|
||||||
("title", "My Adventures with Superman"),
|
("title", "My Adventures with Superman"),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
1: [
|
{
|
||||||
{
|
"imdb": "tt15699926",
|
||||||
"imdb": "tt15699926",
|
"tmdb": "3070048",
|
||||||
"tmdb": "3070048",
|
"tvdb": "8438181",
|
||||||
"tvdb": "8438181",
|
"title": "Adventures of a Normal Man (1)",
|
||||||
"title": "Adventures of a Normal Man (1)",
|
"locations": ("S01E01.mkv",),
|
||||||
"locations": ("S01E01.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
{
|
||||||
{
|
"imdb": "tt20413322",
|
||||||
"imdb": "tt20413322",
|
"tmdb": "4568681",
|
||||||
"tmdb": "4568681",
|
"tvdb": "9829910",
|
||||||
"tvdb": "9829910",
|
"title": "Adventures of a Normal Man (2)",
|
||||||
"title": "Adventures of a Normal Man (2)",
|
"locations": ("S01E02.mkv",),
|
||||||
"locations": ("S01E02.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
{
|
||||||
{
|
"imdb": "tt20413328",
|
||||||
"imdb": "tt20413328",
|
"tmdb": "4497012",
|
||||||
"tmdb": "4497012",
|
"tvdb": "9870382",
|
||||||
"tvdb": "9870382",
|
"title": "My Interview with Superman",
|
||||||
"title": "My Interview with Superman",
|
"locations": ("S01E03.mkv",),
|
||||||
"locations": ("S01E03.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
],
|
||||||
]
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -143,31 +137,29 @@ tv_shows_watched_list_2 = {
|
||||||
("tvdb", "78804"),
|
("tvdb", "78804"),
|
||||||
("tvrage", "3332"),
|
("tvrage", "3332"),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
1: [
|
{
|
||||||
{
|
"tvdb": "295294",
|
||||||
"tvdb": "295294",
|
"imdb": "tt0562992",
|
||||||
"imdb": "tt0562992",
|
"title": "Rose",
|
||||||
"title": "Rose",
|
"locations": ("S01E01.mkv",),
|
||||||
"locations": ("S01E01.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
{
|
||||||
{
|
"tvdb": "295295",
|
||||||
"tvdb": "295295",
|
"imdb": "tt0562997",
|
||||||
"imdb": "tt0562997",
|
"title": "The End of the World",
|
||||||
"title": "The End of the World",
|
"locations": ("S01E02.mkv",),
|
||||||
"locations": ("S01E02.mkv",),
|
"status": {"completed": False, "time": 300670},
|
||||||
"status": {"completed": False, "time": 300670},
|
},
|
||||||
},
|
{
|
||||||
{
|
"tvdb": "295298",
|
||||||
"tvdb": "295298",
|
"imdb": "tt0563003",
|
||||||
"imdb": "tt0563003",
|
"title": "World War Three (2)",
|
||||||
"title": "World War Three (2)",
|
"locations": ("S01E05.mkv",),
|
||||||
"locations": ("S01E05.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
],
|
||||||
]
|
|
||||||
},
|
|
||||||
frozenset(
|
frozenset(
|
||||||
{
|
{
|
||||||
("title", "Monarch: Legacy of Monsters"),
|
("title", "Monarch: Legacy of Monsters"),
|
||||||
|
|
@ -179,31 +171,29 @@ tv_shows_watched_list_2 = {
|
||||||
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
|
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
1: [
|
{
|
||||||
{
|
"tvdb": "9959300",
|
||||||
"tvdb": "9959300",
|
"imdb": "tt20412166",
|
||||||
"imdb": "tt20412166",
|
"title": "Aftermath",
|
||||||
"title": "Aftermath",
|
"locations": ("S01E01.mkv",),
|
||||||
"locations": ("S01E01.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
{
|
||||||
{
|
"tvdb": "10009417",
|
||||||
"tvdb": "10009417",
|
"imdb": "tt22866594",
|
||||||
"imdb": "tt22866594",
|
"title": "Departure",
|
||||||
"title": "Departure",
|
"locations": ("S01E02.mkv",),
|
||||||
"locations": ("S01E02.mkv",),
|
"status": {"completed": False, "time": 300741},
|
||||||
"status": {"completed": False, "time": 300741},
|
},
|
||||||
},
|
{
|
||||||
{
|
"tvdb": "10009420",
|
||||||
"tvdb": "10009420",
|
"imdb": "tt23787572",
|
||||||
"imdb": "tt23787572",
|
"title": "The Way Out",
|
||||||
"title": "The Way Out",
|
"locations": ("S01E05.mkv",),
|
||||||
"locations": ("S01E05.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
],
|
||||||
]
|
|
||||||
},
|
|
||||||
frozenset(
|
frozenset(
|
||||||
{
|
{
|
||||||
("tmdb", "125928"),
|
("tmdb", "125928"),
|
||||||
|
|
@ -215,31 +205,29 @@ tv_shows_watched_list_2 = {
|
||||||
),
|
),
|
||||||
("title", "My Adventures with Superman"),
|
("title", "My Adventures with Superman"),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
1: [
|
{
|
||||||
{
|
"tvdb": "8438181",
|
||||||
"tvdb": "8438181",
|
"imdb": "tt15699926",
|
||||||
"imdb": "tt15699926",
|
"title": "Adventures of a Normal Man (1)",
|
||||||
"title": "Adventures of a Normal Man (1)",
|
"locations": ("S01E01.mkv",),
|
||||||
"locations": ("S01E01.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
{
|
||||||
{
|
"tvdb": "9829910",
|
||||||
"tvdb": "9829910",
|
"imdb": "tt20413322",
|
||||||
"imdb": "tt20413322",
|
"title": "Adventures of a Normal Man (2)",
|
||||||
"title": "Adventures of a Normal Man (2)",
|
"locations": ("S01E02.mkv",),
|
||||||
"locations": ("S01E02.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
{
|
||||||
{
|
"tvdb": "9870382",
|
||||||
"tvdb": "9870382",
|
"imdb": "tt20413328",
|
||||||
"imdb": "tt20413328",
|
"title": "My Interview with Superman",
|
||||||
"title": "My Interview with Superman",
|
"locations": ("S01E03.mkv",),
|
||||||
"locations": ("S01E03.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
],
|
||||||
]
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
expected_tv_show_watched_list_1 = {
|
expected_tv_show_watched_list_1 = {
|
||||||
|
|
@ -251,26 +239,24 @@ expected_tv_show_watched_list_1 = {
|
||||||
("tvdb", "78804"),
|
("tvdb", "78804"),
|
||||||
("title", "Doctor Who (2005)"),
|
("title", "Doctor Who (2005)"),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
1: [
|
{
|
||||||
{
|
"imdb": "tt0563001",
|
||||||
"imdb": "tt0563001",
|
"tmdb": "968589",
|
||||||
"tmdb": "968589",
|
"tvdb": "295296",
|
||||||
"tvdb": "295296",
|
"title": "The Unquiet Dead",
|
||||||
"title": "The Unquiet Dead",
|
"locations": ("S01E03.mkv",),
|
||||||
"locations": ("S01E03.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
{
|
||||||
{
|
"imdb": "tt0562985",
|
||||||
"imdb": "tt0562985",
|
"tmdb": "968590",
|
||||||
"tmdb": "968590",
|
"tvdb": "295297",
|
||||||
"tvdb": "295297",
|
"title": "Aliens of London (1)",
|
||||||
"title": "Aliens of London (1)",
|
"locations": ("S01E04.mkv",),
|
||||||
"locations": ("S01E04.mkv",),
|
"status": {"completed": False, "time": 240000},
|
||||||
"status": {"completed": False, "time": 240000},
|
},
|
||||||
},
|
],
|
||||||
]
|
|
||||||
},
|
|
||||||
frozenset(
|
frozenset(
|
||||||
{
|
{
|
||||||
("title", "Monarch: Legacy of Monsters"),
|
("title", "Monarch: Legacy of Monsters"),
|
||||||
|
|
@ -282,26 +268,24 @@ expected_tv_show_watched_list_1 = {
|
||||||
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
|
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
1: [
|
{
|
||||||
{
|
"imdb": "tt21255044",
|
||||||
"imdb": "tt21255044",
|
"tmdb": "4661246",
|
||||||
"tmdb": "4661246",
|
"tvdb": "10009418",
|
||||||
"tvdb": "10009418",
|
"title": "Secrets and Lies",
|
||||||
"title": "Secrets and Lies",
|
"locations": ("S01E03.mkv",),
|
||||||
"locations": ("S01E03.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
{
|
||||||
{
|
"imdb": "tt21255050",
|
||||||
"imdb": "tt21255050",
|
"tmdb": "4712059",
|
||||||
"tmdb": "4712059",
|
"tvdb": "10009419",
|
||||||
"tvdb": "10009419",
|
"title": "Parallels and Interiors",
|
||||||
"title": "Parallels and Interiors",
|
"locations": ("S01E04.mkv",),
|
||||||
"locations": ("S01E04.mkv",),
|
"status": {"completed": False, "time": 240000},
|
||||||
"status": {"completed": False, "time": 240000},
|
},
|
||||||
},
|
],
|
||||||
]
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
expected_tv_show_watched_list_2 = {
|
expected_tv_show_watched_list_2 = {
|
||||||
|
|
@ -314,24 +298,22 @@ expected_tv_show_watched_list_2 = {
|
||||||
("tvdb", "78804"),
|
("tvdb", "78804"),
|
||||||
("tvrage", "3332"),
|
("tvrage", "3332"),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
1: [
|
{
|
||||||
{
|
"tvdb": "295294",
|
||||||
"tvdb": "295294",
|
"imdb": "tt0562992",
|
||||||
"imdb": "tt0562992",
|
"title": "Rose",
|
||||||
"title": "Rose",
|
"locations": ("S01E01.mkv",),
|
||||||
"locations": ("S01E01.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
{
|
||||||
{
|
"tvdb": "295295",
|
||||||
"tvdb": "295295",
|
"imdb": "tt0562997",
|
||||||
"imdb": "tt0562997",
|
"title": "The End of the World",
|
||||||
"title": "The End of the World",
|
"locations": ("S01E02.mkv",),
|
||||||
"locations": ("S01E02.mkv",),
|
"status": {"completed": False, "time": 300670},
|
||||||
"status": {"completed": False, "time": 300670},
|
},
|
||||||
},
|
],
|
||||||
]
|
|
||||||
},
|
|
||||||
frozenset(
|
frozenset(
|
||||||
{
|
{
|
||||||
("title", "Monarch: Legacy of Monsters"),
|
("title", "Monarch: Legacy of Monsters"),
|
||||||
|
|
@ -343,24 +325,22 @@ expected_tv_show_watched_list_2 = {
|
||||||
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
|
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
1: [
|
{
|
||||||
{
|
"tvdb": "9959300",
|
||||||
"tvdb": "9959300",
|
"imdb": "tt20412166",
|
||||||
"imdb": "tt20412166",
|
"title": "Aftermath",
|
||||||
"title": "Aftermath",
|
"locations": ("S01E01.mkv",),
|
||||||
"locations": ("S01E01.mkv",),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
},
|
||||||
},
|
{
|
||||||
{
|
"tvdb": "10009417",
|
||||||
"tvdb": "10009417",
|
"imdb": "tt22866594",
|
||||||
"imdb": "tt22866594",
|
"title": "Departure",
|
||||||
"title": "Departure",
|
"locations": ("S01E02.mkv",),
|
||||||
"locations": ("S01E02.mkv",),
|
"status": {"completed": False, "time": 300741},
|
||||||
"status": {"completed": False, "time": 300741},
|
},
|
||||||
},
|
],
|
||||||
]
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
movies_watched_list_1 = [
|
movies_watched_list_1 = [
|
||||||
|
|
@ -463,20 +443,16 @@ tv_shows_2_watched_list_1 = {
|
||||||
("locations", ("Criminal Minds",)),
|
("locations", ("Criminal Minds",)),
|
||||||
("tmdb", "4057"),
|
("tmdb", "4057"),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
"Season 1": [
|
{
|
||||||
{
|
"imdb": "tt0550489",
|
||||||
"imdb": "tt0550489",
|
"tmdb": "282843",
|
||||||
"tmdb": "282843",
|
"tvdb": "176357",
|
||||||
"tvdb": "176357",
|
"title": "Extreme Aggressor",
|
||||||
"title": "Extreme Aggressor",
|
"locations": ("Criminal Minds S01E01 Extreme Aggressor WEBDL-720p.mkv",),
|
||||||
"locations": (
|
"status": {"completed": True, "time": 0},
|
||||||
"Criminal Minds S01E01 Extreme Aggressor WEBDL-720p.mkv",
|
},
|
||||||
),
|
]
|
||||||
"status": {"completed": True, "time": 0},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -610,18 +586,16 @@ def test_combine_watched_dicts():
|
||||||
("locations", ("11.22.63",)),
|
("locations", ("11.22.63",)),
|
||||||
("imdb", "tt2879552"),
|
("imdb", "tt2879552"),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
"Season 1": [
|
{
|
||||||
{
|
"imdb": "tt4460418",
|
||||||
"imdb": "tt4460418",
|
"title": "The Rabbit Hole",
|
||||||
"title": "The Rabbit Hole",
|
"locations": (
|
||||||
"locations": (
|
"11.22.63 S01E01 The Rabbit Hole Bluray-1080p.mkv",
|
||||||
"11.22.63 S01E01 The Rabbit Hole Bluray-1080p.mkv",
|
),
|
||||||
),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
}
|
||||||
}
|
]
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -664,18 +638,16 @@ def test_combine_watched_dicts():
|
||||||
("locations", ("11.22.63",)),
|
("locations", ("11.22.63",)),
|
||||||
("imdb", "tt2879552"),
|
("imdb", "tt2879552"),
|
||||||
}
|
}
|
||||||
): {
|
): [
|
||||||
"Season 1": [
|
{
|
||||||
{
|
"imdb": "tt4460418",
|
||||||
"imdb": "tt4460418",
|
"title": "The Rabbit Hole",
|
||||||
"title": "The Rabbit Hole",
|
"locations": (
|
||||||
"locations": (
|
"11.22.63 S01E01 The Rabbit Hole Bluray-1080p.mkv",
|
||||||
"11.22.63 S01E01 The Rabbit Hole Bluray-1080p.mkv",
|
),
|
||||||
),
|
"status": {"completed": True, "time": 0},
|
||||||
"status": {"completed": True, "time": 0},
|
}
|
||||||
}
|
]
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"Subbed Anime": {},
|
"Subbed Anime": {},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,65 +73,30 @@ def check_marklog(lines, expected_values):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
expected = {
|
expected_jellyfin = [
|
||||||
"dry": [
|
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||||
# Jellyfin -> Plex
|
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
|
||||||
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
||||||
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
|
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/300670",
|
||||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
|
||||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/300670",
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/300741",
|
||||||
|
"jellyplex_watched/Movies/The Family Plan",
|
||||||
|
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||||
|
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/5",
|
||||||
|
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
||||||
|
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/5",
|
||||||
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/5",
|
||||||
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/The Way Out",
|
||||||
|
]
|
||||||
|
expected_emby = [
|
||||||
|
"jellyplex_watched/Movies/Tears of Steel",
|
||||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
|
||||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/300741",
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429",
|
||||||
# Plex -> Jellyfin
|
|
||||||
"JellyUser/Movies/Big Buck Bunny",
|
|
||||||
"JellyUser/Movies/Killers of the Flower Moon/4",
|
|
||||||
"JellyUser/Shows/Doctor Who/The Unquiet Dead",
|
|
||||||
"JellyUser/Shows/Doctor Who/Aliens of London (1)/4",
|
|
||||||
"JellyUser/Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
|
||||||
"JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
|
||||||
# Emby -> Plex
|
|
||||||
"jellyplex_watched/Movies/Tears of Steel",
|
|
||||||
"jellyplex_watched/TV shows/Doctor Who (2005)/World War Three (2)",
|
|
||||||
"jellyplex_watched/TV shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429",
|
|
||||||
# Plex -> Emby
|
|
||||||
"jellyplex_watched/Movies/Big Buck Bunny",
|
|
||||||
"jellyplex_watched/Movies/The Family Plan",
|
|
||||||
"jellyplex_watched/Movies/Killers of the Flower Moon/4",
|
|
||||||
# Emby -> Jellyfin
|
|
||||||
"JellyUser/Movies/Tears of Steel",
|
|
||||||
# Jellyfin -> Emby
|
|
||||||
"jellyplex_watched/Movies/The Family Plan",
|
|
||||||
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
|
||||||
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/5",
|
|
||||||
],
|
|
||||||
"write": [
|
|
||||||
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
|
||||||
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
|
|
||||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
|
||||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/300670",
|
|
||||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
|
|
||||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/300741",
|
|
||||||
"JellyUser/Movies/Big Buck Bunny",
|
|
||||||
"JellyUser/Movies/Killers of the Flower Moon/4",
|
|
||||||
"JellyUser/Shows/Doctor Who/The Unquiet Dead",
|
|
||||||
"JellyUser/Shows/Doctor Who/Aliens of London (1)/4",
|
|
||||||
"JellyUser/Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
|
||||||
"JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
|
||||||
"jellyplex_watched/Movies/Tears of Steel",
|
|
||||||
"jellyplex_watched/TV shows/Doctor Who (2005)/World War Three (2)",
|
|
||||||
"jellyplex_watched/TV shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429",
|
|
||||||
"jellyplex_watched/Movies/Big Buck Bunny",
|
|
||||||
"jellyplex_watched/Movies/The Family Plan",
|
|
||||||
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
|
||||||
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/5",
|
|
||||||
"jellyplex_watched/Movies/Killers of the Flower Moon/4",
|
|
||||||
"JellyUser/Movies/Tears of Steel",
|
"JellyUser/Movies/Tears of Steel",
|
||||||
"JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
"JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
||||||
"jellyplex_watched/TV shows/Doctor Who (2005)/World War Three (2)",
|
]
|
||||||
"jellyplex_watched/TV shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429",
|
expected_plex = [
|
||||||
],
|
"JellyUser/Movies/Big Buck Bunny",
|
||||||
"plex": [
|
|
||||||
"JellyUser/Movies/Big Buck Bunny",
|
|
||||||
"JellyUser/Movies/Killers of the Flower Moon/4",
|
"JellyUser/Movies/Killers of the Flower Moon/4",
|
||||||
"JellyUser/Shows/Doctor Who/The Unquiet Dead",
|
"JellyUser/Shows/Doctor Who/The Unquiet Dead",
|
||||||
"JellyUser/Shows/Doctor Who/Aliens of London (1)/4",
|
"JellyUser/Shows/Doctor Who/Aliens of London (1)/4",
|
||||||
|
|
@ -140,39 +105,58 @@ def main():
|
||||||
"jellyplex_watched/Movies/Big Buck Bunny",
|
"jellyplex_watched/Movies/Big Buck Bunny",
|
||||||
"jellyplex_watched/Movies/The Family Plan",
|
"jellyplex_watched/Movies/The Family Plan",
|
||||||
"jellyplex_watched/Movies/Killers of the Flower Moon/4",
|
"jellyplex_watched/Movies/Killers of the Flower Moon/4",
|
||||||
],
|
"jellyplex_watched/TV Shows/Doctor Who (2005)/The Unquiet Dead",
|
||||||
"jellyfin": [
|
"jellyplex_watched/TV Shows/Doctor Who (2005)/Aliens of London (1)/4",
|
||||||
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
||||||
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/The Way Out",
|
||||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
]
|
||||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/300670",
|
|
||||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
|
expected_dry = expected_emby + expected_plex + expected_jellyfin
|
||||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/300741",
|
|
||||||
"jellyplex_watched/Movies/The Family Plan",
|
expected_write = [
|
||||||
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||||
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/5",
|
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
|
||||||
],
|
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
||||||
"emby": [
|
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/300670",
|
||||||
"jellyplex_watched/Movies/Tears of Steel",
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
|
||||||
"jellyplex_watched/TV shows/Doctor Who (2005)/World War Three (2)",
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/300741",
|
||||||
"jellyplex_watched/TV shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429",
|
"JellyUser/Movies/Big Buck Bunny",
|
||||||
"JellyUser/Movies/Tears of Steel",
|
"JellyUser/Movies/Killers of the Flower Moon/4",
|
||||||
],
|
"JellyUser/Shows/Doctor Who/The Unquiet Dead",
|
||||||
}
|
"JellyUser/Shows/Doctor Who/Aliens of London (1)/4",
|
||||||
|
"JellyUser/Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
||||||
|
"JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
||||||
|
"jellyplex_watched/Movies/Tears of Steel",
|
||||||
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429",
|
||||||
|
"jellyplex_watched/Movies/Big Buck Bunny",
|
||||||
|
"jellyplex_watched/Movies/The Family Plan",
|
||||||
|
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||||
|
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/5",
|
||||||
|
"jellyplex_watched/Movies/Killers of the Flower Moon/4",
|
||||||
|
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
||||||
|
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/5",
|
||||||
|
"jellyplex_watched/TV Shows/Doctor Who (2005)/The Unquiet Dead",
|
||||||
|
"jellyplex_watched/TV Shows/Doctor Who (2005)/Aliens of London (1)/4",
|
||||||
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/5",
|
||||||
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
||||||
|
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/The Way Out",
|
||||||
|
"JellyUser/Movies/Tears of Steel",
|
||||||
|
"JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
||||||
|
]
|
||||||
|
|
||||||
# Expected values for the mark.log file, dry-run is slightly different than write-run
|
# Expected values for the mark.log file, dry-run is slightly different than write-run
|
||||||
# due to some of the items being copied over from one server to another and now being there
|
# due to some of the items being copied over from one server to another and now being there
|
||||||
# for the next server run.
|
# for the next server run.
|
||||||
if args.dry:
|
if args.dry:
|
||||||
expected_values = expected["dry"]
|
expected_values = expected_dry
|
||||||
elif args.write:
|
elif args.write:
|
||||||
expected_values = expected["write"]
|
expected_values = expected_write
|
||||||
elif args.plex:
|
elif args.plex:
|
||||||
expected_values = expected["plex"]
|
expected_values = expected_plex
|
||||||
elif args.jellyfin:
|
elif args.jellyfin:
|
||||||
expected_values = expected["jellyfin"]
|
expected_values = expected_jellyfin
|
||||||
elif args.emby:
|
elif args.emby:
|
||||||
expected_values = expected["emby"]
|
expected_values = expected_emby
|
||||||
else:
|
else:
|
||||||
print("No server specified")
|
print("No server specified")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue