Take into account comparing two partially watched/one watched video
This commit is contained in:
@@ -166,15 +166,26 @@ def episode_title_dict(user_list: dict):
|
|||||||
if episode_key != "status":
|
if episode_key != "status":
|
||||||
if episode_key.lower() not in episode_output_dict:
|
if episode_key.lower() not in episode_output_dict:
|
||||||
episode_output_dict[episode_key.lower()] = []
|
episode_output_dict[episode_key.lower()] = []
|
||||||
if episode_key == "locations":
|
|
||||||
for episode_location in episode_value:
|
if "completed" not in episode_output_dict:
|
||||||
episode_output_dict[episode_key.lower()].append(
|
episode_output_dict["completed"] = []
|
||||||
episode_location
|
if "time" not in episode_output_dict:
|
||||||
)
|
episode_output_dict["time"] = []
|
||||||
else:
|
|
||||||
|
if episode_key == "locations":
|
||||||
|
for episode_location in episode_value:
|
||||||
episode_output_dict[episode_key.lower()].append(
|
episode_output_dict[episode_key.lower()].append(
|
||||||
episode_value.lower()
|
episode_location
|
||||||
)
|
)
|
||||||
|
elif episode_key == "status":
|
||||||
|
episode_output_dict["completed"].append(
|
||||||
|
episode_value["completed"]
|
||||||
|
)
|
||||||
|
episode_output_dict["time"].append(episode_value["time"])
|
||||||
|
else:
|
||||||
|
episode_output_dict[episode_key.lower()].append(
|
||||||
|
episode_value.lower()
|
||||||
|
)
|
||||||
|
|
||||||
return episode_output_dict
|
return episode_output_dict
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -190,13 +201,20 @@ def movies_title_dict(user_list: dict):
|
|||||||
if movie_key != "status":
|
if movie_key != "status":
|
||||||
if movie_key.lower() not in movies_output_dict:
|
if movie_key.lower() not in movies_output_dict:
|
||||||
movies_output_dict[movie_key.lower()] = []
|
movies_output_dict[movie_key.lower()] = []
|
||||||
if movie_key == "locations":
|
|
||||||
for movie_location in movie_value:
|
if "completed" not in movies_output_dict:
|
||||||
movies_output_dict[movie_key.lower()].append(movie_location)
|
movies_output_dict["completed"] = []
|
||||||
else:
|
if "time" not in movies_output_dict:
|
||||||
movies_output_dict[movie_key.lower()].append(
|
movies_output_dict["time"] = []
|
||||||
movie_value.lower()
|
|
||||||
)
|
if movie_key == "locations":
|
||||||
|
for movie_location in movie_value:
|
||||||
|
movies_output_dict[movie_key.lower()].append(movie_location)
|
||||||
|
elif movie_key == "status":
|
||||||
|
movies_output_dict["completed"].append(movie_value["completed"])
|
||||||
|
movies_output_dict["time"].append(movie_value["time"])
|
||||||
|
else:
|
||||||
|
movies_output_dict[movie_key.lower()].append(movie_value.lower())
|
||||||
|
|
||||||
return movies_output_dict
|
return movies_output_dict
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
102
src/watched.py
102
src/watched.py
@@ -29,6 +29,48 @@ def combine_watched_dicts(dicts: list):
|
|||||||
return combined_dict
|
return combined_dict
|
||||||
|
|
||||||
|
|
||||||
|
def check_remove_entry(video, library, video_index, library_watched_list_2):
|
||||||
|
if video_index is not None:
|
||||||
|
if (
|
||||||
|
library_watched_list_2["completed"][video_index]
|
||||||
|
== video["status"]["completed"]
|
||||||
|
) and (library_watched_list_2["time"][video_index] == video["status"]["time"]):
|
||||||
|
logger(
|
||||||
|
f"Removing {video['title']} from {library} due to exact match",
|
||||||
|
3,
|
||||||
|
)
|
||||||
|
return True
|
||||||
|
elif (
|
||||||
|
library_watched_list_2["completed"][video_index] == True
|
||||||
|
and video["status"]["completed"] == False
|
||||||
|
):
|
||||||
|
logger(
|
||||||
|
f"Removing {video['title']} from {library} due to being complete in one library and not the other",
|
||||||
|
3,
|
||||||
|
)
|
||||||
|
return True
|
||||||
|
elif (
|
||||||
|
library_watched_list_2["completed"][video_index] == False
|
||||||
|
and video["status"]["completed"] == False
|
||||||
|
) and (video["status"]["time"] < library_watched_list_2["time"][video_index]):
|
||||||
|
logger(
|
||||||
|
f"Removing {video['title']} from {library} due to more time watched in one library than the other",
|
||||||
|
3,
|
||||||
|
)
|
||||||
|
return True
|
||||||
|
elif (
|
||||||
|
library_watched_list_2["completed"][video_index] == True
|
||||||
|
and video["status"]["completed"] == True
|
||||||
|
):
|
||||||
|
logger(
|
||||||
|
f"Removing {video['title']} from {library} due to being complete in both libraries",
|
||||||
|
3,
|
||||||
|
)
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def cleanup_watched(
|
def cleanup_watched(
|
||||||
watched_list_1, watched_list_2, user_mapping=None, library_mapping=None
|
watched_list_1, watched_list_2, user_mapping=None, library_mapping=None
|
||||||
):
|
):
|
||||||
@@ -60,9 +102,17 @@ def cleanup_watched(
|
|||||||
# Movies
|
# Movies
|
||||||
if isinstance(watched_list_1[user_1][library_1], list):
|
if isinstance(watched_list_1[user_1][library_1], list):
|
||||||
for movie in watched_list_1[user_1][library_1]:
|
for movie in watched_list_1[user_1][library_1]:
|
||||||
if is_movie_in_dict(movie, movies_watched_list_2_keys_dict):
|
movie_index = get_movie_index_in_dict(
|
||||||
logger(f"Removing {movie} from {library_1}", 3)
|
movie, movies_watched_list_2_keys_dict
|
||||||
modified_watched_list_1[user_1][library_1].remove(movie)
|
)
|
||||||
|
if movie_index is not None:
|
||||||
|
if check_remove_entry(
|
||||||
|
movie,
|
||||||
|
library_1,
|
||||||
|
movie_index,
|
||||||
|
movies_watched_list_2_keys_dict,
|
||||||
|
):
|
||||||
|
modified_watched_list_1[user_1][library_1].remove(movie)
|
||||||
|
|
||||||
# TV Shows
|
# TV Shows
|
||||||
elif isinstance(watched_list_1[user_1][library_1], dict):
|
elif isinstance(watched_list_1[user_1][library_1], dict):
|
||||||
@@ -72,19 +122,16 @@ def cleanup_watched(
|
|||||||
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
|
||||||
]:
|
]:
|
||||||
if is_episode_in_dict(
|
episode_index = get_episode_index_in_dict(
|
||||||
episode, episode_watched_list_2_keys_dict
|
episode, episode_watched_list_2_keys_dict
|
||||||
):
|
)
|
||||||
if (
|
if episode_index is not None:
|
||||||
episode
|
if check_remove_entry(
|
||||||
in modified_watched_list_1[user_1][library_1][
|
episode,
|
||||||
show_key_1
|
library_1,
|
||||||
][season]
|
episode_index,
|
||||||
|
episode_watched_list_2_keys_dict,
|
||||||
):
|
):
|
||||||
logger(
|
|
||||||
f"Removing {episode} from {show_key_dict['title']}",
|
|
||||||
3,
|
|
||||||
)
|
|
||||||
modified_watched_list_1[user_1][library_1][
|
modified_watched_list_1[user_1][library_1][
|
||||||
show_key_1
|
show_key_1
|
||||||
][season].remove(episode)
|
][season].remove(episode)
|
||||||
@@ -148,7 +195,7 @@ def get_other(watched_list, object_1, object_2):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def is_movie_in_dict(movie, movies_watched_list_2_keys_dict):
|
def get_movie_index_in_dict(movie, movies_watched_list_2_keys_dict):
|
||||||
# Iterate through the keys and values of the movie dictionary
|
# Iterate through the keys and values of the movie dictionary
|
||||||
for movie_key, movie_value in movie.items():
|
for movie_key, movie_value in movie.items():
|
||||||
# If the key is "locations", check if the "locations" key is present in the movies_watched_list_2_keys_dict dictionary
|
# If the key is "locations", check if the "locations" key is present in the movies_watched_list_2_keys_dict dictionary
|
||||||
@@ -156,21 +203,24 @@ def is_movie_in_dict(movie, movies_watched_list_2_keys_dict):
|
|||||||
if "locations" in movies_watched_list_2_keys_dict.keys():
|
if "locations" in movies_watched_list_2_keys_dict.keys():
|
||||||
# Iterate through the locations in the movie dictionary
|
# Iterate through the locations in the movie dictionary
|
||||||
for location in movie_value:
|
for location in movie_value:
|
||||||
# If the location is in the movies_watched_list_2_keys_dict dictionary, return True
|
# If the location is in the movies_watched_list_2_keys_dict dictionary, return index of the key
|
||||||
if location in movies_watched_list_2_keys_dict["locations"]:
|
if location in movies_watched_list_2_keys_dict["locations"]:
|
||||||
return True
|
return movies_watched_list_2_keys_dict["locations"].index(
|
||||||
|
location
|
||||||
|
)
|
||||||
|
|
||||||
# If the key is not "locations", check if the movie_key is present in the movies_watched_list_2_keys_dict dictionary
|
# If the key is not "locations", check if the movie_key is present in the movies_watched_list_2_keys_dict dictionary
|
||||||
else:
|
else:
|
||||||
if movie_key in movies_watched_list_2_keys_dict.keys():
|
if movie_key in movies_watched_list_2_keys_dict.keys():
|
||||||
# If the movie_value is in the movies_watched_list_2_keys_dict dictionary, return True
|
# If the movie_value is in the movies_watched_list_2_keys_dict dictionary, return True
|
||||||
if movie_value in movies_watched_list_2_keys_dict[movie_key]:
|
if movie_value in movies_watched_list_2_keys_dict[movie_key]:
|
||||||
return True
|
return movies_watched_list_2_keys_dict[movie_key].index(movie_value)
|
||||||
|
|
||||||
# If the loop completes without finding a match, return False
|
# If the loop completes without finding a match, return False
|
||||||
return False
|
return None
|
||||||
|
|
||||||
|
|
||||||
def is_episode_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():
|
||||||
# If the key is "locations", check if the "locations" key is present in the episode_watched_list_2_keys_dict dictionary
|
# If the key is "locations", check if the "locations" key is present in the episode_watched_list_2_keys_dict dictionary
|
||||||
@@ -178,15 +228,19 @@ def is_episode_in_dict(episode, episode_watched_list_2_keys_dict):
|
|||||||
if "locations" in episode_watched_list_2_keys_dict.keys():
|
if "locations" in episode_watched_list_2_keys_dict.keys():
|
||||||
# Iterate through the locations in the episode dictionary
|
# Iterate through the locations in the episode dictionary
|
||||||
for location in episode_value:
|
for location in episode_value:
|
||||||
# If the location is in the episode_watched_list_2_keys_dict dictionary, return True
|
# If the location is in the episode_watched_list_2_keys_dict dictionary, return index of the key
|
||||||
if location in episode_watched_list_2_keys_dict["locations"]:
|
if location in episode_watched_list_2_keys_dict["locations"]:
|
||||||
return True
|
return episode_watched_list_2_keys_dict["locations"].index(
|
||||||
|
location
|
||||||
|
)
|
||||||
# If the key is not "locations", check if the episode_key is present in the episode_watched_list_2_keys_dict dictionary
|
# If the key is not "locations", check if the episode_key is present in the episode_watched_list_2_keys_dict dictionary
|
||||||
else:
|
else:
|
||||||
if episode_key in episode_watched_list_2_keys_dict.keys():
|
if episode_key in episode_watched_list_2_keys_dict.keys():
|
||||||
# If the episode_value is in the episode_watched_list_2_keys_dict dictionary, return True
|
# If the episode_value is in the episode_watched_list_2_keys_dict dictionary, return True
|
||||||
if episode_value in episode_watched_list_2_keys_dict[episode_key]:
|
if episode_value in episode_watched_list_2_keys_dict[episode_key]:
|
||||||
return True
|
return episode_watched_list_2_keys_dict[episode_key].index(
|
||||||
|
episode_value
|
||||||
|
)
|
||||||
|
|
||||||
# If the loop completes without finding a match, return False
|
# If the loop completes without finding a match, return False
|
||||||
return False
|
return None
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ show_list = {
|
|||||||
"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},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -61,6 +62,7 @@ movie_list = [
|
|||||||
"imdb": "tt2380307",
|
"imdb": "tt2380307",
|
||||||
"tmdb": "354912",
|
"tmdb": "354912",
|
||||||
"locations": ("Coco (2017) Remux-2160p.mkv", "Coco (2017) Remux-1080p.mkv"),
|
"locations": ("Coco (2017) Remux-2160p.mkv", "Coco (2017) Remux-1080p.mkv"),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -77,12 +79,16 @@ episode_titles = {
|
|||||||
],
|
],
|
||||||
"tmdb": ["2181581"],
|
"tmdb": ["2181581"],
|
||||||
"tvdb": ["8444132"],
|
"tvdb": ["8444132"],
|
||||||
|
"completed": [True],
|
||||||
|
"time": [0],
|
||||||
}
|
}
|
||||||
movie_titles = {
|
movie_titles = {
|
||||||
"imdb": ["tt2380307"],
|
"imdb": ["tt2380307"],
|
||||||
"locations": ["Coco (2017) Remux-2160p.mkv", "Coco (2017) Remux-1080p.mkv"],
|
"locations": ["Coco (2017) Remux-2160p.mkv", "Coco (2017) Remux-1080p.mkv"],
|
||||||
"title": ["coco"],
|
"title": ["coco"],
|
||||||
"tmdb": ["354912"],
|
"tmdb": ["354912"],
|
||||||
|
"completed": [True],
|
||||||
|
"time": [0],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,42 +30,43 @@ tv_shows_watched_list_1 = {
|
|||||||
"imdb": "tt0550489",
|
"imdb": "tt0550489",
|
||||||
"tmdb": "282843",
|
"tmdb": "282843",
|
||||||
"tvdb": "176357",
|
"tvdb": "176357",
|
||||||
|
"title": "Extreme Aggressor",
|
||||||
"locations": (
|
"locations": (
|
||||||
"Criminal Minds S01E01 Extreme Aggressor WEBDL-720p.mkv",
|
"Criminal Minds S01E01 Extreme Aggressor WEBDL-720p.mkv",
|
||||||
),
|
),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"imdb": "tt0550487",
|
"imdb": "tt0550487",
|
||||||
"tmdb": "282861",
|
"tmdb": "282861",
|
||||||
"tvdb": "300385",
|
"tvdb": "300385",
|
||||||
|
"title": "Compulsion",
|
||||||
"locations": ("Criminal Minds S01E02 Compulsion WEBDL-720p.mkv",),
|
"locations": ("Criminal Minds S01E02 Compulsion WEBDL-720p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
frozenset({("title", "Test"), ("locations", ("Test",))}): {
|
frozenset({("title", "Test"), ("locations", ("Test",))}): {
|
||||||
"Season 1": [
|
"Season 1": [
|
||||||
{"locations": ("Test S01E01.mkv",)},
|
{
|
||||||
{"locations": ("Test S01E02.mkv",)},
|
"title": "S01E01",
|
||||||
|
"locations": ("Test S01E01.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "S01E02",
|
||||||
|
"locations": ("Test S01E02.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "S01E04",
|
||||||
|
"locations": ("Test S01E04.mkv",),
|
||||||
|
"status": {"completed": False, "time": 5},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
movies_watched_list_1 = [
|
|
||||||
{
|
|
||||||
"imdb": "tt2380307",
|
|
||||||
"tmdb": "354912",
|
|
||||||
"title": "Coco",
|
|
||||||
"locations": ("Coco (2017) Remux-1080p.mkv",),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"tmdbcollection": "448150",
|
|
||||||
"imdb": "tt1431045",
|
|
||||||
"tmdb": "293660",
|
|
||||||
"title": "Deadpool",
|
|
||||||
"locations": ("Deadpool (2016) Remux-1080p.mkv",),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
tv_shows_watched_list_2 = {
|
tv_shows_watched_list_2 = {
|
||||||
frozenset(
|
frozenset(
|
||||||
{
|
{
|
||||||
@@ -81,32 +82,146 @@ tv_shows_watched_list_2 = {
|
|||||||
"imdb": "tt0550487",
|
"imdb": "tt0550487",
|
||||||
"tmdb": "282861",
|
"tmdb": "282861",
|
||||||
"tvdb": "300385",
|
"tvdb": "300385",
|
||||||
|
"title": "Compulsion",
|
||||||
"locations": ("Criminal Minds S01E02 Compulsion WEBDL-720p.mkv",),
|
"locations": ("Criminal Minds S01E02 Compulsion WEBDL-720p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"imdb": "tt0550498",
|
"imdb": "tt0550498",
|
||||||
"tmdb": "282865",
|
"tmdb": "282865",
|
||||||
"tvdb": "300474",
|
"tvdb": "300474",
|
||||||
|
"title": "Won't Get Fooled Again",
|
||||||
"locations": (
|
"locations": (
|
||||||
"Criminal Minds S01E03 Won't Get Fooled Again WEBDL-720p.mkv",
|
"Criminal Minds S01E03 Won't Get Fooled Again WEBDL-720p.mkv",
|
||||||
),
|
),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
frozenset({("title", "Test"), ("locations", ("Test",))}): {
|
frozenset({("title", "Test"), ("locations", ("Test",))}): {
|
||||||
"Season 1": [
|
"Season 1": [
|
||||||
{"locations": ("Test S01E02.mkv",)},
|
{
|
||||||
{"locations": ("Test S01E03.mkv",)},
|
"title": "S01E02",
|
||||||
|
"locations": ("Test S01E02.mkv",),
|
||||||
|
"status": {"completed": False, "time": 10},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "S01E03",
|
||||||
|
"locations": ("Test S01E03.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "S01E04",
|
||||||
|
"locations": ("Test S01E04.mkv",),
|
||||||
|
"status": {"completed": False, "time": 10},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expected_tv_show_watched_list_1 = {
|
||||||
|
frozenset(
|
||||||
|
{
|
||||||
|
("tvdb", "75710"),
|
||||||
|
("title", "Criminal Minds"),
|
||||||
|
("imdb", "tt0452046"),
|
||||||
|
("locations", ("Criminal Minds",)),
|
||||||
|
("tmdb", "4057"),
|
||||||
|
}
|
||||||
|
): {
|
||||||
|
"Season 1": [
|
||||||
|
{
|
||||||
|
"imdb": "tt0550489",
|
||||||
|
"tmdb": "282843",
|
||||||
|
"tvdb": "176357",
|
||||||
|
"title": "Extreme Aggressor",
|
||||||
|
"locations": (
|
||||||
|
"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},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "S01E02",
|
||||||
|
"locations": ("Test S01E02.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
expected_tv_show_watched_list_2 = {
|
||||||
|
frozenset(
|
||||||
|
{
|
||||||
|
("tvdb", "75710"),
|
||||||
|
("title", "Criminal Minds"),
|
||||||
|
("imdb", "tt0452046"),
|
||||||
|
("locations", ("Criminal Minds",)),
|
||||||
|
("tmdb", "4057"),
|
||||||
|
}
|
||||||
|
): {
|
||||||
|
"Season 1": [
|
||||||
|
{
|
||||||
|
"imdb": "tt0550498",
|
||||||
|
"tmdb": "282865",
|
||||||
|
"tvdb": "300474",
|
||||||
|
"title": "Won't Get Fooled Again",
|
||||||
|
"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},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "S01E04",
|
||||||
|
"locations": ("Test S01E04.mkv",),
|
||||||
|
"status": {"completed": False, "time": 10},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
movies_watched_list_1 = [
|
||||||
|
{
|
||||||
|
"imdb": "tt2380307",
|
||||||
|
"tmdb": "354912",
|
||||||
|
"title": "Coco",
|
||||||
|
"locations": ("Coco (2017) Remux-1080p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tmdbcollection": "448150",
|
||||||
|
"imdb": "tt1431045",
|
||||||
|
"tmdb": "293660",
|
||||||
|
"title": "Deadpool",
|
||||||
|
"locations": ("Deadpool (2016) Remux-1080p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
movies_watched_list_2 = [
|
movies_watched_list_2 = [
|
||||||
{
|
{
|
||||||
"imdb": "tt2380307",
|
"imdb": "tt2380307",
|
||||||
"tmdb": "354912",
|
"tmdb": "354912",
|
||||||
"title": "Coco",
|
"title": "Coco",
|
||||||
"locations": ("Coco (2017) Remux-1080p.mkv",),
|
"locations": ("Coco (2017) Remux-1080p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"imdb": "tt0384793",
|
"imdb": "tt0384793",
|
||||||
@@ -114,9 +229,33 @@ movies_watched_list_2 = [
|
|||||||
"tvdb": "9103",
|
"tvdb": "9103",
|
||||||
"title": "Accepted",
|
"title": "Accepted",
|
||||||
"locations": ("Accepted (2006) Remux-1080p.mkv",),
|
"locations": ("Accepted (2006) Remux-1080p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
expected_movie_watched_list_1 = [
|
||||||
|
{
|
||||||
|
"tmdbcollection": "448150",
|
||||||
|
"imdb": "tt1431045",
|
||||||
|
"tmdb": "293660",
|
||||||
|
"title": "Deadpool",
|
||||||
|
"locations": ("Deadpool (2016) Remux-1080p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
expected_movie_watched_list_2 = [
|
||||||
|
{
|
||||||
|
"imdb": "tt0384793",
|
||||||
|
"tmdb": "9788",
|
||||||
|
"tvdb": "9103",
|
||||||
|
"title": "Accepted",
|
||||||
|
"locations": ("Accepted (2006) Remux-1080p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
# 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.
|
||||||
tv_shows_2_watched_list_1 = {
|
tv_shows_2_watched_list_1 = {
|
||||||
frozenset(
|
frozenset(
|
||||||
@@ -133,86 +272,16 @@ tv_shows_2_watched_list_1 = {
|
|||||||
"imdb": "tt0550489",
|
"imdb": "tt0550489",
|
||||||
"tmdb": "282843",
|
"tmdb": "282843",
|
||||||
"tvdb": "176357",
|
"tvdb": "176357",
|
||||||
|
"title": "Extreme Aggressor",
|
||||||
"locations": (
|
"locations": (
|
||||||
"Criminal Minds S01E01 Extreme Aggressor WEBDL-720p.mkv",
|
"Criminal Minds S01E01 Extreme Aggressor WEBDL-720p.mkv",
|
||||||
),
|
),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expected_tv_show_watched_list_1 = {
|
|
||||||
frozenset(
|
|
||||||
{
|
|
||||||
("tvdb", "75710"),
|
|
||||||
("title", "Criminal Minds"),
|
|
||||||
("imdb", "tt0452046"),
|
|
||||||
("locations", ("Criminal Minds",)),
|
|
||||||
("tmdb", "4057"),
|
|
||||||
}
|
|
||||||
): {
|
|
||||||
"Season 1": [
|
|
||||||
{
|
|
||||||
"imdb": "tt0550489",
|
|
||||||
"tmdb": "282843",
|
|
||||||
"tvdb": "176357",
|
|
||||||
"locations": (
|
|
||||||
"Criminal Minds S01E01 Extreme Aggressor WEBDL-720p.mkv",
|
|
||||||
),
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
frozenset({("title", "Test"), ("locations", ("Test",))}): {
|
|
||||||
"Season 1": [{"locations": ("Test S01E01.mkv",)}]
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
expected_movie_watched_list_1 = [
|
|
||||||
{
|
|
||||||
"tmdbcollection": "448150",
|
|
||||||
"imdb": "tt1431045",
|
|
||||||
"tmdb": "293660",
|
|
||||||
"title": "Deadpool",
|
|
||||||
"locations": ("Deadpool (2016) Remux-1080p.mkv",),
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
expected_tv_show_watched_list_2 = {
|
|
||||||
frozenset(
|
|
||||||
{
|
|
||||||
("tvdb", "75710"),
|
|
||||||
("title", "Criminal Minds"),
|
|
||||||
("imdb", "tt0452046"),
|
|
||||||
("locations", ("Criminal Minds",)),
|
|
||||||
("tmdb", "4057"),
|
|
||||||
}
|
|
||||||
): {
|
|
||||||
"Season 1": [
|
|
||||||
{
|
|
||||||
"imdb": "tt0550498",
|
|
||||||
"tmdb": "282865",
|
|
||||||
"tvdb": "300474",
|
|
||||||
"locations": (
|
|
||||||
"Criminal Minds S01E03 Won't Get Fooled Again WEBDL-720p.mkv",
|
|
||||||
),
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
frozenset({("title", "Test"), ("locations", ("Test",))}): {
|
|
||||||
"Season 1": [{"locations": ("Test S01E03.mkv",)}]
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
expected_movie_watched_list_2 = [
|
|
||||||
{
|
|
||||||
"imdb": "tt0384793",
|
|
||||||
"tmdb": "9788",
|
|
||||||
"tvdb": "9103",
|
|
||||||
"title": "Accepted",
|
|
||||||
"locations": ("Accepted (2006) Remux-1080p.mkv",),
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def test_simple_cleanup_watched():
|
def test_simple_cleanup_watched():
|
||||||
user_watched_list_1 = {
|
user_watched_list_1 = {
|
||||||
@@ -311,18 +380,21 @@ def test_combine_watched_dicts():
|
|||||||
"tmdb": "12429",
|
"tmdb": "12429",
|
||||||
"imdb": "tt0876563",
|
"imdb": "tt0876563",
|
||||||
"locations": ("Ponyo (2008) Bluray-1080p.mkv",),
|
"locations": ("Ponyo (2008) Bluray-1080p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Spirited Away",
|
"title": "Spirited Away",
|
||||||
"tmdb": "129",
|
"tmdb": "129",
|
||||||
"imdb": "tt0245429",
|
"imdb": "tt0245429",
|
||||||
"locations": ("Spirited Away (2001) Bluray-1080p.mkv",),
|
"locations": ("Spirited Away (2001) Bluray-1080p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Castle in the Sky",
|
"title": "Castle in the Sky",
|
||||||
"tmdb": "10515",
|
"tmdb": "10515",
|
||||||
"imdb": "tt0092067",
|
"imdb": "tt0092067",
|
||||||
"locations": ("Castle in the Sky (1986) Bluray-1080p.mkv",),
|
"locations": ("Castle in the Sky (1986) Bluray-1080p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -349,6 +421,7 @@ def test_combine_watched_dicts():
|
|||||||
"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},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -365,18 +438,21 @@ def test_combine_watched_dicts():
|
|||||||
"tmdb": "12429",
|
"tmdb": "12429",
|
||||||
"imdb": "tt0876563",
|
"imdb": "tt0876563",
|
||||||
"locations": ("Ponyo (2008) Bluray-1080p.mkv",),
|
"locations": ("Ponyo (2008) Bluray-1080p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Spirited Away",
|
"title": "Spirited Away",
|
||||||
"tmdb": "129",
|
"tmdb": "129",
|
||||||
"imdb": "tt0245429",
|
"imdb": "tt0245429",
|
||||||
"locations": ("Spirited Away (2001) Bluray-1080p.mkv",),
|
"locations": ("Spirited Away (2001) Bluray-1080p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Castle in the Sky",
|
"title": "Castle in the Sky",
|
||||||
"tmdb": "10515",
|
"tmdb": "10515",
|
||||||
"imdb": "tt0092067",
|
"imdb": "tt0092067",
|
||||||
"locations": ("Castle in the Sky (1986) Bluray-1080p.mkv",),
|
"locations": ("Castle in the Sky (1986) Bluray-1080p.mkv",),
|
||||||
|
"status": {"completed": True, "time": 0},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"Anime Shows": {},
|
"Anime Shows": {},
|
||||||
@@ -399,6 +475,7 @@ def test_combine_watched_dicts():
|
|||||||
"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},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user