mpv
This commit is contained in:
parent
227161c1a6
commit
61e5074af3
2 changed files with 39 additions and 0 deletions
5
.config/mpv/mpv.conf
Normal file
5
.config/mpv/mpv.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
sub-font=Inter
|
||||
sub-blur=10
|
||||
slang=eng,spa
|
||||
save-position-on-quit=yes
|
||||
hwdec=vaapi
|
34
.config/mpv/scripts/playlist.lua
Normal file
34
.config/mpv/scripts/playlist.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
mp.add_key_binding("y", "fzf", function ()
|
||||
local pl = mp.get_property_native("playlist")
|
||||
if not pl then return end
|
||||
|
||||
local input_path = os.tmpname()
|
||||
local input_file = io.open(input_path, "w")
|
||||
for i, v in pairs(pl) do
|
||||
local desc = v.filename
|
||||
if v.title then desc = v.title end
|
||||
input_file:write(i-1 .. ": " .. desc .. "\n")
|
||||
end
|
||||
input_file:close()
|
||||
|
||||
local output_path = os.tmpname()
|
||||
os.execute("footclient bash -i -c 'cat "..input_path.." | fzf --no-sort > "..output_path.."'")
|
||||
|
||||
local output_file = io.open(output_path, "r")
|
||||
local line = output_file:read("*l")
|
||||
output_file:close()
|
||||
os.remove(output_path)
|
||||
|
||||
if line then
|
||||
local index = string.match(line, "%d+")
|
||||
mp.commandv("playlist-play-index", index)
|
||||
end
|
||||
|
||||
os.remove(input_path)
|
||||
end)
|
||||
|
||||
mp.observe_property("media-title", "native", function (name, value)
|
||||
if value then
|
||||
print("Playing: " .. value)
|
||||
end
|
||||
end)
|
Loading…
Reference in a new issue