fix: yattee's mpv-specific resolution workaround

for some reason Yattee's mpv backend won't play videos which are using
an "unusual" aspect ratio (at least ones which are not 360p)
This commit is contained in:
2025-09-05 05:17:13 +02:00
parent 5e655ddd2c
commit 89f8f2a786

View File

@@ -279,7 +279,7 @@ def rebuildFormatsFromYtdlpApi(ydata: dict):
height = str(safeTraverse(stream, ["height"], default=0)) height = str(safeTraverse(stream, ["height"], default=0))
width = str(safeTraverse(stream, [ "width"], default=0)) width = str(safeTraverse(stream, [ "width"], default=0))
newRow[ "type"] = "video/" + type newRow[ "type"] = "video/" + type
newRow[ "resolution"] = height + "p" newRow[ "resolution"] = (height if height in ("144", "240", "360", "480", "720", "1080") else "360") + "p" # mpv won't play the video inside of Yattee if it's a non-standard resolution (bug?)
newRow[ "fps"] = safeTraverse(stream, ["fps"], default=30) newRow[ "fps"] = safeTraverse(stream, ["fps"], default=30)
newRow[ "qualityLabel"] = height + "p" + str(int(newRow['fps'])) * (newRow["fps"] > 30) # also a placeholder newRow[ "qualityLabel"] = height + "p" + str(int(newRow['fps'])) * (newRow["fps"] > 30) # also a placeholder
newRow[ "size"] = width + "x" + height newRow[ "size"] = width + "x" + height