Ensure all conditions work
This commit is contained in:
parent
e48af3aba1
commit
09c5bc02d9
206 changed files with 413 additions and 251 deletions
|
|
@ -4,7 +4,11 @@ import yaml
|
|||
|
||||
from markdownify import markdownify
|
||||
|
||||
from utils.source import SOURCE_MAPPING
|
||||
from utils.mappings.languages import LANGUAGE_MAPPING
|
||||
from utils.mappings.indexer_flags import INDEXER_FLAG_MAPPING
|
||||
from utils.mappings.release_type import RELEASE_TYPE_MAPPING
|
||||
from utils.mappings.quality_modifiers import QUALITY_MODIFIER_MAPPING
|
||||
from utils.mappings.source import SOURCE_MAPPING
|
||||
from utils.strings import get_name
|
||||
|
||||
IMPLEMENTATION_TO_TAG_MAPPING = {
|
||||
|
|
@ -62,13 +66,21 @@ def collect_custom_format(service, file_name, input_json, output_dir):
|
|||
]
|
||||
elif implementation in ["LanguageSpecification"]:
|
||||
# TODO: exceptLanguage
|
||||
condition["language"] = spec.get("fields", {}).get("value")
|
||||
condition["language"] = LANGUAGE_MAPPING[service][
|
||||
spec.get("fields", {}).get("value")
|
||||
]
|
||||
elif implementation in ["IndexerFlagSpecification"]:
|
||||
condition["flag"] = spec.get("fields", {}).get("value")
|
||||
condition["flag"] = INDEXER_FLAG_MAPPING[service][
|
||||
spec.get("fields", {}).get("value")
|
||||
]
|
||||
elif implementation in ["QualityModifierSpecification"]:
|
||||
condition["qualityModifier"] = spec.get("fields", {}).get("value")
|
||||
condition["qualityModifier"] = QUALITY_MODIFIER_MAPPING[service][
|
||||
spec.get("fields", {}).get("value")
|
||||
]
|
||||
elif implementation in ["ReleaseTypeSpecification"]:
|
||||
condition["releaseType"] = spec.get("fields", {}).get("value")
|
||||
condition["releaseType"] = RELEASE_TYPE_MAPPING[service][
|
||||
spec.get("fields", {}).get("value")
|
||||
]
|
||||
|
||||
conditions.append(condition)
|
||||
|
||||
|
|
@ -79,7 +91,7 @@ def collect_custom_format(service, file_name, input_json, output_dir):
|
|||
"description": f"""[Custom format from TRaSH-Guides.]({SERVICE_TO_TRASH_GUIDES_URL[service]}#{file_name})
|
||||
|
||||
{markdownify(input_json.get('description', ''))}""".strip(),
|
||||
"tags": [service.capitalize(), *implementation_tags],
|
||||
"tags": [service.capitalize(), *sorted(implementation_tags)],
|
||||
"conditions": conditions,
|
||||
"tests": [],
|
||||
}
|
||||
|
|
|
|||
0
scripts/utils/mappings/__init__.py
Normal file
0
scripts/utils/mappings/__init__.py
Normal file
24
scripts/utils/mappings/indexer_flags.py
Normal file
24
scripts/utils/mappings/indexer_flags.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
INDEXER_FLAG_MAPPING = {
|
||||
"radarr": {
|
||||
1: "freeleech",
|
||||
2: "halfleech",
|
||||
4: "double_upload",
|
||||
32: "internal",
|
||||
128: "scene",
|
||||
256: "freeleech_75",
|
||||
512: "freeleech_25",
|
||||
2048: "nuked",
|
||||
8: "ptp_golden",
|
||||
16: "ptp_approved",
|
||||
},
|
||||
"sonarr": {
|
||||
1: "freeleech",
|
||||
2: "halfleech",
|
||||
4: "double_upload",
|
||||
8: "internal",
|
||||
16: "scene",
|
||||
32: "freeleech_75",
|
||||
64: "freeleech_25",
|
||||
128: "nuked",
|
||||
},
|
||||
}
|
||||
108
scripts/utils/mappings/languages.py
Normal file
108
scripts/utils/mappings/languages.py
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
LANGUAGE_MAPPING = {
|
||||
"radarr": {
|
||||
-1: "any",
|
||||
-2: "original",
|
||||
0: "unknown",
|
||||
1: "english",
|
||||
2: "french",
|
||||
3: "spanish",
|
||||
4: "german",
|
||||
5: "italian",
|
||||
6: "danish",
|
||||
7: "dutch",
|
||||
8: "japanese",
|
||||
9: "icelandic",
|
||||
10: "chinese",
|
||||
11: "russian",
|
||||
12: "polish",
|
||||
13: "vietnamese",
|
||||
14: "swedish",
|
||||
15: "norwegian",
|
||||
16: "finnish",
|
||||
17: "turkish",
|
||||
18: "portuguese",
|
||||
19: "flemish",
|
||||
20: "greek",
|
||||
21: "korean",
|
||||
22: "hungarian",
|
||||
23: "hebrew",
|
||||
24: "lithuanian",
|
||||
25: "czech",
|
||||
26: "hindi",
|
||||
27: "romanian",
|
||||
28: "thai",
|
||||
29: "bulgarian",
|
||||
30: "portuguese_br",
|
||||
31: "arabic",
|
||||
32: "ukrainian",
|
||||
33: "persian",
|
||||
34: "bengali",
|
||||
35: "slovak",
|
||||
36: "latvian",
|
||||
37: "spanish_latino",
|
||||
38: "catalan",
|
||||
39: "croatian",
|
||||
40: "serbian",
|
||||
41: "bosnian",
|
||||
42: "estonian",
|
||||
43: "tamil",
|
||||
44: "indonesian",
|
||||
45: "telugu",
|
||||
46: "macedonian",
|
||||
47: "slovenian",
|
||||
48: "malayalam",
|
||||
49: "kannada",
|
||||
50: "albanian",
|
||||
51: "afrikaans",
|
||||
},
|
||||
"sonarr": {
|
||||
0: "unknown",
|
||||
1: "english",
|
||||
2: "french",
|
||||
3: "spanish",
|
||||
4: "german",
|
||||
5: "italian",
|
||||
6: "danish",
|
||||
7: "dutch",
|
||||
8: "japanese",
|
||||
9: "icelandic",
|
||||
10: "chinese",
|
||||
11: "russian",
|
||||
12: "polish",
|
||||
13: "vietnamese",
|
||||
14: "swedish",
|
||||
15: "norwegian",
|
||||
16: "finnish",
|
||||
17: "turkish",
|
||||
18: "portuguese",
|
||||
19: "flemish",
|
||||
20: "greek",
|
||||
21: "korean",
|
||||
22: "hungarian",
|
||||
23: "hebrew",
|
||||
24: "lithuanian",
|
||||
25: "czech",
|
||||
26: "arabic",
|
||||
27: "hindi",
|
||||
28: "bulgarian",
|
||||
29: "malayalam",
|
||||
30: "ukrainian",
|
||||
31: "slovak",
|
||||
32: "thai",
|
||||
33: "portuguese_br",
|
||||
34: "spanish_latino",
|
||||
35: "romanian",
|
||||
36: "latvian",
|
||||
37: "persian",
|
||||
38: "catalan",
|
||||
39: "croatian",
|
||||
40: "serbian",
|
||||
41: "bosnian",
|
||||
42: "estonian",
|
||||
43: "tamil",
|
||||
44: "indonesian",
|
||||
45: "macedonian",
|
||||
46: "slovenian",
|
||||
-2: "original",
|
||||
},
|
||||
}
|
||||
10
scripts/utils/mappings/quality_modifiers.py
Normal file
10
scripts/utils/mappings/quality_modifiers.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
QUALITY_MODIFIER_MAPPING = {
|
||||
"radarr": {
|
||||
0: "none",
|
||||
1: "regional",
|
||||
2: "screener",
|
||||
3: "rawhd",
|
||||
4: "brdisk",
|
||||
5: "remux",
|
||||
}
|
||||
}
|
||||
8
scripts/utils/mappings/release_type.py
Normal file
8
scripts/utils/mappings/release_type.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
RELEASE_TYPE_MAPPING = {
|
||||
"sonarr": {
|
||||
0: "none",
|
||||
1: "single_episode",
|
||||
2: "multi_episode",
|
||||
3: "season_pack",
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ import yaml
|
|||
|
||||
from markdownify import markdownify
|
||||
|
||||
from utils.qualities import QUALITIES
|
||||
from utils.mappings.qualities import QUALITIES
|
||||
from utils.strings import get_name
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue