Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osc: avoid showing a double-minus-sign for time remaining #15255

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions player/lua/osc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2025,10 +2025,19 @@ local function osc_init()
local property = user_opts.remaining_playtime and "playtime-remaining"
or "time-remaining"
if state.tc_ms then
return (minus..mp.get_property_osd(property .. "/full"))
else
return (minus..mp.get_property_osd(property))
property = property .. "/full"
end
local value = mp.get_property_osd(property)
local normal_alpha = 0
if state.animation then
normal_alpha = mult_alpha(normal_alpha, state.animation)
end
local alpha = normal_alpha
if value:sub(1, 1) == '-' then
value = value:sub(2)
alpha = 255
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps prepending a + would be simpler than changing the color?

Copy link
Contributor Author

@rcombs rcombs Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See PR description; I tried this and it didn't look good. (It'd probably look better in a different font.)

return string.format('{\\1a%X}%s{\\1a%X}%s', alpha, minus, normal_alpha, value)
else
if state.tc_ms then
return (mp.get_property_osd("duration/full"))
Expand Down
Loading