Handle episode names are not unique

This commit is contained in:
Luigi311
2024-01-02 23:43:59 -07:00
parent ba480d2cb7
commit de9180a124
7 changed files with 449 additions and 141 deletions

View File

@@ -18,102 +18,225 @@ from src.watched import cleanup_watched, combine_watched_dicts
tv_shows_watched_list_1 = {
frozenset(
{
("tvdb", "75710"),
("title", "Criminal Minds"),
("imdb", "tt0452046"),
("locations", ("Criminal Minds",)),
("tmdb", "4057"),
("locations", ("Doctor Who (2005) {tvdb-78804} {imdb-tt0436992}",)),
("imdb", "tt0436992"),
("tmdb", "57243"),
("tvdb", "78804"),
("title", "Doctor Who (2005)"),
}
): {
"Season 1": [
1: [
{
"imdb": "tt0550489",
"tmdb": "282843",
"tvdb": "176357",
"title": "Extreme Aggressor",
"locations": (
"Criminal Minds S01E01 Extreme Aggressor WEBDL-720p.mkv",
),
"imdb": "tt0563001",
"tmdb": "968589",
"tvdb": "295296",
"title": "The Unquiet Dead",
"locations": ("S01E03.mkv",),
"status": {"completed": True, "time": 0},
},
{
"imdb": "tt0550487",
"tmdb": "282861",
"tvdb": "300385",
"title": "Compulsion",
"locations": ("Criminal Minds S01E02 Compulsion WEBDL-720p.mkv",),
"imdb": "tt0562985",
"tmdb": "968590",
"tvdb": "295297",
"title": "Aliens of London (1)",
"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},
},
]
},
frozenset({("title", "Test"), ("locations", ("Test",))}): {
"Season 1": [
frozenset(
{
("title", "Monarch: Legacy of Monsters"),
("imdb", "tt17220216"),
("tvdb", "422598"),
("tmdb", "202411"),
(
"locations",
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
),
}
): {
1: [
{
"title": "S01E01",
"locations": ("Test S01E01.mkv",),
"imdb": "tt21255044",
"tmdb": "4661246",
"tvdb": "10009418",
"title": "Secrets and Lies",
"locations": ("S01E03.mkv",),
"status": {"completed": True, "time": 0},
},
{
"title": "S01E02",
"locations": ("Test S01E02.mkv",),
"imdb": "tt21255050",
"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},
},
{
"title": "S01E04",
"locations": ("Test S01E04.mkv",),
"status": {"completed": False, "time": 5},
"imdb": "tt20413322",
"tmdb": "4568681",
"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 = {
frozenset(
{
("tvdb", "75710"),
("title", "Criminal Minds"),
("imdb", "tt0452046"),
("locations", ("Criminal Minds",)),
("tmdb", "4057"),
("locations", ("Doctor Who (2005) {tvdb-78804} {imdb-tt0436992}",)),
("imdb", "tt0436992"),
("tmdb", "57243"),
("title", "Doctor Who"),
("tvdb", "78804"),
("tvrage", "3332"),
}
): {
"Season 1": [
1: [
{
"imdb": "tt0550487",
"tmdb": "282861",
"tvdb": "300385",
"title": "Compulsion",
"locations": ("Criminal Minds S01E02 Compulsion WEBDL-720p.mkv",),
"tvdb": "295294",
"imdb": "tt0562992",
"title": "Rose",
"locations": ("S01E01.mkv",),
"status": {"completed": True, "time": 0},
},
{
"imdb": "tt0550498",
"tmdb": "282865",
"tvdb": "300474",
"title": "Won't Get Fooled Again",
"locations": (
"Criminal Minds S01E03 Won't Get Fooled Again WEBDL-720p.mkv",
),
"tvdb": "295295",
"imdb": "tt0562997",
"title": "The End of the World",
"locations": ("S01E02.mkv",),
"status": {"completed": False, "time": 300670},
},
{
"tvdb": "295298",
"imdb": "tt0563003",
"title": "World War Three (2)",
"locations": ("S01E05.mkv",),
"status": {"completed": True, "time": 0},
},
]
},
frozenset({("title", "Test"), ("locations", ("Test",))}): {
"Season 1": [
frozenset(
{
("title", "Monarch: Legacy of Monsters"),
("imdb", "tt17220216"),
("tvdb", "422598"),
("tmdb", "202411"),
(
"locations",
("Monarch - Legacy of Monsters {tvdb-422598} {imdb-tt17220216}",),
),
}
): {
1: [
{
"title": "S01E02",
"locations": ("Test S01E02.mkv",),
"status": {"completed": False, "time": 10},
},
{
"title": "S01E03",
"locations": ("Test S01E03.mkv",),
"tvdb": "9959300",
"imdb": "tt20412166",
"title": "Aftermath",
"locations": ("S01E01.mkv",),
"status": {"completed": True, "time": 0},
},
{
"title": "S01E04",
"locations": ("Test S01E04.mkv",),
"status": {"completed": False, "time": 10},
"tvdb": "10009417",
"imdb": "tt22866594",
"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 = {
frozenset(
{
("tvdb", "75710"),
("title", "Criminal Minds"),
("imdb", "tt0452046"),
("locations", ("Criminal Minds",)),
("tmdb", "4057"),
("locations", ("Doctor Who (2005) {tvdb-78804} {imdb-tt0436992}",)),
("imdb", "tt0436992"),
("tmdb", "57243"),
("tvdb", "78804"),
("title", "Doctor Who (2005)"),
}
): {
"Season 1": [
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",),
"imdb": "tt0563001",
"tmdb": "968589",
"tvdb": "295296",
"title": "The Unquiet Dead",
"locations": ("S01E03.mkv",),
"status": {"completed": True, "time": 0},
},
{
"title": "S01E02",
"locations": ("Test S01E02.mkv",),
"imdb": "tt0562985",
"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},
},
{
"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 = {
frozenset(
{
("tvdb", "75710"),
("title", "Criminal Minds"),
("imdb", "tt0452046"),
("locations", ("Criminal Minds",)),
("tmdb", "4057"),
("locations", ("Doctor Who (2005) {tvdb-78804} {imdb-tt0436992}",)),
("imdb", "tt0436992"),
("tmdb", "57243"),
("title", "Doctor Who"),
("tvdb", "78804"),
("tvrage", "3332"),
}
): {
"Season 1": [
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",),
"tvdb": "295294",
"imdb": "tt0562992",
"title": "Rose",
"locations": ("S01E01.mkv",),
"status": {"completed": True, "time": 0},
},
{
"title": "S01E04",
"locations": ("Test S01E04.mkv",),
"status": {"completed": False, "time": 10},
"tvdb": "295295",
"imdb": "tt0562997",
"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 = [
{
"imdb": "tt2380307",
"tmdb": "354912",
"title": "Coco",
"locations": ("Coco (2017) Remux-1080p.mkv",),
"imdb": "tt1254207",
"tmdb": "10378",
"tvdb": "12352",
"title": "Big Buck Bunny",
"locations": ("Big Buck Bunny.mkv",),
"status": {"completed": True, "time": 0},
},
{
"tmdbcollection": "448150",
"imdb": "tt1431045",
"tmdb": "293660",
"title": "Deadpool",
"locations": ("Deadpool (2016) Remux-1080p.mkv",),
"imdb": "tt16431870",
"tmdb": "1029575",
"tvdb": "351194",
"title": "The Family Plan",
"locations": ("The Family Plan (2023).mkv",),
"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 = [
{
"imdb": "tt2380307",
"tmdb": "354912",
"title": "Coco",
"locations": ("Coco (2017) Remux-1080p.mkv",),
"imdb": "tt16431870",
"tmdb": "1029575",
"title": "The Family Plan",
"locations": ("The Family Plan (2023).mkv",),
"status": {"completed": True, "time": 0},
},
{
"imdb": "tt0384793",
"tmdb": "9788",
"tvdb": "9103",
"title": "Accepted",
"locations": ("Accepted (2006) Remux-1080p.mkv",),
"imdb": "tt4589218",
"tmdb": "507089",
"title": "Five Nights at Freddy's",
"locations": ("Five Nights at Freddy's (2023).mkv",),
"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 = [
{
"tmdbcollection": "448150",
"imdb": "tt1431045",
"tmdb": "293660",
"title": "Deadpool",
"locations": ("Deadpool (2016) Remux-1080p.mkv",),
"imdb": "tt1254207",
"tmdb": "10378",
"tvdb": "12352",
"title": "Big Buck Bunny",
"locations": ("Big Buck Bunny.mkv",),
"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 = [
{
"imdb": "tt0384793",
"tmdb": "9788",
"tvdb": "9103",
"title": "Accepted",
"locations": ("Accepted (2006) Remux-1080p.mkv",),
"imdb": "tt4589218",
"tmdb": "507089",
"title": "Five Nights at Freddy's",
"locations": ("Five Nights at Freddy's (2023).mkv",),
"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.