Skip to content

Commit

Permalink
同步上游
Browse files Browse the repository at this point in the history
  • Loading branch information
hooke007 committed Jul 20, 2022
1 parent 3fdadc1 commit 6630f20
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Temp/script-opts.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#script-opts-append = osc-tooltipborder=1 # "bottombar/topbar"布局中的工具提示边框
#script-opts-append = osc-timetotal=no # 显示总时间而不是剩余时间,默认 no
#script-opts-append = osc-timems=no # 以毫秒精度显示时间码,默认 no
#script-opts-append = osc-tcspace=100 # 时间码间距(补偿字体大小),默认 100
#script-opts-append = osc-visibility=auto # <never|默认auto|always> OSC的可见性

script-opts-append = osc-boxmaxchars=135 # 在"box"布局下的标题字符数的上限值,默认 80
Expand All @@ -65,6 +66,7 @@
#script-opts-append = osc-chapters_osd=no # 左键点击切换章节时显示OSD全部章节信息,默认 yes
script-opts-append = osc-playlist_osd=no # 左键点击切换文件时显示OSD播放列表信息,默认 yes
#script-opts-append = osc-chapter_fmt=Chapter: %s # 悬停进度条时显示章节信息的格式,特殊值no为不显示,示例为默认值
#script-opts-append = osc-unicodeminus=no # 是否使用Unicode的减号字符,默认 no



Expand Down
4 changes: 4 additions & 0 deletions portable_config/script-opts/osc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ title=对比[${contrast}] 明度[${brightness}] 伽马[${gamma}] 纯度[${sat
# -- 显示总时间而不是剩余时间,默认:no
#timems=no
# -- 以毫秒精度显示时间码,默认:no
#tcspace=100
# -- 时间码间距(补偿字体大小),默认:100
#visibility=auto
# -- <never|默认auto|always> OSC可见性

Expand All @@ -81,3 +83,5 @@ playlist_osd=no
# -- 左键点击切换文件时显示OSD播放列表信息,默认:yes
#chapter_fmt=Chapter: %s
# -- 悬停进度条时显示章节信息的格式,特殊值no为不显示,示例为默认值
#unicodeminus=no
# -- 是否使用Unicode的减号字符,默认:no
18 changes: 14 additions & 4 deletions portable_config/scripts/osc_lazy.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
--[[
SOURCE_ https://github.com/mpv-player/mpv/blob/master/player/lua/osc.lua
COMMIT_ 20220604 ec236f7
COMMIT_ 20220719 ad5a1ac
SOURCE_ https://github.com/deus0ww/mpv-conf/blob/master/scripts/Thumbnailer_OSC.lua
COMMIT_ 20220605 135315f
COMMIT_ 20220720 7a9e348
改进版本的OSC,须禁用原始mpv的内置OSC,且不兼容其它OSC类脚本,实现全部功能需搭配额外两个缩略图引擎脚本(Thumbnailer)。
示例在 input.conf 中写入:
Expand Down Expand Up @@ -69,6 +69,7 @@ local user_opts = {
tooltipborder = 1, -- border of tooltip in bottom/topbar
timetotal = true, -- display total time instead of remaining time? -- 原版为false
timems = false, -- display timecodes with milliseconds?
tcspace = 100, -- timecode spacing (compensate font size estimation)
visibility = "auto", -- only used at init to set visibility_mode(...)
boxmaxchars = 150, -- title crop threshold for box layout -- 原版为80
boxvideo = false, -- apply osc_param.video_margins to video
Expand All @@ -79,6 +80,7 @@ local user_opts = {
chapters_osd = true, -- whether to show chapters OSD on next/prev
playlist_osd = true, -- whether to show playlist OSD on next/prev
chapter_fmt = "章节:%s", -- chapter print format for seekbar-hover. "no" to disable
unicodeminus = false, -- whether to use the Unicode minus sign character

-- 以下为osc_lazy的独占选项

Expand Down Expand Up @@ -2211,6 +2213,11 @@ function bar_layout(direction)
local padY = 3
local buttonW = 27
local tcW = (state.tc_ms) and 170 or 110
if user_opts.tcspace >= 50 and user_opts.tcspace <= 200 then
-- adjust our hardcoded font size estimation
tcW = tcW * user_opts.tcspace / 100
end

local tsW = 90
local minW = (buttonW + padX)*5 + (tcW + padX)*4 + (tsW + padX)*2

Expand Down Expand Up @@ -2463,6 +2470,8 @@ function update_options(list)
request_init()
end

local UNICODE_MINUS = string.char(0xe2, 0x88, 0x92) -- UTF-8 for U+2212 MINUS SIGN

-- OSC INIT
function osc_init()
msg.debug("osc_init")
Expand Down Expand Up @@ -2872,10 +2881,11 @@ function osc_init()

ne.content = function ()
if (state.rightTC_trem) then
local minus = user_opts.unicodeminus and UNICODE_MINUS or "-"
if state.tc_ms then
return ("-"..mp.get_property_osd("playtime-remaining/full"))
return (minus..mp.get_property_osd("playtime-remaining/full"))
else
return ("-"..mp.get_property_osd("playtime-remaining"))
return (minus..mp.get_property_osd("playtime-remaining"))
end
else
if state.tc_ms then
Expand Down

0 comments on commit 6630f20

Please sign in to comment.