From 1c9f30cca7b877f988c735735d023014cc554a07 Mon Sep 17 00:00:00 2001 From: ChrisK2 Date: Thu, 25 Sep 2014 11:57:49 +0200 Subject: osc: update cache display now similar to what the status line displays --- player/lua/osc.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/player/lua/osc.lua b/player/lua/osc.lua index fd4a3bb3c6..a241f85a9a 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -1221,9 +1221,20 @@ function osc_init() ne = new_element("cache", "button") ne.content = function (ass) - local cache = mp.get_property_number("cache") - if not (cache == nil) and (cache < 45) then - ass:append("Cache: " .. (math.floor(cache)) .."%") + local dmx_cache = mp.get_property_number("demuxer-cache-duration") + if not (dmx_cache == nil) then + dmx_cache = math.floor(dmx_cache + 0.5) .. "s + " + else + dmx_cache = "" + end + local cache_used = mp.get_property_number("cache-used") + if not (cache_used == nil) then + if (cache_used < 1024) then + cache_used = cache_used .. " KB" + else + cache_used = math.floor((cache_used/102.4)+0.5)/10 .. " MB" + end + ass:append("Cache: " .. dmx_cache .. cache_used) end end -- cgit v1.2.3