Guest User

shitty stats.lua hack

a guest
Sep 25th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.11 KB | None | 0 0
  1. local function round(num, idp)
  2.   local mult = 10^(idp or 0)
  3.   return math.floor(num * mult + 0.5) / mult
  4. end
  5.  
  6. local function append_number(s, num, attr, excluded)
  7.     excluded = excluded or {[""] = true}
  8.     local ret = num
  9.  
  10.     attr.prefix_sep = attr.prefix_sep or o.prefix_sep
  11.     attr.indent = attr.indent or o.indent
  12.     attr.nl = attr.nl or o.nl
  13.     attr.suffix = attr.suffix or ""
  14.     attr.prefix = attr.prefix or ""
  15.     attr.no_prefix_markup = attr.no_prefix_markup or false
  16.     attr.prefix = attr.no_prefix_markup and attr.prefix or b(attr.prefix)
  17.     ret = attr.no_value and "" or ret
  18.  
  19.     s[#s+1] = format("%s%s%s%s%s%s", attr.nl, attr.indent,
  20.                      attr.prefix, attr.prefix_sep, no_ASS(ret), attr.suffix)
  21.     return true
  22. end
  23.  
  24. local function add_video(s)
  25.     local scaledh = 0
  26.     local scaledw = 0
  27.     local anamorphic = 0
  28.     local real_window_scale = 0
  29.  
  30.     --  Anamorphic videos are a thing and osd-width/osd-height don't update on Windows for them correctly
  31.     if not (mp.get_property_osd("video-params/dw") == mp.get_property_osd("video-params/w") and mp.get_property_osd("video-params/dh") == mp.get_property_osd("video-params/h")) then
  32.         anamorphic = 1
  33.         append_property(s, "video-params/w", {prefix="Native Resolution:"})
  34.         append_property(s, "video-params/h",
  35.                         {prefix="x", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true})
  36.         append_property(s, "video-params/dw", {prefix="Anamorphic Resolution: ", prefix_sep=""})
  37.         append_property(s, "video-params/dh", {prefix="x", nl = "", indent=" ", prefix_sep=" ", no_prefix_markup=true})
  38.         if mp.get_property_bool("fullscreen") then
  39.             scaledh = round(1440 * mp.get_property_number("video-params/aspect"))
  40.             scaledw = 1440
  41.         else
  42.             scaledh = round(mp.get_property_number("video-params/dw") * mp.get_property_number("window-scale"))
  43.             scaledw = round(mp.get_property_number("video-params/dh") * mp.get_property_number("window-scale"))
  44.         end
  45.         append_number(s, scaledh, {prefix="→", nl = "", indent=" ", prefix_sep=" ", no_prefix_markup=true})
  46.         append_number(s, scaledw, {prefix="x", nl = "", indent=" ", prefix_sep=" ", no_prefix_markup=true})
  47.     else
  48.         append_property(s, "video-params/w", {prefix="Native Resolution:"})
  49.         append_property(s, "video-params/h",
  50.                         {prefix="x", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true})
  51.         append_number(s, mp.get_property_number("osd-width"), {prefix="→", nl = "", indent=" ", prefix_sep=" ", no_prefix_markup=true})
  52.         append_number(s, mp.get_property_number("osd-height"), {prefix="x", nl = "", indent=" ", prefix_sep=" ", no_prefix_markup=true})
  53.     end
  54.  
  55.     -- window-scale is not updated when resizing from smaller than full screen to full screen on Windows
  56.     if not mp.get_property_bool("fullscreen") then
  57.         append_property(s, "window-scale", {prefix="Window Scale:"})
  58.     else
  59.         if anamorphic == 1 then
  60.             real_window_scale = round(1440 / mp.get_property_number("video-params/dh"), 3)
  61.         else
  62.             real_window_scale = round(1440 / mp.get_property_number("video-params/h"), 3)
  63.         end
  64.         append_number(s, real_window_scale, {prefix="Window Scale:"})
  65.     end
Add Comment
Please, Sign In to add comment