osc: update cache display

now similar to what the status line displays
This commit is contained in:
ChrisK2 2014-09-25 11:57:49 +02:00
parent 7aa933cc9e
commit 1c9f30cca7
1 changed files with 14 additions and 3 deletions

View File

@ -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