Fix id for qualities

This commit is contained in:
Johan van Eck 2025-07-26 13:05:35 +03:00
parent e34cc938c2
commit 27ef8ee0c9
27 changed files with 368 additions and 150 deletions

View file

@ -4,6 +4,7 @@ import yaml
from markdownify import markdownify
from utils.qualities import QUALITIES
from utils.strings import get_file_name
cache = {}
@ -64,9 +65,14 @@ def collect_profile_formats(trash_score_set, format_items, output_dir):
return profile_format
def get_quality_id(quality_name):
return next(
quality["id"] for quality in QUALITIES if quality["name"] == quality_name
)
def collect_qualities(items):
qualities = []
quality_id = 1
quality_collection_id = -1
for item in items:
if item.get("allowed", False) is False:
@ -81,11 +87,11 @@ def collect_qualities(items):
quality["description"] = ""
quality["qualities"] = []
for sub_item in item["items"]:
quality["qualities"].append({"id": quality_id, "name": sub_item})
quality_id += 1
quality["qualities"].append(
{"id": get_quality_id(sub_item), "name": sub_item}
)
else:
quality["id"] = quality_id
quality_id += 1
quality["id"] = get_quality_id(item.get("name", ""))
qualities.append(quality)
return qualities

212
scripts/utils/qualities.py Normal file
View file

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