From 2027fb8b2ec766896773c6803c9b7a33a4fc6f12 Mon Sep 17 00:00:00 2001 From: hooke007 Date: Sat, 18 May 2024 11:36:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=84=9A=E6=9C=AC=EF=BC=9A=20playlist=5Fosd=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dm3u=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E7=89=B9=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- portable_config/script-opts.conf | 2 +- portable_config/script-opts/playlist_osd.conf | 2 +- portable_config/scripts/playlist_osd.lua | 11 +++-------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/portable_config/script-opts.conf b/portable_config/script-opts.conf index bff61d70..2ec84404 100644 --- a/portable_config/script-opts.conf +++ b/portable_config/script-opts.conf @@ -380,7 +380,7 @@ ##播放列表的字体样式,下方为示例。留空则使用 mpv.conf 中的OSD设置 ## {\fnUbuntu\fs10\b0\bord1} 相当于 font=Ubuntu, size=10, bold=no, border=1 ##格式参考 https://aeg-dev.github.io/AegiSite/docs/3.2/ass_tags/ - script-opts-append = playlist_osd-style_ass_tags={\rDefault\an7\fs12\b0\blur0\bord1\1c&H996F9A\3c&H000000\q2} + script-opts-append = playlist_osd-style_ass_tags={\rDefault\an7\fs24\b0\blur0\bord1\1c&H996F9A\3c&H000000\q2} ##播放列表标题(字符串之后将添加一个换行),下方为示例(默认值)。 ## %mediatitle or %filename = 标题或当前播放的文件名 ; %pos = 当前播放文件的位置 ## %cursor = 导航的位置 ; %plen = 列表长度 ; %N = 换行 diff --git a/portable_config/script-opts/playlist_osd.conf b/portable_config/script-opts/playlist_osd.conf index 09bade85..fb7c78b8 100644 --- a/portable_config/script-opts/playlist_osd.conf +++ b/portable_config/script-opts/playlist_osd.conf @@ -38,7 +38,7 @@ slice_longfilenames_amount=80 ## {\fnUbuntu\fs10\b0\bord1} 相当于 font=Ubuntu, size=10, bold=no, border=1 ##格式参考 https://aeg-dev.github.io/AegiSite/docs/3.2/ass_tags/ ##留空则使用 mpv.conf 中的OSD设置 -style_ass_tags={\rDefault\an7\fs12\b0\blur0\bord1\1c&H996F9A\3c&H000000\q2} +style_ass_tags={\rDefault\an7\fs24\b0\blur0\bord1\1c&H996F9A\3c&H000000\q2} ##播放列表标题(字符串之后将添加一个换行)示例即默认值 ## %mediatitle or %filename = 标题或当前播放的文件名 diff --git a/portable_config/scripts/playlist_osd.lua b/portable_config/scripts/playlist_osd.lua index 5c3cdff2..6f869657 100644 --- a/portable_config/scripts/playlist_osd.lua +++ b/portable_config/scripts/playlist_osd.lua @@ -36,7 +36,7 @@ local settings = { slice_longfilenames = false, slice_longfilenames_amount = 80, - style_ass_tags = "{\\rDefault\\an7\\fs12\\b0\\blur0\\bord1\\1c&H996F9A\\3c&H000000\\q2}", + style_ass_tags = "{\\rDefault\\an7\\fs24\\b0\\blur0\\bord1\\1c&H996F9A\\3c&H000000\\q2}", playlist_header = "播放列表 [%cursor/%plen]", normal_file = "{\\c&HFFFFFF&}□ %name", hovered_file = "{\\c&H33FFFF&}■ %name", @@ -158,9 +158,8 @@ function get_name_from_index(i, notitle) local title = mp.get_property("playlist/" .. i .. "/title") local name = mp.get_property("playlist/" .. i .. "/filename") - local should_use_title = settings.prefer_titles == "all" or is_protocol(name) and settings.prefer_titles == "url" --check if file has a media title stored or as property - if not title and should_use_title then + if not title then local mtitle = mp.get_property("media-title") if i == pos and mp.get_property("filename") ~= mtitle then if not title_table[name] then @@ -173,7 +172,7 @@ function get_name_from_index(i, notitle) end --if we have media title use a more conservative strip - if title and not notitle and should_use_title then + if title and not notitle then -- Escape a string for verbatim display on the OSD -- Ref: https://github.com/mpv-player/mpv/blob/94677723624fb84756e65c8f1377956667244bc9/player/lua/stats.lua#L145 return stripfilename(title, true):gsub("\\", "\\\239\187\191"):gsub("{", "\\{"):gsub("^ ", "\\h") @@ -240,10 +239,6 @@ function draw_playlist() refresh_globals() local ass = assdraw.ass_new() - local _, _, a = mp.get_osd_size() - local h = 360 - local w = h * a - ass:append(settings.style_ass_tags) if settings.playlist_header ~= "" then