Last active
August 23, 2023 12:46
Star
You must be signed in to star a gist
mpv script - remember audio volume
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local filepath = mp.command_native({"expand-path", "~~/volume"}) | |
local loadfile = io.open(filepath, "r") | |
if loadfile then | |
set_volume = string.sub(loadfile:read(), 8) | |
loadfile:close() | |
mp.set_property_number("volume", set_volume) | |
end | |
mp.register_event("shutdown", | |
function() | |
local savefile = io.open(filepath, "w+") | |
savefile:write("volume=" .. mp.get_property("volume"), "\n") | |
savefile:close() | |
end | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The above line works fine for mpv on Linux,
but It doesn't work well with mpv on Windows.
In order to work normally on both Windows and Linux, you need to modify it as follows.