This commit is contained in:
Frank Skare
2019-03-28 02:04:55 +01:00
parent 6669a42dcd
commit 448add600b
5 changed files with 55 additions and 88 deletions

16
scripts/fullscreen.cs Normal file
View File

@@ -0,0 +1,16 @@
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());
}
}

View File

@@ -0,0 +1,31 @@
// 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);

2
scripts/seek.ps1 Normal file
View File

@@ -0,0 +1,2 @@
$position = [mp]::get_property_number("time-pos");
[mp]::commandv("show-text", $position.ToString() + " seconds")