Esempio n. 1
0
    public Script()
    {
        string     content     = "ctrl+w script-message my-message-1 my-argument-1";
        string     sectionName = Assembly.GetExecutingAssembly().GetName().Name;
        CorePlayer core        = Global.Core;

        core.CommandV("define-section", sectionName, content, "force");
        core.CommandV("enable-section", sectionName);
        core.ClientMessage += ClientMessage;
    }
Esempio n. 2
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");
        }
    }
Esempio n. 3
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);
                });
            }
        }
    }
    void ContextMenu_Opening(object sender, CancelEventArgs e)
    {
        // edit input.conf and add 'Edition' menu item there
        MenuItem menuItem = MainForm.FindMenuItem("Edition");

        if (menuItem == null)
        {
            return;
        }

        menuItem.DropDownItems.Clear();
        var editionTracks = Core.MediaTracks.Where(track => track.Type == "e");

        foreach (MediaTrack track in editionTracks)
        {
            MenuItem mi = new MenuItem(track.Text);
            mi.Action  = () => { Core.CommandV("set", "edition", track.ID.ToString()); };
            mi.Checked = Core.Edition == track.ID;
            menuItem.DropDownItems.Add(mi);
        }
    }
Esempio n. 5
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);
        }
    }
 void FullscreenChange(bool value)
 {
     Core.CommandV("show-text", "fullscreen: " + value);
 }