FileFlows Arr-Handoff robust gegen Duplicate-Loops #3
1 changed files with 92 additions and 0 deletions
|
|
@ -119,6 +119,98 @@ class SonarrImportSafetyTests(unittest.TestCase):
|
||||||
[call.get("name") for call in commands],
|
[call.get("name") for call in commands],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_release_folder_matches_when_episode_filename_is_scene_shortened(self):
|
||||||
|
release = (
|
||||||
|
"Angie.Tribeca.S01E06.Frettchen.Royale.GERMAN.DL."
|
||||||
|
"1080p.HDTV.x264-SYNCTV"
|
||||||
|
)
|
||||||
|
exact = f"/tdarr/converted/serien/{release}/synctv-angie.s01e06.1080p.mkv"
|
||||||
|
result = run_script(
|
||||||
|
{
|
||||||
|
"releaseTitle": "synctv-angie.s01e06.1080p",
|
||||||
|
"exactPath": exact,
|
||||||
|
"scopeRoot": "/tdarr/converted/serien",
|
||||||
|
"queueResponse": {
|
||||||
|
"records": [
|
||||||
|
{"title": release, "seriesId": 853, "episodeId": 63336}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"historyResponse": {"records": []},
|
||||||
|
"parseResponse": {},
|
||||||
|
"candidates": [
|
||||||
|
{
|
||||||
|
"path": exact,
|
||||||
|
"quality": {"quality": {"id": 4, "name": "HDTV-1080p"}},
|
||||||
|
"languages": [{"id": 4, "name": "German"}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(result["result"], 1)
|
||||||
|
command = next(call for call in result["calls"] if call["type"] == "command")
|
||||||
|
imported = command["body"]["files"][0]
|
||||||
|
self.assertEqual(imported["seriesId"], 853)
|
||||||
|
self.assertEqual(imported["episodeIds"], [63336])
|
||||||
|
|
||||||
|
def test_grab_metadata_overrides_unknown_manualimport_metadata(self):
|
||||||
|
release = (
|
||||||
|
"The.Night.Agent.2025.S02E04.Desperate.Measures.2160p.NF."
|
||||||
|
"WEB-DL.MULTi.DDP5.1.Atmos.H.265-FUZEER"
|
||||||
|
)
|
||||||
|
exact = f"/tdarr/converted/serien4k/{release}/{release}.mkv"
|
||||||
|
grabbed_quality = {"quality": {"id": 18, "name": "WEBDL-2160p"}}
|
||||||
|
grabbed_languages = [
|
||||||
|
{"id": 1, "name": "English"},
|
||||||
|
{"id": 4, "name": "German"},
|
||||||
|
]
|
||||||
|
result = run_script(
|
||||||
|
{
|
||||||
|
"releaseTitle": release,
|
||||||
|
"exactPath": exact,
|
||||||
|
"scopeRoot": "/tdarr/converted/serien4k",
|
||||||
|
"queueResponse": {
|
||||||
|
"records": [
|
||||||
|
{"title": release, "seriesId": 602, "episodeId": 37528}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"historyResponse": {
|
||||||
|
"records": [
|
||||||
|
{
|
||||||
|
"sourceTitle": release,
|
||||||
|
"seriesId": 602,
|
||||||
|
"episodeId": 37528,
|
||||||
|
"eventType": "grabbed",
|
||||||
|
"quality": grabbed_quality,
|
||||||
|
"languages": grabbed_languages,
|
||||||
|
"data": {
|
||||||
|
"releaseGroup": "FUZEER",
|
||||||
|
"indexerFlags": "8",
|
||||||
|
"releaseType": "SingleEpisode",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"candidates": [
|
||||||
|
{
|
||||||
|
"path": exact,
|
||||||
|
"releaseGroup": "Sonarr",
|
||||||
|
"quality": {"quality": {"id": 0, "name": "Unknown"}},
|
||||||
|
"languages": [{"id": 0, "name": "Unknown"}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(result["result"], 1)
|
||||||
|
command = next(call for call in result["calls"] if call["type"] == "command")
|
||||||
|
imported = command["body"]["files"][0]
|
||||||
|
self.assertEqual(imported["quality"], grabbed_quality)
|
||||||
|
self.assertEqual(imported["languages"], grabbed_languages)
|
||||||
|
self.assertEqual(imported["releaseGroup"], "FUZEER")
|
||||||
|
self.assertEqual(imported["indexerFlags"], 8)
|
||||||
|
self.assertEqual(imported["releaseType"], "SingleEpisode")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue