summaryrefslogtreecommitdiffstats
path: root/.config/mpv/scripts/reload.lua
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-04-22 23:35:06 +0200
committerJoe <rbo@gmx.us>2024-04-22 23:35:06 +0200
commit528c35de2a67b8e87ff9bb6d7f7de692cb4a31bc (patch)
tree47ea5d822d948e3e5119619c019fe9b62bc07135 /.config/mpv/scripts/reload.lua
parentup (diff)
downloaddotfiles-bsd-528c35de2a67b8e87ff9bb6d7f7de692cb4a31bc.tar.gz
dotfiles-bsd-528c35de2a67b8e87ff9bb6d7f7de692cb4a31bc.tar.bz2
dotfiles-bsd-528c35de2a67b8e87ff9bb6d7f7de692cb4a31bc.tar.xz
dotfiles-bsd-528c35de2a67b8e87ff9bb6d7f7de692cb4a31bc.tar.zst
dotfiles-bsd-528c35de2a67b8e87ff9bb6d7f7de692cb4a31bc.zip
up
Diffstat (limited to '.config/mpv/scripts/reload.lua')
-rw-r--r--.config/mpv/scripts/reload.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/.config/mpv/scripts/reload.lua b/.config/mpv/scripts/reload.lua
new file mode 100644
index 0000000..d07ab08
--- /dev/null
+++ b/.config/mpv/scripts/reload.lua
@@ -0,0 +1,19 @@
+--[[
+ reload / by sibwaf / https://github.com/sibwaf/mpv-scripts
+
+ Reopens the current playing file and seeks to the same timestamp on a button press ([Shift+R] by default).
+ Useful for situations when you are watching YouTube/streams and your connection breaks for some reason.
+
+ MIT license - do whatever you want, but I'm not responsible for any possible problems.
+ Please keep the URL to the original repository. Thanks!
+]]
+
+function reload()
+ local path = mp.get_property("path")
+ if path ~= nil then
+ local time = mp.get_property_number("time-pos")
+ mp.commandv("loadfile", path, "replace", "start=" .. time)
+ end
+end
+
+mp.add_key_binding("R", "reload", reload)