script update
This commit is contained in:
@@ -639,6 +639,11 @@ namespace mpvnet
|
|||||||
IsLogoVisible = false;
|
IsLogoVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Command(string command, bool throwException = false)
|
||||||
|
{
|
||||||
|
this.command(command, throwException);
|
||||||
|
}
|
||||||
|
|
||||||
public void command(string command, bool throwException = false)
|
public void command(string command, bool throwException = false)
|
||||||
{
|
{
|
||||||
mpv_error err = mpv_command_string(Handle, command);
|
mpv_error err = mpv_command_string(Handle, command);
|
||||||
@@ -647,6 +652,11 @@ namespace mpvnet
|
|||||||
HandleError(err, throwException, "error executing command:", command);
|
HandleError(err, throwException, "error executing command:", command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CommandV(params string[] args)
|
||||||
|
{
|
||||||
|
commandv(args);
|
||||||
|
}
|
||||||
|
|
||||||
public void commandv(params string[] args)
|
public void commandv(params string[] args)
|
||||||
{
|
{
|
||||||
int count = args.Length + 1;
|
int count = args.Length + 1;
|
||||||
@@ -737,6 +747,11 @@ namespace mpvnet
|
|||||||
HandleError(err, throwException, $"error setting property: {name} = {value}");
|
HandleError(err, throwException, $"error setting property: {name} = {value}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetPropertyInt(string name, bool throwException = false)
|
||||||
|
{
|
||||||
|
return get_property_int(name, throwException);
|
||||||
|
}
|
||||||
|
|
||||||
public int get_property_int(string name, bool throwException = false)
|
public int get_property_int(string name, bool throwException = false)
|
||||||
{
|
{
|
||||||
mpv_error err = mpv_get_property(Handle, GetUtf8Bytes(name),
|
mpv_error err = mpv_get_property(Handle, GetUtf8Bytes(name),
|
||||||
@@ -768,6 +783,11 @@ namespace mpvnet
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetPropertyNumber(string name, double value, bool throwException = false)
|
||||||
|
{
|
||||||
|
set_property_number(name, value, throwException);
|
||||||
|
}
|
||||||
|
|
||||||
public void set_property_number(string name, double value, bool throwException = false)
|
public void set_property_number(string name, double value, bool throwException = false)
|
||||||
{
|
{
|
||||||
double val = value;
|
double val = value;
|
||||||
|
|||||||
@@ -8,6 +8,3 @@ osd-duration = 2000
|
|||||||
osd-playing-msg = '${filename}'
|
osd-playing-msg = '${filename}'
|
||||||
script-opts = osc-scalewindowed=1.5,osc-hidetimeout=2000,console-scale=1
|
script-opts = osc-scalewindowed=1.5,osc-hidetimeout=2000,console-scale=1
|
||||||
screenshot-directory = '~~desktop/'
|
screenshot-directory = '~~desktop/'
|
||||||
|
|
||||||
[protocol.https]
|
|
||||||
osd-playing-msg = '${media-title}'
|
|
||||||
|
|||||||
@@ -3,8 +3,11 @@
|
|||||||
|
|
||||||
// In input.conf add:
|
// In input.conf add:
|
||||||
|
|
||||||
// KP0 script-message delete-current-file ask #menu: Script > Delete current file > Ask
|
// KP0 script-message delete-current-file delete #menu: Script > Delete current file > Delete
|
||||||
|
// 0 script-message delete-current-file delete #menu: Script > Delete current file > Delete
|
||||||
|
|
||||||
// KP1 script-message delete-current-file confirm #menu: Script > Delete current file > Confirm
|
// KP1 script-message delete-current-file confirm #menu: Script > Delete current file > Confirm
|
||||||
|
// 1 script-message delete-current-file confirm #menu: Script > Delete current file > Confirm
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -31,37 +34,34 @@ class Script
|
|||||||
if (args == null || args.Length != 2 || args[0] != "delete-current-file")
|
if (args == null || args.Length != 2 || args[0] != "delete-current-file")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (args[1] == "ask")
|
if (args[1] == "delete")
|
||||||
{
|
{
|
||||||
FileToDelete = Core.get_property_string("path");
|
FileToDelete = Core.GetPropertyString("path");
|
||||||
DeleteTime = DateTime.Now;
|
DeleteTime = DateTime.Now;
|
||||||
Core.commandv("show-text", "Press 1 to delete file", "10000");
|
Core.CommandV("show-text", "Press 1 to delete file", "10000");
|
||||||
}
|
}
|
||||||
else if (args[1] == "confirm")
|
else if (args[1] == "confirm")
|
||||||
{
|
{
|
||||||
TimeSpan ts = DateTime.Now - DeleteTime;
|
TimeSpan ts = DateTime.Now - DeleteTime;
|
||||||
string path = Core.get_property_string("path");
|
string path = Core.GetPropertyString("path");
|
||||||
|
|
||||||
if (FileToDelete == path && ts.TotalSeconds < 10 && File.Exists(FileToDelete))
|
if (FileToDelete == path && ts.TotalSeconds < 10 && File.Exists(FileToDelete))
|
||||||
{
|
{
|
||||||
Core.command("playlist-remove current");
|
Core.CommandV("show-text", "");
|
||||||
int pos = Core.get_property_int("playlist-pos");
|
|
||||||
|
|
||||||
if (pos == -1)
|
int count = Core.GetPropertyInt("playlist-count");
|
||||||
{
|
int pos = Core.GetPropertyInt("playlist-pos");
|
||||||
int count = Core.get_property_int("playlist-count");
|
int newPos = pos == count - 1 ? pos - 1 : pos + 1;
|
||||||
|
|
||||||
if (count > 0)
|
if (newPos > -1)
|
||||||
Core.set_property_int("playlist-pos", count - 1);
|
Core.SetPropertyNumber("playlist-pos", newPos);
|
||||||
else
|
|
||||||
{
|
|
||||||
Core.ShowLogo();
|
|
||||||
Core.commandv("show-text", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Core.Command("playlist-remove " + pos);
|
||||||
|
|
||||||
|
App.RunTask(() => {
|
||||||
Thread.Sleep(2000);
|
Thread.Sleep(2000);
|
||||||
FileSystem.DeleteFile(FileToDelete, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
|
FileSystem.DeleteFile(FileToDelete, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
-- This script removes the currently playing file from the playlist
|
-- This script deletes the file that is currently playing.
|
||||||
-- and moves it into the recycle bin. Works only on Windows.
|
|
||||||
|
|
||||||
-- input.conf:
|
-- input.conf:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user