Skip to content

Commit

Permalink
stats.lua: add file_tag_max_length option
Browse files Browse the repository at this point in the history
To filter out overlength tags (such as long comments and lyrics),
add file_tag_max_length option so that tags longer than this length
are not displayed.
  • Loading branch information
na-na-hi committed Apr 17, 2024
1 parent 00f5d26 commit 2a541ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions DOCS/man/stats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ Configurable Options
respective duration. This can result in overlapping text when multiple
scripts decide to print text at the same time.

``file_tag_max_length``
Default: 128

Only show file tags shorter than this length, in bytes.

``term_width_limit``
Default: -1

Expand Down
5 changes: 3 additions & 2 deletions player/lua/stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ local o = {
persistent_overlay = false, -- whether the stats can be overwritten by other output
print_perfdata_passes = false, -- when true, print the full information about all passes
filter_params_max_length = 100, -- a filter list longer than this many characters will be shown one filter per line instead
show_frame_info = false, -- whether to show the current frame info
file_tag_max_length = 128, -- only show file tags shorter than this length in bytes
show_frame_info = false, -- whether to show the current frame info
term_width_limit = -1, -- overwrites the terminal width
term_height_limit = -1, -- overwrites the terminal height
debug = false,
Expand Down Expand Up @@ -613,7 +614,7 @@ local function add_file(s)

local tags = mp.get_property_native("display-tags")
for _, tag in pairs(tags) do
if tag ~= "Title" then
if tag ~= "Title" and mp.get_property_osd("metadata/" .. tag):len() < o.file_tag_max_length then
append_property(s, "metadata/" .. tag, {prefix=string.gsub(tag, "_", " ") .. ":"})
end
end
Expand Down

0 comments on commit 2a541ae

Please sign in to comment.