diff --git a/scripts/fullscreen.cs b/scripts/fullscreen.cs deleted file mode 100644 index 94e6506..0000000 --- a/scripts/fullscreen.cs +++ /dev/null @@ -1,16 +0,0 @@ -using mpvnet; - -class Script -{ - public Script() - { - var fs = mp.get_property_string("fullscreen"); - mp.commandv("show-text", "fullscreen: " + fs); - mp.observe_property_bool("fullscreen", FullscreenChange); - } - - void FullscreenChange(bool val) - { - mp.commandv("show-text", "fullscreen: " + val.ToString()); - } -} \ No newline at end of file diff --git a/scripts/seek-show-position.js b/scripts/seek-show-position.js deleted file mode 100644 index b6d89e3..0000000 --- a/scripts/seek-show-position.js +++ /dev/null @@ -1,31 +0,0 @@ -// when seeking displays position and -// duration like so: 70:00 / 80:00 -// which is different from mpv which -// uses 01:10:00 / 01:20:00 - -function add_zero(val) -{ - val = Math.round(val); - return val > 9 ? "" + val : "0" + val; -} - -function format(val) -{ - var sec = Math.round(val); - - if (sec < 0) - sec = 0; - - pos_min_floor = Math.floor(sec / 60); - sec_rest = sec - pos_min_floor * 60; - return add_zero(pos_min_floor) + ":" + add_zero(sec_rest); -} - -function on_seek(_) -{ - mp.commandv("show-text", - format(mp.get_property_number("time-pos")) + " / " + - format(mp.get_property_number("duration"))); -} - -mp.register_event("seek", on_seek); \ No newline at end of file diff --git a/scripts/seek.ps1 b/scripts/seek.ps1 deleted file mode 100644 index f3b4203..0000000 --- a/scripts/seek.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -$position = [mp]::get_property_number("time-pos"); -[mp]::commandv("show-text", $position.ToString() + " seconds") \ No newline at end of file diff --git a/wiki/scripting.md b/wiki/scripting.md deleted file mode 100644 index 4468309..0000000 --- a/wiki/scripting.md +++ /dev/null @@ -1,67 +0,0 @@ -Here is a list of scripts that users of mpv(.net) have published, adding functionality that is not part of the core mpv(.net) player. Anyone can add their own script by editing this wiki. Scripts are usually placed in C:\Users\user\AppData\Roaming\mpv\scripts - -### C# - -``` -using mpvnet; - -class Script -{ - public Script() - { - var fs = mp.get_property_string("fullscreen"); - mp.commandv("show-text", "fullscreen: " + fs); - mp.observe_property_bool("fullscreen", FullscreenChange); - } - - void FullscreenChange(bool val) - { - mp.commandv("show-text", "fullscreen: " + val.ToString()); - } -} -``` - -### Python - -``` -# when seeking displays position and -# duration like so: 70:00 / 80:00 -# which is different from mpv which -# uses 01:10:00 / 01:20:00 - -import math - - -def seek(): - pos = mp.get_property_number("time-pos") - dur = mp.get_property_number("duration") - - if pos > dur: - pos = dur - - mp.commandv('show-text', format(pos) + " / " + format(dur)) - -def format(f): - sec = round(f) - - if sec < 0: - sec = 0 - - pos_min_floor = math.floor(sec / 60) - sec_rest = sec - pos_min_floor * 60 - return add_zero(pos_min_floor) + ":" + add_zero(sec_rest) - -def add_zero(val): - val = round(val) - return "" + str(int(val)) if (val > 9) else "0" + str(int(val)) - -mp.register_event("seek", seek) # or use: mp.Seek += seek -``` - -### PowerShell - -``` -$position = [mp]::get_property_number("time-pos"); -[mp]::commandv("show-text", $position.ToString() + " seconds") -``` -Please note that PowerShell don't allow assigning to events and mpv.net uses as workaround a matching script filename, a list of available events can be found in the mpv manual or in the file mp.cs in the mpv.net source code. \ No newline at end of file