mpv-player / mpv-player/mpv

mp.utils.remove_file for JS API

Open
#13,305 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

meta:feature-request
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

There are:
https://github.com/mpv-player/mpv/blob/22e21edbd40ed0f937ab3bb52d0aa18db7ef18f8/player/javascript/defaults.js#L708-L709
https://github.com/mpv-player/mpv/blob/22e21edbd40ed0f937ab3bb52d0aa18db7ef18f8/player/javascript.c#L1211-L1212

but no mp.utils.remove_file which is also very useful.

Right now my workaround:

function remove_file(path: string) {
  if (mp.get_property("platform") === "windows") {
    mp.command_native({
      name: "subprocess",
      args: ["del", path],
      playback_only: false,
    });
  } else {
    mp.command_native({
      name: "subprocess",
      args: ["rm", path],
      playback_only: false,
    });
  }
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the existing utility entries at player/javascript/defaults.js#L708-L709 and player/javascript.c#L1211-L1212. Trace how those JavaScript API utilities are exposed, then add the requested mp.utils.remove_file behavior with platform-independent file removal. Done means JavaScript callers can remove a file without using platform-specific subprocess commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, javascript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.