mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
edited video duration format to human readable format
This commit is contained in:
parent
30ac041d9e
commit
ff440914ad
1 changed files with 12 additions and 1 deletions
|
|
@ -108,9 +108,20 @@ function M:spot_base(job)
|
||||||
end
|
end
|
||||||
|
|
||||||
local dur = meta.format.duration or 0
|
local dur = meta.format.duration or 0
|
||||||
|
local hours = math.floor(dur / 3600)
|
||||||
|
local mins = math.floor((dur % 3600) / 60)
|
||||||
|
local secs = math.floor(dur % 60)
|
||||||
|
|
||||||
|
local duration_str
|
||||||
|
if hours > 0 then
|
||||||
|
duration_str = string.format("%d:%02d:%02d", hours, mins, secs)
|
||||||
|
else
|
||||||
|
duration_str = string.format("%d:%02d", mins, secs)
|
||||||
|
end
|
||||||
|
|
||||||
local rows = {
|
local rows = {
|
||||||
ui.Row({ "Video" }):style(ui.Style():fg("green")),
|
ui.Row({ "Video" }):style(ui.Style():fg("green")),
|
||||||
ui.Row { " Duration:", string.format("%d:%02d", math.floor(dur / 60), math.floor(dur % 60)) },
|
ui.Row { " Duration:", duration_str },
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, s in ipairs(meta.streams) do
|
for i, s in ipairs(meta.streams) do
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue