From 54b3a9fdb004a85340e502a0e5af27b80c939694 Mon Sep 17 00:00:00 2001 From: Julian Date: Fri, 25 Aug 2017 23:57:17 +0200 Subject: stats: add current and total chapter number Fixes #44 (well, partially, I'm still not sure about the time) --- player/lua/stats.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/player/lua/stats.lua b/player/lua/stats.lua index 4c5793ea10..217fa09edc 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -452,7 +452,14 @@ local function add_file(s) if not (mp.get_property_osd("filename") == mp.get_property_osd("media-title")) then append_property(s, "media-title", {prefix="Title:"}) end - append_property(s, "chapter", {prefix="Chapter:"}) + + local ch_index = mp.get_property_number("chapter") + if ch_index and ch_index >= 0 then + append_property(s, "chapter-list/" .. tostring(ch_index) .. "/title", {prefix="Chapter:"}) + append_property(s, "chapter-list/count", + {prefix="(" .. tostring(ch_index + 1) .. "/", suffix=")", nl="", + indent=" ", prefix_sep=" ", no_prefix_markup=true}) + end if append_property(s, "cache-used", {prefix="Cache:"}) then append_property(s, "demuxer-cache-duration", {prefix="+", suffix=" sec", nl="", indent=o.prefix_sep, -- cgit v1.2.3