This commit is contained in:
CodeName393
2026-02-26 02:07:06 +09:00
committed by GitHub
parent 547e9f481c
commit 30269b6c17

View File

@@ -70,22 +70,21 @@ class Movie(Title):
def _get_resolution_token(track: Any) -> str: def _get_resolution_token(track: Any) -> str:
if not track or not getattr(track, "height", None): if not track or not getattr(track, "height", None):
return "" return ""
resolution = track.height width = getattr(track, "width", track.height)
resolution = min(width, track.height)
try: try:
dar = getattr(track, "other_display_aspect_ratio", None) or [] dar = getattr(track, "other_display_aspect_ratio", None) or []
if dar and dar[0]: if dar and dar[0]:
aspect_ratio = [int(float(plane)) for plane in str(dar[0]).split(":")] aspect_ratio = [int(float(plane)) for plane in str(dar[0]).split(":")]
if len(aspect_ratio) == 1: if len(aspect_ratio) == 1:
aspect_ratio.append(1) aspect_ratio.append(1)
if aspect_ratio[0] / aspect_ratio[1] not in (16 / 9, 4 / 3): ratio = aspect_ratio[0] / aspect_ratio[1]
resolution = int(track.width * (9 / 16)) if ratio not in (16 / 9, 4 / 3, 9 / 16, 3 / 4):
resolution = int(max(width, track.height) * (9 / 16))
except Exception: except Exception:
pass pass
scan_suffix = "p" scan_suffix = "i" if str(getattr(track, "scan_type", "")).lower() == "interlaced" else "p"
scan_type = getattr(track, "scan_type", None)
if scan_type and str(scan_type).lower() == "interlaced":
scan_suffix = "i"
return f"{resolution}{scan_suffix}" return f"{resolution}{scan_suffix}"
# Name (Year) # Name (Year)