Skip to content

Instantly share code, notes, and snippets.

@ekisu
Created June 27, 2015 11:39
Show Gist options
  • Save ekisu/04924e899648e84f2e18 to your computer and use it in GitHub Desktop.
Save ekisu/04924e899648e84f2e18 to your computer and use it in GitHub Desktop.
vo_battery.lua implementation for Linux
-- If the laptop is on battery, the VO set in the config will be choosen,
-- else the one defined with „hqvo“ is used.
local hqvo = "opengl-hq:interpolation"
local utils = require 'mp.utils'
if mp.get_property_bool("option-info/vo/set-from-commandline") == true then
return
end
t = {}
t.args = {"/bin/cat", "/sys/class/power_supply/AC/online"}
res = utils.subprocess(t)
if res.stdout ~= "0\n" then
mp.msg.info("On AC, setting high-quality options.")
mp.set_property("options/vo", hqvo)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment