This commit is contained in:
Profilarr 2026-04-06 22:06:09 +02:00
parent b5472a3f57
commit 11e9c5cb97
3 changed files with 99 additions and 65 deletions

View file

@ -1,212 +1,236 @@
SERVICE_QUALITY_TO_PROFILARR_QUALITY = {
"sonarr": {
"Bluray-1080p Remux": "Remux-1080p",
"Bluray-2160p Remux": "Remux-2160p",
},
"radarr": {},
}
QUALITIES = [
{
"id": 1,
"name": "Raw-HD",
"description": "Uncompressed, high definition recorded video from airing",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 2,
"name": "BR-Disk",
"description": "Complete Blu-ray disc image",
"radarr": True,
"sonarr": False,
"sonarr": False
},
{
"id": 3,
"name": "Remux-2160p",
"description": "4K Ultra HD Blu-ray disc content remuxed into a playable file format",
"description":
"4K Ultra HD Blu-ray disc content remuxed into a playable file format",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 4,
"name": "Bluray-2160p",
"description": "4K Ultra HD Blu-ray video encoded with lossy compression",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 5,
"name": "WEBDL-2160p",
"description": "4K web download, untouched as released by the streaming service",
"description":
"4K web download, untouched as released by the streaming service",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 6,
"name": "WEBRip-2160p",
"description": "4K web rip, either captured from a 4K WEB-DL using a capture card or re-encoded from a 4K WEB-DL",
"description":
"4K web rip, either captured from a 4K WEB-DL using a capture card or re-encoded from a 4K WEB-DL",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 7,
"name": "HDTV-2160p",
"description": "4K high-definition digital television capture",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 8,
"name": "Remux-1080p",
"description": "1080p Blu-ray disc content remuxed into a playable file format",
"description":
"1080p Blu-ray disc content remuxed into a playable file format",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 9,
"name": "WEBDL-1080p",
"description": "1080p web download, untouched as released by the streaming service",
"description":
"1080p web download, untouched as released by the streaming service",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 10,
"name": "Bluray-1080p",
"description": "1080p Blu-ray video encoded with lossy compression",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 11,
"name": "WEBRip-1080p",
"description": "1080p web rip, either captured using a capture card or re-encoded from a WEB-DL of equal or higher resolution",
"description":
"1080p web rip, either captured using a capture card or re-encoded from a WEB-DL of equal or higher resolution",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 12,
"name": "HDTV-1080p",
"description": "1080p high-definition digital television capture",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 13,
"name": "Bluray-720p",
"description": "720p Blu-ray video encoded with lossy compression",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 14,
"name": "WEBDL-720p",
"description": "720p web download, untouched as released by the streaming service",
"description":
"720p web download, untouched as released by the streaming service",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 15,
"name": "WEBRip-720p",
"description": "720p web rip, either captured using a capture card or re-encoded from a WEB-DL of equal or higher resolution",
"description":
"720p web rip, either captured using a capture card or re-encoded from a WEB-DL of equal or higher resolution",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 16,
"name": "HDTV-720p",
"description": "720p high-definition digital television capture",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 17,
"name": "Bluray-576p",
"description": "576p Blu-ray video encoded with lossy compression",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 18,
"name": "Bluray-480p",
"description": "480p Blu-ray video encoded with lossy compression",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 19,
"name": "WEBDL-480p",
"description": "480p web download, untouched as released by the streaming service",
"description":
"480p web download, untouched as released by the streaming service",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 20,
"name": "WEBRip-480p",
"description": "480p web rip, either captured using a capture card or re-encoded from a WEB-DL of equal or higher resolution",
"description":
"480p web rip, either captured using a capture card or re-encoded from a WEB-DL of equal or higher resolution",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 21,
"name": "DVD-R",
"description": "DVD-Video disc image",
"radarr": True,
"sonarr": False,
"sonarr": False
},
{
"id": 22,
"name": "DVD",
"description": "Standard DVD video, usually encoded at 480p",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 23,
"name": "DVDSCR",
"description": "DVD screener, usually a lower quality early release",
"radarr": True,
"sonarr": False,
"sonarr": False
},
{
"id": 24,
"name": "SDTV",
"description": "Standard-definition digital television capture, typically 480p or lower",
"description":
"Standard-definition digital television capture, typically 480p or lower",
"radarr": True,
"sonarr": True,
"sonarr": True
},
{
"id": 25,
"name": "Telecine",
"description": "Movie captured from a film print using a telecine machine",
"description":
"Movie captured from a film print using a telecine machine",
"radarr": True,
"sonarr": False,
"sonarr": False
},
{
"id": 26,
"name": "Telesync",
"description": "Filmed in a movie theater using a professional camera, often with external audio",
"description":
"Filmed in a movie theater using a professional camera, often with external audio",
"radarr": True,
"sonarr": False,
"sonarr": False
},
{
"id": 27,
"name": "REGIONAL",
"description": "A release intended for a specific geographic region",
"radarr": True,
"sonarr": False,
"sonarr": False
},
{
"id": 28,
"name": "WORKPRINT",
"description": "An unfinished version of a movie, often with incomplete special effects",
"description":
"An unfinished version of a movie, often with incomplete special effects",
"radarr": True,
"sonarr": False,
"sonarr": False
},
{
"id": 29,
"name": "CAM",
"description": "Filmed in a movie theater using a camcorder or mobile phone",
"description":
"Filmed in a movie theater using a camcorder or mobile phone",
"radarr": True,
"sonarr": False,
"sonarr": False
},
{
"id": 30,
"name": "Unknown",
"description": "Quality or source is unknown or unspecified",
"radarr": True,
"sonarr": True,
},
"sonarr": True
}
]

