Exemplo n.º 1
0
    //handles keys defined in input.conf
    void ClientMessage(string[] args)
    {
        if (args == null || args.Length != 2 || args[0] != "rate-file")
        {
            return;
        }

        int rating;

        if (int.TryParse(args[1], out rating))
        {
            string path = Core.GetPropertyString("path");

            if (!File.Exists(path))
            {
                return;
            }

            Dic[path] = rating;
            Core.CommandV("show-text", "Rating: " + rating);
        }
        else if (args[1] == "about")
        {
            MessageBox.Show("This extension writes a rating to the filename of rated videos when mpv.net shuts down.",
                            "Rating Extension");
        }
    }
Exemplo n.º 2
0
    void ClientMessage(string[] args)
    {
        if (args == null || args.Length != 2 || args[0] != "delete-current-file")
        {
            return;
        }

        if (args[1] == "delete")
        {
            FileToDelete = Core.GetPropertyString("path");
            DeleteTime   = DateTime.Now;
            Core.CommandV("show-text", "Press 1 to delete file", "10000");
        }
        else if (args[1] == "confirm")
        {
            TimeSpan ts   = DateTime.Now - DeleteTime;
            string   path = Core.GetPropertyString("path");

            if (FileToDelete == path && ts.TotalSeconds < 10 && File.Exists(FileToDelete))
            {
                Core.CommandV("show-text", "");

                int count  = Core.GetPropertyInt("playlist-count");
                int pos    = Core.GetPropertyInt("playlist-pos");
                int newPos = pos == count - 1 ? pos - 1 : pos + 1;

                if (newPos > -1)
                {
                    Core.SetPropertyNumber("playlist-pos", newPos);
                }

                Core.Command("playlist-remove " + pos);

                App.RunTask(() => {
                    Thread.Sleep(2000);
                    FileSystem.DeleteFile(FileToDelete, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                });
            }
        }
    }
Exemplo n.º 3
0
    //handles keys defined in input.conf
    void ClientMessage(string[] args)
    {
        if (args[0] != "rate-file")
        {
            return;
        }

        int rating;

        if (int.TryParse(args[1], out rating))
        {
            string path = Core.GetPropertyString("path");

            if (!File.Exists(path))
            {
                return;
            }

            Dic[path] = rating;
            Core.CommandV("show-text", "Rating: " + rating);
        }
    }