Handle episode names are not unique
This commit is contained in:
11
.vscode/launch.json
vendored
11
.vscode/launch.json
vendored
@@ -11,6 +11,17 @@
|
|||||||
"program": "main.py",
|
"program": "main.py",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"justMyCode": true
|
"justMyCode": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Pytest",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"module": "pytest",
|
||||||
|
"args": [
|
||||||
|
"-vv"
|
||||||
|
],
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"justMyCode": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,9 +64,16 @@ def str_to_bool(value: any) -> bool:
|
|||||||
|
|
||||||
# Search for nested element in list
|
# Search for nested element in list
|
||||||
def contains_nested(element, lst):
|
def contains_nested(element, lst):
|
||||||
|
if lst is None:
|
||||||
|
return None
|
||||||
|
|
||||||
for i, item in enumerate(lst):
|
for i, item in enumerate(lst):
|
||||||
|
if item is None:
|
||||||
|
continue
|
||||||
if element in item:
|
if element in item:
|
||||||
return i
|
return i
|
||||||
|
elif element == item:
|
||||||
|
return i
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -168,12 +168,28 @@ def episode_title_dict(user_list: dict):
|
|||||||
episode_output_dict["completed"] = []
|
episode_output_dict["completed"] = []
|
||||||
episode_output_dict["time"] = []
|
episode_output_dict["time"] = []
|
||||||
episode_output_dict["locations"] = []
|
episode_output_dict["locations"] = []
|
||||||
|
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, seasons, and episodes in user_list
|
||||||
for show in user_list:
|
for show in user_list:
|
||||||
for season in user_list[show]:
|
for season in user_list[show]:
|
||||||
for episode in user_list[show][season]:
|
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
|
||||||
|
if "season" not in episode_output_dict:
|
||||||
|
episode_output_dict["season"] = [None] * episode_counter
|
||||||
|
|
||||||
|
# Add the show title to the episode_output_dict
|
||||||
|
episode_output_dict["show"].append(dict(show))
|
||||||
|
|
||||||
|
# Add the season number to the episode_output_dict
|
||||||
|
episode_output_dict["season"].append(season)
|
||||||
|
|
||||||
# Iterate through the keys and values in each episode
|
# Iterate through the keys and values in each episode
|
||||||
for episode_key, episode_value in episode.items():
|
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 the key is not "status", add the key to episode_output_dict if it doesn't exist
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ def cleanup_watched(
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
(
|
(
|
||||||
_,
|
show_watched_list_2_keys_dict,
|
||||||
episode_watched_list_2_keys_dict,
|
episode_watched_list_2_keys_dict,
|
||||||
movies_watched_list_2_keys_dict,
|
movies_watched_list_2_keys_dict,
|
||||||
) = generate_library_guids_dict(watched_list_2[user_2][library_2])
|
) = generate_library_guids_dict(watched_list_2[user_2][library_2])
|
||||||
@@ -123,11 +123,18 @@ def cleanup_watched(
|
|||||||
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]:
|
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
|
||||||
|
# where episode location names are not unique such as S01E01.mkv
|
||||||
|
filtered_episode_watched_list_2_keys_dict = (
|
||||||
|
filter_episode_watched_list_2_keys_dict(
|
||||||
|
episode_watched_list_2_keys_dict, show_key_dict, season
|
||||||
|
)
|
||||||
|
)
|
||||||
for episode in watched_list_1[user_1][library_1][show_key_1][
|
for episode in watched_list_1[user_1][library_1][show_key_1][
|
||||||
season
|
season
|
||||||
]:
|
]:
|
||||||
episode_index = get_episode_index_in_dict(
|
episode_index = get_episode_index_in_dict(
|
||||||
episode, 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(
|
||||||
@@ -223,6 +230,56 @@ def get_movie_index_in_dict(movie, movies_watched_list_2_keys_dict):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def filter_episode_watched_list_2_keys_dict(
|
||||||
|
episode_watched_list_2_keys_dict, show_key_dict, season
|
||||||
|
):
|
||||||
|
# Filter the episode_watched_list_2_keys_dict dictionary to only include values for the correct show and season
|
||||||
|
filtered_episode_watched_list_2_keys_dict = {}
|
||||||
|
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["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
|
||||||
|
for show_index, show_value in enumerate(episode_watched_list_2_keys_dict["show"]):
|
||||||
|
# Iterate through the keys and values of the show_value dictionary and check if they match show_key_dict
|
||||||
|
for show_key, show_key_value in show_value.items():
|
||||||
|
if show_key == "locations":
|
||||||
|
# Iterate through the locations in the show_value dictionary
|
||||||
|
for location in show_key_value:
|
||||||
|
# If the location is in the episode_watched_list_2_keys_dict dictionary, return index of the key
|
||||||
|
if (
|
||||||
|
contains_nested(location, show_key_dict["locations"])
|
||||||
|
is not None
|
||||||
|
):
|
||||||
|
show_indecies.append(show_index)
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
if show_key in show_key_dict.keys():
|
||||||
|
if show_key_value == show_key_dict[show_key]:
|
||||||
|
show_indecies.append(show_index)
|
||||||
|
break
|
||||||
|
|
||||||
|
# Find the intersection of the show_indecies and season_indecies lists
|
||||||
|
indecies = list(set(show_indecies) & set(season_indecies))
|
||||||
|
|
||||||
|
# Create a copy of the dictionary with indecies that match the show and season and none that don't
|
||||||
|
filtered_episode_watched_list_2_keys_dict = copy.deepcopy(
|
||||||
|
episode_watched_list_2_keys_dict
|
||||||
|
)
|
||||||
|
for key, value in filtered_episode_watched_list_2_keys_dict.items():
|
||||||
|
for index, item in enumerate(value):
|
||||||
|
if index not in indecies:
|
||||||
|
filtered_episode_watched_list_2_keys_dict[key][index] = None
|
||||||
|
|
||||||
|
return filtered_episode_watched_list_2_keys_dict
|
||||||
|
|
||||||
|
|
||||||
def get_episode_index_in_dict(episode, episode_watched_list_2_keys_dict):
|
def get_episode_index_in_dict(episode, episode_watched_list_2_keys_dict):
|
||||||
# Iterate through the keys and values of the episode dictionary
|
# Iterate through the keys and values of the episode dictionary
|
||||||
for episode_key, episode_value in episode.items():
|
for episode_key, episode_value in episode.items():
|
||||||
|
|||||||
@@ -83,6 +83,16 @@ episode_titles = {
|
|||||||
"tvdb": ["8444132"],
|
"tvdb": ["8444132"],
|
||||||
"completed": [True],
|
"completed": [True],
|
||||||
"time": [0],
|
"time": [0],
|
||||||
|
"season": ["Season 1"],
|
||||||
|
"show": [
|
||||||
|
{
|
||||||
|
"imdb": "tt3581920",
|
||||||
|
"locations": ("The Last of Us",),
|
||||||
|
"title": "The Last of Us",
|
||||||
|
"tmdb": "100088",
|
||||||
|
"tvdb": "392256",
|
||||||
|
}
|
||||||
|
],
|
||||||
}
|
}
|
||||||
movie_titles = {
|
movie_titles = {
|
||||||
"imdb": ["tt2380307"],
|
"imdb": ["tt2380307"],
|
||||||
|
|||||||
@@ -18,102 +18,225 @@ from src.watched import cleanup_watched, combine_watched_dicts
|
|||||||
tv_shows_watched_list_1 = {
|
tv_shows_watched_list_1 = {
|
||||||
frozenset(
|
frozenset(
|
||||||
{
|
{
|
||||||
("tvdb", "75710"),
|
("locations", ("Doctor Who (2005) {tvdb-78804} {imdb-tt0436992}",)),
|
||||||
("title", "Criminal Minds"),
|
("imdb", "tt0436992"),
|
||||||
("imdb", "tt0452046"),
|
("tmdb", "57243"),
|
||||||
("locations", ("Criminal Minds",)),
|
("tvdb", "78804"),
|
||||||
("tmdb", "4057"),
|
("title", "Doctor Who (2005)"),
|
||||||
}
|
}
|
||||||
): {
|
): {
|
||||||
"Season 1": [
|
1: [
|
||||||
{
|
{
|
||||||
"imdb": "tt0550489",
|
"imdb": "tt0563001",
|
||||||
"tmdb": "282843",
|
"tmdb": "968589",
|
||||||
"tvdb": "176357",
|
"tvdb": "295296",
|
||||||
"title": "Extreme Aggressor",
|
"title": "The Unquiet Dead",
|
||||||
"locations": (
|
"locations": ("S01E03.mkv",),
|
||||||
"Criminal Minds S01E01 Extreme Aggressor WEBDL-720p.mkv",
|
|
||||||
),
|
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"imdb": "tt0550487",
|
"imdb": "tt0562985",
|
||||||
"tmdb": "282861",
|
"tmdb": "968590",
|
||||||
"tvdb": "300385",
|
"tvdb": "295297",
|
||||||
"title": "Compulsion",
|
"title": "Aliens of London (1)",
|
||||||
"locations": ("Criminal Minds S01E02 Compulsion WEBDL-720p.mkv",),
|
"locations": ("S01E04.mkv",),
|
||||||
|
"status": {"completed": False, "time": 240000},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"imdb": "tt0563003",
|
||||||
|
"tmdb": "968592",
|
||||||
|
"tvdb": "295298",
|
||||||
|
"title": "World War Three (2)",
|
||||||
|
"locations": ("S01E05.mkv",),
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
frozenset({("title", "Test"), ("locations", ("Test",))}): {
|
frozenset(
|
||||||
"Season 1": [
|
{
|
||||||
|
("title", "Monarch: Legacy of Monsters"),
|
||||||
|
("imdb", "tt17220216"),
|
||||||
|
("tvdb", "422598"),
|
||||||
|
("tmdb", "202411"),
|
||||||
|
(
|
||||||
|
"locations",
|
||||||
|
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
): {
|
||||||
|
1: [
|
||||||
{
|
{
|
||||||
"title": "S01E01",
|
"imdb": "tt21255044",
|
||||||
"locations": ("Test S01E01.mkv",),
|
"tmdb": "4661246",
|
||||||
|
"tvdb": "10009418",
|
||||||
|
"title": "Secrets and Lies",
|
||||||
|
"locations": ("S01E03.mkv",),
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "S01E02",
|
"imdb": "tt21255050",
|
||||||
"locations": ("Test S01E02.mkv",),
|
"tmdb": "4712059",
|
||||||
|
"tvdb": "10009419",
|
||||||
|
"title": "Parallels and Interiors",
|
||||||
|
"locations": ("S01E04.mkv",),
|
||||||
|
"status": {"completed": False, "time": 240000},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"imdb": "tt23787572",
|
||||||
|
"tmdb": "4712061",
|
||||||
|
"tvdb": "10009420",
|
||||||
|
"title": "The Way Out",
|
||||||
|
"locations": ("S01E05.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
frozenset(
|
||||||
|
{
|
||||||
|
("tmdb", "125928"),
|
||||||
|
("imdb", "tt14681924"),
|
||||||
|
("tvdb", "403172"),
|
||||||
|
(
|
||||||
|
"locations",
|
||||||
|
("My Adventures with Superman {tvdb-403172} {imdb-tt14681924}",),
|
||||||
|
),
|
||||||
|
("title", "My Adventures with Superman"),
|
||||||
|
}
|
||||||
|
): {
|
||||||
|
1: [
|
||||||
|
{
|
||||||
|
"imdb": "tt15699926",
|
||||||
|
"tmdb": "3070048",
|
||||||
|
"tvdb": "8438181",
|
||||||
|
"title": "Adventures of a Normal Man (1)",
|
||||||
|
"locations": ("S01E01.mkv",),
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "S01E04",
|
"imdb": "tt20413322",
|
||||||
"locations": ("Test S01E04.mkv",),
|
"tmdb": "4568681",
|
||||||
"status": {"completed": False, "time": 5},
|
"tvdb": "9829910",
|
||||||
|
"title": "Adventures of a Normal Man (2)",
|
||||||
|
"locations": ("S01E02.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"imdb": "tt20413328",
|
||||||
|
"tmdb": "4497012",
|
||||||
|
"tvdb": "9870382",
|
||||||
|
"title": "My Interview with Superman",
|
||||||
|
"locations": ("S01E03.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tv_shows_watched_list_2 = {
|
tv_shows_watched_list_2 = {
|
||||||
frozenset(
|
frozenset(
|
||||||
{
|
{
|
||||||
("tvdb", "75710"),
|
("locations", ("Doctor Who (2005) {tvdb-78804} {imdb-tt0436992}",)),
|
||||||
("title", "Criminal Minds"),
|
("imdb", "tt0436992"),
|
||||||
("imdb", "tt0452046"),
|
("tmdb", "57243"),
|
||||||
("locations", ("Criminal Minds",)),
|
("title", "Doctor Who"),
|
||||||
("tmdb", "4057"),
|
("tvdb", "78804"),
|
||||||
|
("tvrage", "3332"),
|
||||||
}
|
}
|
||||||
): {
|
): {
|
||||||
"Season 1": [
|
1: [
|
||||||
{
|
{
|
||||||
"imdb": "tt0550487",
|
"tvdb": "295294",
|
||||||
"tmdb": "282861",
|
"imdb": "tt0562992",
|
||||||
"tvdb": "300385",
|
"title": "Rose",
|
||||||
"title": "Compulsion",
|
"locations": ("S01E01.mkv",),
|
||||||
"locations": ("Criminal Minds S01E02 Compulsion WEBDL-720p.mkv",),
|
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"imdb": "tt0550498",
|
"tvdb": "295295",
|
||||||
"tmdb": "282865",
|
"imdb": "tt0562997",
|
||||||
"tvdb": "300474",
|
"title": "The End of the World",
|
||||||
"title": "Won't Get Fooled Again",
|
"locations": ("S01E02.mkv",),
|
||||||
"locations": (
|
"status": {"completed": False, "time": 300670},
|
||||||
"Criminal Minds S01E03 Won't Get Fooled Again WEBDL-720p.mkv",
|
},
|
||||||
),
|
{
|
||||||
|
"tvdb": "295298",
|
||||||
|
"imdb": "tt0563003",
|
||||||
|
"title": "World War Three (2)",
|
||||||
|
"locations": ("S01E05.mkv",),
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
frozenset({("title", "Test"), ("locations", ("Test",))}): {
|
frozenset(
|
||||||
"Season 1": [
|
{
|
||||||
|
("title", "Monarch: Legacy of Monsters"),
|
||||||
|
("imdb", "tt17220216"),
|
||||||
|
("tvdb", "422598"),
|
||||||
|
("tmdb", "202411"),
|
||||||
|
(
|
||||||
|
"locations",
|
||||||
|
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
): {
|
||||||
|
1: [
|
||||||
{
|
{
|
||||||
"title": "S01E02",
|
"tvdb": "9959300",
|
||||||
"locations": ("Test S01E02.mkv",),
|
"imdb": "tt20412166",
|
||||||
"status": {"completed": False, "time": 10},
|
"title": "Aftermath",
|
||||||
},
|
"locations": ("S01E01.mkv",),
|
||||||
{
|
|
||||||
"title": "S01E03",
|
|
||||||
"locations": ("Test S01E03.mkv",),
|
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "S01E04",
|
"tvdb": "10009417",
|
||||||
"locations": ("Test S01E04.mkv",),
|
"imdb": "tt22866594",
|
||||||
"status": {"completed": False, "time": 10},
|
"title": "Departure",
|
||||||
|
"locations": ("S01E02.mkv",),
|
||||||
|
"status": {"completed": False, "time": 300741},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tvdb": "10009420",
|
||||||
|
"imdb": "tt23787572",
|
||||||
|
"title": "The Way Out",
|
||||||
|
"locations": ("S01E05.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
frozenset(
|
||||||
|
{
|
||||||
|
("tmdb", "125928"),
|
||||||
|
("imdb", "tt14681924"),
|
||||||
|
("tvdb", "403172"),
|
||||||
|
(
|
||||||
|
"locations",
|
||||||
|
("My Adventures with Superman {tvdb-403172} {imdb-tt14681924}",),
|
||||||
|
),
|
||||||
|
("title", "My Adventures with Superman"),
|
||||||
|
}
|
||||||
|
): {
|
||||||
|
1: [
|
||||||
|
{
|
||||||
|
"tvdb": "8438181",
|
||||||
|
"imdb": "tt15699926",
|
||||||
|
"title": "Adventures of a Normal Man (1)",
|
||||||
|
"locations": ("S01E01.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tvdb": "9829910",
|
||||||
|
"imdb": "tt20413322",
|
||||||
|
"title": "Adventures of a Normal Man (2)",
|
||||||
|
"locations": ("S01E02.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tvdb": "9870382",
|
||||||
|
"imdb": "tt20413328",
|
||||||
|
"title": "My Interview with Superman",
|
||||||
|
"locations": ("S01E03.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -122,38 +245,61 @@ tv_shows_watched_list_2 = {
|
|||||||
expected_tv_show_watched_list_1 = {
|
expected_tv_show_watched_list_1 = {
|
||||||
frozenset(
|
frozenset(
|
||||||
{
|
{
|
||||||
("tvdb", "75710"),
|
("locations", ("Doctor Who (2005) {tvdb-78804} {imdb-tt0436992}",)),
|
||||||
("title", "Criminal Minds"),
|
("imdb", "tt0436992"),
|
||||||
("imdb", "tt0452046"),
|
("tmdb", "57243"),
|
||||||
("locations", ("Criminal Minds",)),
|
("tvdb", "78804"),
|
||||||
("tmdb", "4057"),
|
("title", "Doctor Who (2005)"),
|
||||||
}
|
}
|
||||||
): {
|
): {
|
||||||
"Season 1": [
|
1: [
|
||||||
{
|
{
|
||||||
"imdb": "tt0550489",
|
"imdb": "tt0563001",
|
||||||
"tmdb": "282843",
|
"tmdb": "968589",
|
||||||
"tvdb": "176357",
|
"tvdb": "295296",
|
||||||
"title": "Extreme Aggressor",
|
"title": "The Unquiet Dead",
|
||||||
"locations": (
|
"locations": ("S01E03.mkv",),
|
||||||
"Criminal Minds S01E01 Extreme Aggressor WEBDL-720p.mkv",
|
|
||||||
),
|
|
||||||
"status": {"completed": True, "time": 0},
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
frozenset({("title", "Test"), ("locations", ("Test",))}): {
|
|
||||||
"Season 1": [
|
|
||||||
{
|
|
||||||
"title": "S01E01",
|
|
||||||
"locations": ("Test S01E01.mkv",),
|
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "S01E02",
|
"imdb": "tt0562985",
|
||||||
"locations": ("Test S01E02.mkv",),
|
"tmdb": "968590",
|
||||||
|
"tvdb": "295297",
|
||||||
|
"title": "Aliens of London (1)",
|
||||||
|
"locations": ("S01E04.mkv",),
|
||||||
|
"status": {"completed": False, "time": 240000},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
frozenset(
|
||||||
|
{
|
||||||
|
("title", "Monarch: Legacy of Monsters"),
|
||||||
|
("imdb", "tt17220216"),
|
||||||
|
("tvdb", "422598"),
|
||||||
|
("tmdb", "202411"),
|
||||||
|
(
|
||||||
|
"locations",
|
||||||
|
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
): {
|
||||||
|
1: [
|
||||||
|
{
|
||||||
|
"imdb": "tt21255044",
|
||||||
|
"tmdb": "4661246",
|
||||||
|
"tvdb": "10009418",
|
||||||
|
"title": "Secrets and Lies",
|
||||||
|
"locations": ("S01E03.mkv",),
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"imdb": "tt21255050",
|
||||||
|
"tmdb": "4712059",
|
||||||
|
"tvdb": "10009419",
|
||||||
|
"title": "Parallels and Interiors",
|
||||||
|
"locations": ("S01E04.mkv",),
|
||||||
|
"status": {"completed": False, "time": 240000},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -161,37 +307,57 @@ expected_tv_show_watched_list_1 = {
|
|||||||
expected_tv_show_watched_list_2 = {
|
expected_tv_show_watched_list_2 = {
|
||||||
frozenset(
|
frozenset(
|
||||||
{
|
{
|
||||||
("tvdb", "75710"),
|
("locations", ("Doctor Who (2005) {tvdb-78804} {imdb-tt0436992}",)),
|
||||||
("title", "Criminal Minds"),
|
("imdb", "tt0436992"),
|
||||||
("imdb", "tt0452046"),
|
("tmdb", "57243"),
|
||||||
("locations", ("Criminal Minds",)),
|
("title", "Doctor Who"),
|
||||||
("tmdb", "4057"),
|
("tvdb", "78804"),
|
||||||
|
("tvrage", "3332"),
|
||||||
}
|
}
|
||||||
): {
|
): {
|
||||||
"Season 1": [
|
1: [
|
||||||
{
|
{
|
||||||
"imdb": "tt0550498",
|
"tvdb": "295294",
|
||||||
"tmdb": "282865",
|
"imdb": "tt0562992",
|
||||||
"tvdb": "300474",
|
"title": "Rose",
|
||||||
"title": "Won't Get Fooled Again",
|
"locations": ("S01E01.mkv",),
|
||||||
"locations": (
|
|
||||||
"Criminal Minds S01E03 Won't Get Fooled Again WEBDL-720p.mkv",
|
|
||||||
),
|
|
||||||
"status": {"completed": True, "time": 0},
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
frozenset({("title", "Test"), ("locations", ("Test",))}): {
|
|
||||||
"Season 1": [
|
|
||||||
{
|
|
||||||
"title": "S01E03",
|
|
||||||
"locations": ("Test S01E03.mkv",),
|
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "S01E04",
|
"tvdb": "295295",
|
||||||
"locations": ("Test S01E04.mkv",),
|
"imdb": "tt0562997",
|
||||||
"status": {"completed": False, "time": 10},
|
"title": "The End of the World",
|
||||||
|
"locations": ("S01E02.mkv",),
|
||||||
|
"status": {"completed": False, "time": 300670},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
frozenset(
|
||||||
|
{
|
||||||
|
("title", "Monarch: Legacy of Monsters"),
|
||||||
|
("imdb", "tt17220216"),
|
||||||
|
("tvdb", "422598"),
|
||||||
|
("tmdb", "202411"),
|
||||||
|
(
|
||||||
|
"locations",
|
||||||
|
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
): {
|
||||||
|
1: [
|
||||||
|
{
|
||||||
|
"tvdb": "9959300",
|
||||||
|
"imdb": "tt20412166",
|
||||||
|
"title": "Aftermath",
|
||||||
|
"locations": ("S01E01.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tvdb": "10009417",
|
||||||
|
"imdb": "tt22866594",
|
||||||
|
"title": "Departure",
|
||||||
|
"locations": ("S01E02.mkv",),
|
||||||
|
"status": {"completed": False, "time": 300741},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -199,61 +365,92 @@ expected_tv_show_watched_list_2 = {
|
|||||||
|
|
||||||
movies_watched_list_1 = [
|
movies_watched_list_1 = [
|
||||||
{
|
{
|
||||||
"imdb": "tt2380307",
|
"imdb": "tt1254207",
|
||||||
"tmdb": "354912",
|
"tmdb": "10378",
|
||||||
"title": "Coco",
|
"tvdb": "12352",
|
||||||
"locations": ("Coco (2017) Remux-1080p.mkv",),
|
"title": "Big Buck Bunny",
|
||||||
|
"locations": ("Big Buck Bunny.mkv",),
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tmdbcollection": "448150",
|
"imdb": "tt16431870",
|
||||||
"imdb": "tt1431045",
|
"tmdb": "1029575",
|
||||||
"tmdb": "293660",
|
"tvdb": "351194",
|
||||||
"title": "Deadpool",
|
"title": "The Family Plan",
|
||||||
"locations": ("Deadpool (2016) Remux-1080p.mkv",),
|
"locations": ("The Family Plan (2023).mkv",),
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"imdb": "tt5537002",
|
||||||
|
"tmdb": "466420",
|
||||||
|
"tvdb": "135852",
|
||||||
|
"title": "Killers of the Flower Moon",
|
||||||
|
"locations": ("Killers of the Flower Moon (2023).mkv",),
|
||||||
|
"status": {"completed": False, "time": 240000},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
movies_watched_list_2 = [
|
movies_watched_list_2 = [
|
||||||
{
|
{
|
||||||
"imdb": "tt2380307",
|
"imdb": "tt16431870",
|
||||||
"tmdb": "354912",
|
"tmdb": "1029575",
|
||||||
"title": "Coco",
|
"title": "The Family Plan",
|
||||||
"locations": ("Coco (2017) Remux-1080p.mkv",),
|
"locations": ("The Family Plan (2023).mkv",),
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"imdb": "tt0384793",
|
"imdb": "tt4589218",
|
||||||
"tmdb": "9788",
|
"tmdb": "507089",
|
||||||
"tvdb": "9103",
|
"title": "Five Nights at Freddy's",
|
||||||
"title": "Accepted",
|
"locations": ("Five Nights at Freddy's (2023).mkv",),
|
||||||
"locations": ("Accepted (2006) Remux-1080p.mkv",),
|
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"imdb": "tt10545296",
|
||||||
|
"tmdb": "695721",
|
||||||
|
"tmdbcollection": "131635",
|
||||||
|
"title": "The Hunger Games: The Ballad of Songbirds & Snakes",
|
||||||
|
"locations": ("The Hunger Games The Ballad of Songbirds & Snakes (2023).mkv",),
|
||||||
|
"status": {"completed": False, "time": 301215},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
expected_movie_watched_list_1 = [
|
expected_movie_watched_list_1 = [
|
||||||
{
|
{
|
||||||
"tmdbcollection": "448150",
|
"imdb": "tt1254207",
|
||||||
"imdb": "tt1431045",
|
"tmdb": "10378",
|
||||||
"tmdb": "293660",
|
"tvdb": "12352",
|
||||||
"title": "Deadpool",
|
"title": "Big Buck Bunny",
|
||||||
"locations": ("Deadpool (2016) Remux-1080p.mkv",),
|
"locations": ("Big Buck Bunny.mkv",),
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"imdb": "tt5537002",
|
||||||
|
"tmdb": "466420",
|
||||||
|
"tvdb": "135852",
|
||||||
|
"title": "Killers of the Flower Moon",
|
||||||
|
"locations": ("Killers of the Flower Moon (2023).mkv",),
|
||||||
|
"status": {"completed": False, "time": 240000},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
expected_movie_watched_list_2 = [
|
expected_movie_watched_list_2 = [
|
||||||
{
|
{
|
||||||
"imdb": "tt0384793",
|
"imdb": "tt4589218",
|
||||||
"tmdb": "9788",
|
"tmdb": "507089",
|
||||||
"tvdb": "9103",
|
"title": "Five Nights at Freddy's",
|
||||||
"title": "Accepted",
|
"locations": ("Five Nights at Freddy's (2023).mkv",),
|
||||||
"locations": ("Accepted (2006) Remux-1080p.mkv",),
|
|
||||||
"status": {"completed": True, "time": 0},
|
"status": {"completed": True, "time": 0},
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"imdb": "tt10545296",
|
||||||
|
"tmdb": "695721",
|
||||||
|
"tmdbcollection": "131635",
|
||||||
|
"title": "The Hunger Games: The Ballad of Songbirds & Snakes",
|
||||||
|
"locations": ("The Hunger Games The Ballad of Songbirds & Snakes (2023).mkv",),
|
||||||
|
"status": {"completed": False, "time": 301215},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
# Test to see if objects get deleted all the way up to the root.
|
# Test to see if objects get deleted all the way up to the root.
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def read_marklog():
|
def read_marklog():
|
||||||
marklog = os.path.join(os.getcwd(), "mark.log")
|
marklog = os.path.join(os.getcwd(), "mark.log")
|
||||||
with open(marklog, "r") as f:
|
with open(marklog, "r") as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
|
|
||||||
def check_marklog(lines, expected_values):
|
def check_marklog(lines, expected_values):
|
||||||
for line in lines:
|
for line in lines:
|
||||||
# Remove the newline character
|
# Remove the newline character
|
||||||
@@ -17,11 +19,18 @@ def check_marklog(lines, expected_values):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
expected_values = [
|
expected_values = [
|
||||||
"jellyplex_watched/TV Shows/Blender Shorts/Episode 2"
|
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||||
, "JellyUser/Movies/Big Buck Bunny"
|
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
|
||||||
, "JellyUser/Shows/Blender Shorts/S01E01"
|
"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/Shows/Doctor Who/The Unquiet Dead",
|
||||||
|
"JellyUser/Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
||||||
]
|
]
|
||||||
|
|
||||||
lines = read_marklog()
|
lines = read_marklog()
|
||||||
@@ -31,5 +40,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
print("Marklog contained the expected values")
|
print("Marklog contained the expected values")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user