View file

@ -4,7 +4,7 @@ import yaml
from markdownify import markdownify
from utils.file_utils import iterate_json_files
from utils.mappings.qualities import QUALITIES
from utils.mappings.qualities import QUALITIES, SERVICE_QUALITY_TO_PROFILARR_QUALITY
from utils.strings import get_name
@ -29,36 +29,46 @@ def _collect_profile_formats(
)
def _get_quality_id(quality_name):
def _get_quality_id(service, quality_name):
safe_quality_name = SERVICE_QUALITY_TO_PROFILARR_QUALITY[service].get(
quality_name, quality_name
)
return next(
(quality["id"] for quality in QUALITIES if quality["name"] == quality_name),
None,
(
quality["id"]
for quality in QUALITIES
if quality["name"] == safe_quality_name
)
)
def _collect_qualities(items):
def _collect_qualities(service, items):
qualities = []
quality_collection_id = -1
for item in items:
if item.get("allowed", False) is False:
continue
quality_id = (
_get_quality_id(service, item.get("name", ""))
if item.get("items") is None
else quality_collection_id
)
quality = {
"id": _get_quality_id(item.get("name", "")),
"id": quality_id,
"name": item.get("name", ""),
}
if item.get("items") is not None:
quality["id"] = quality_collection_id
quality_collection_id -= 1
quality["description"] = ""
quality["qualities"] = []
for sub_item in item["items"]:
quality["qualities"].append(
{"id": _get_quality_id(sub_item), "name": sub_item}
{"id": _get_quality_id(service, sub_item), "name": sub_item}
)
qualities.append(quality)
return list(reversed(qualities))
return list(qualities)
def _get_upgrade_until(quality_name, profile_qualities):
@ -76,7 +86,7 @@ def _get_upgrade_until(quality_name, profile_qualities):
def _collect_profile(service, input_json, output_dir, trash_id_to_scoring_mapping):
# Compose YAML structure
name = input_json.get("name", "")
profile_qualities = _collect_qualities(input_json.get("items", []))
profile_qualities = _collect_qualities(service, input_json.get("items", []))
yml_data = {
"name": get_name(service, name),
"description": f"""[Profile from TRaSH-Guides.](https://trash-guides.info/{service.capitalize()}/{service}-setup-quality-profiles)