From c364879e9fd347c98c6ab2c080b1bb6a15362175 Mon Sep 17 00:00:00 2001 From: LaserEyess Date: Wed, 15 Apr 2020 13:22:35 -0400 Subject: stats: add edition information to page 1 Edition information is conditional based on there being more than one edition present. It is printed on the same line as Chapters to save vertical space. --- player/lua/stats.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/player/lua/stats.lua b/player/lua/stats.lua index c10fb53249..b3e2320ac2 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -475,9 +475,21 @@ local function add_file(s) local fs = append_property(s, "file-size", {prefix="Size:"}) append_property(s, "file-format", {prefix="Format/Protocol:", nl=fs and "" or o.nl}) + local editions = mp.get_property_number("editions") + local edition = mp.get_property_number("current-edition") + local ed_cond = (edition and editions > 1) + if ed_cond then + append_property(s, "edition-list/" .. tostring(edition) .. "/title", + {prefix="Edition:"}) + append_property(s, "edition-list/count", + {prefix="(" .. tostring(edition + 1) .. "/", suffix=")", nl="", + indent=" ", prefix_sep=" ", no_prefix_markup=true}) + end + 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/" .. tostring(ch_index) .. "/title", {prefix="Chapter:", + nl=ed_cond and "" or o.nl}) append_property(s, "chapter-list/count", {prefix="(" .. tostring(ch_index + 1) .. "/", suffix=")", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true}) -- cgit v1.2.3