summaryrefslogtreecommitdiff
path: root/debian/.config/mpv/scripts/cycle-video-rotate.lua
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-12-24 13:54:03 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-12-24 13:54:03 +0900
commit28e8bdf7f8286bd431b7f3b709e79f3827b31469 (patch)
tree85b44eff6da4d8443198fb6e04dfb6ee55244588 /debian/.config/mpv/scripts/cycle-video-rotate.lua
parent8470ff001befcfd0f626dea69a9e76d43aee0511 (diff)
updates
Diffstat (limited to 'debian/.config/mpv/scripts/cycle-video-rotate.lua')
-rw-r--r--debian/.config/mpv/scripts/cycle-video-rotate.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/debian/.config/mpv/scripts/cycle-video-rotate.lua b/debian/.config/mpv/scripts/cycle-video-rotate.lua
new file mode 100644
index 0000000..e7be9e2
--- /dev/null
+++ b/debian/.config/mpv/scripts/cycle-video-rotate.lua
@@ -0,0 +1,36 @@
+-- -----------------------------------------------------------
+--
+-- CYCLE-VIDEO-ROTATE.LUA
+-- Version: 1.0
+-- Author: VideoPlayerCode
+-- URL: https://github.com/VideoPlayerCode/mpv-tools
+--
+-- Description:
+--
+-- Allows you to perform video rotation which perfectly
+-- cycles through all 360 degrees without any glitches.
+--
+-- -----------------------------------------------------------
+
+function cycle_video_rotate(amt)
+ -- Ensure that amount is a base 10 integer.
+ amt = tonumber(amt, 10)
+ if amt == nil then
+ mp.osd_message("Rotate: Invalid rotation amount")
+ return nil -- abort
+ end
+
+ -- Calculate what the next rotation value should be,
+ -- and wrap value to correct range (0 (aka 360) to 359).
+ local newrotate = mp.get_property_number("video-rotate")
+ newrotate = (newrotate + amt) % 360
+
+ -- Change rotation and tell the user.
+ mp.set_property_number("video-rotate", newrotate)
+ mp.osd_message("Rotate: " .. newrotate)
+end
+
+-- Bind this via input.conf. Example:
+-- Alt+LEFT script-message Cycle_Video_Rotate -90
+-- Alt+RIGHT script-message Cycle_Video_Rotate 90
+mp.register_script_message("cycle_video_rotate", cycle_video_rotate)