mpv-player / mpv-player/mpv

Add arbitrary formatting of time values in Property Expansion

Open
#4,117 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core:api core:option-param-conf meta:feature-request
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

This is a feature request to extend the Property Expansion mechanism to allow for arbitrary formatting of time values.

For instance:
osd-msg3='${time-remaining}'
results in:
00:45:21

I would like to be able to format the time-remaining in some other format than HH:MM:SS, to suit my needs better. For instance I don't care about seconds at all, and I rarely see anything longer than 99 minutes, so I would like the format MM. This way I can show time-remaining in 2 characters instead of 8. For instance I would like to write:
osd-msg3='${time-remaining%MM}'

mpv has already time-formatting, I found one in the documentation of --screenshot-template argument. So what is missing is just some kind of glue-code to allow for arbitrary formats in property expansion.

Even better, to make the formatting really arbitrary, mpv could allow piping the value to arbitrary command. Then I could write a simple shell script that formats the data the way I want, like so:
osd-msg3='${time-remaining|bash ~/.mpv/my_time_format.sh}'

For instance I always wanted to display current wall time during movie playback, plus the time-remaining in MM format if MM>1 otherwise SS format, plus the count of unread email messages in my inbox. That would be hard with just property expansion, but trivial if piping is added.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by locating the Property Expansion implementation and the existing time-formatting behavior documented for --screenshot-template, then clarify whether the goal is format syntax, command piping, or both. Done means the selected scope is implemented and its formatting behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.