Clearer naming

This commit is contained in:
Johan van Eck 2025-07-26 17:23:54 +03:00
parent dfe37a51a4
commit c9629e8b3d
5100 changed files with 32992 additions and 32541 deletions

View file

@ -4,7 +4,7 @@ import yaml
from markdownify import markdownify
from utils.strings import get_file_name
from utils.strings import get_name
IMPLEMENTATION_TO_TAG_MAPPING = {
"ReleaseTitleSpecification": ["Release Title"],
@ -33,7 +33,7 @@ def collect_custom_format(service, file_name, input_json, output_dir):
conditions = []
for spec in input_json.get("specifications", []):
condition = {
"name": get_file_name(service, spec.get("name", "")),
"name": get_name(service, spec.get("name", "")),
"negate": spec.get("negate", False),
"required": spec.get("required", False),
"type": IMPLEMENTATION_TO_TYPE_MAPPING.get(
@ -63,11 +63,11 @@ def collect_custom_format(service, file_name, input_json, output_dir):
# Compose YAML structure
name = input_json.get("name", "")
yml_data = {
"name": get_file_name(service, name),
"name": get_name(service, name),
"description": f"""[Custom format from TRaSH-Guides.](https://trash-guides.info/{service.capitalize()}/{service.capitalize()}-collection-of-custom-formats/#{file_name})
{markdownify(input_json.get('description', ''))}""".strip(),
"tags": IMPLEMENTATION_TO_TAG_MAPPING[implementation],
"tags": [*IMPLEMENTATION_TO_TAG_MAPPING[implementation], service.capitalize()],
"conditions": conditions,
"tests": [],
}
@ -80,7 +80,7 @@ def collect_custom_format(service, file_name, input_json, output_dir):
# yml_data["metadata"] = {"includeInRename": include_in_rename}
# Output path
output_path = os.path.join(output_dir, f"{get_file_name(service, name)}.yml")
output_path = os.path.join(output_dir, f"{get_name(service, name)}.yml")
with open(output_path, "w", encoding="utf-8") as f:
yaml.dump(yml_data, f, sort_keys=False, allow_unicode=True)
print(f"Generated: {output_path}")

View file

@ -5,7 +5,7 @@ import yaml
from markdownify import markdownify
from utils.qualities import QUALITIES
from utils.strings import get_file_name
from utils.strings import get_name
def collect_profile_formats(
@ -18,7 +18,7 @@ def collect_profile_formats(
if score == 0:
continue
profile_formats.append({"name": get_file_name(service, name), "score": score})
profile_formats.append({"name": get_name(service, name), "score": score})
return sorted(
profile_formats,
key=lambda profile_format: (
@ -78,11 +78,11 @@ def collect_profile(service, input_json, output_dir, trash_id_to_scoring_mapping
name = input_json.get("name", "")
profile_qualities = collect_qualities(input_json.get("items", []))
yml_data = {
"name": get_file_name(service, name),
"name": get_name(service, name),
"description": f"""[Profile from TRaSH-Guides.](https://trash-guides.info/{service.capitalize()}/{service}-setup-quality-profiles)
{markdownify(input_json.get('trash_description', ''))}""".strip(),
"tags": [],
"tags": [service.capitalize()],
"upgradesAllowed": input_json.get("upgradeAllowed", True),
"minCustomFormatScore": input_json.get("minFormatScore", 0),
"upgradeUntilScore": input_json.get("cutoffFormatScore", 0),
@ -99,7 +99,7 @@ def collect_profile(service, input_json, output_dir, trash_id_to_scoring_mapping
}
# Output path
output_path = os.path.join(output_dir, f"{get_file_name(service, name)}.yml")
output_path = os.path.join(output_dir, f"{get_name(service, name)}.yml")
with open(output_path, "w", encoding="utf-8") as f:
yaml.dump(yml_data, f, sort_keys=False, allow_unicode=True)
print(f"Generated: {output_path}")

View file

@ -2,7 +2,7 @@ import os
import json
import yaml
from utils.strings import get_file_name
from utils.strings import get_name
# TODO: prevent duplicates by only writing unique regex patterns to files
# In some cases negations will result in a new regex pattern as of now
@ -27,7 +27,7 @@ def collect_regex_pattern(service, file_name, input_json, output_dir):
# Compose YAML structure
name = spec.get("name", "")
yml_data = {
"name": get_file_name(service, name),
"name": get_name(service, name),
"pattern": pattern,
"description": "",
"tags": [],
@ -37,7 +37,7 @@ def collect_regex_pattern(service, file_name, input_json, output_dir):
# Output path
output_path = os.path.join(
output_dir,
f"{get_file_name(service, name)}.yml",
f"{get_name(service, name)}.yml",
)
with open(output_path, "w", encoding="utf-8") as f:
yaml.dump(yml_data, f, sort_keys=False, allow_unicode=True)

View file

@ -1,4 +1,4 @@
def get_file_name(service, profile_name):
def get_name(service, profile_name):
safe_profile_name = (
profile_name.replace("/", "-")
.replace("[", "(")
@ -7,4 +7,4 @@ def get_file_name(service, profile_name):
.replace("10 bit", "10bit")
.replace("Atmos", "ATMOS")
)
return f"{service}-{safe_profile_name}"
return f"{service.capitalize()} - {safe_profile_name}"