Skip to content

Commit 4c0dc57

Browse files
committed
build subtitle with consistent spacing and improved readability
1 parent 8ec4fd9 commit 4c0dc57

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

plugin/results.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,24 @@ def ytdlp_update_in_progress_result() -> Result:
7878
def query_result(
7979
query, thumbnail, title, format, download_path, pref_video_path, pref_audio_path
8080
) -> Result:
81+
# Build subtitle with consistent spacing
82+
subtitle_parts = [f"Res: {format['resolution']}"]
83+
84+
if format.get('tbr') is not None:
85+
subtitle_parts.append(f"({round(format['tbr'], 2)} kbps)")
86+
87+
if format.get('filesize'):
88+
size_mb = round(format['filesize'] / 1024 / 1024, 2)
89+
subtitle_parts.append(f"Size: {size_mb}MB")
90+
91+
if format.get('fps'):
92+
subtitle_parts.append(f"FPS: {int(format['fps'])}")
93+
94+
subtitle = " ┃ ".join(subtitle_parts)
95+
8196
return Result(
8297
Title=title,
83-
SubTitle=f"Res: {format['resolution']} {('(' + str(round(format['tbr'], 2)) + ' kbps)') if format.get('tbr') is not None else ''} {'┃ Size: ' + str(round(format['filesize'] / 1024 / 1024, 2)) + 'MB' if format.get('filesize') else ''} {'┃ FPS: ' + str(int(format['fps'])) if format.get('fps') else ''}",
98+
SubTitle=subtitle,
8499
IcoPath=thumbnail or "Images/app.png",
85100
JsonRPCAction={
86101
"method": "download",

0 commit comments

Comments
 (0)