summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian <MyFakeAcc.4@googlemail.com>2017-08-25 23:57:17 +0200
committerwm4 <wm4@nowhere>2017-10-09 20:40:32 +0200
commit54b3a9fdb004a85340e502a0e5af27b80c939694 (patch)
treeca7b74110e44ee30419cae1013d2f69cc29bb234
parent01f2798e049401b24be9ccae94919e32f77cebba (diff)
downloadmpv-54b3a9fdb004a85340e502a0e5af27b80c939694.tar.bz2
mpv-54b3a9fdb004a85340e502a0e5af27b80c939694.tar.xz
stats: add current and total chapter number
Fixes #44 (well, partially, I'm still not sure about the time)
-rw-r--r--player/lua/stats.lua9
1 files changed, 8 insertions, 1 deletions
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,