mpv-player / mpv-player/mpv

Properly save playlist file positions with --save-position-on-quit

Open
#8,138 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently, the way mpv saves and restores the playback position of a playlist, is that it finds the first playlist entry which has a saved position, and resumes playing that file. However, this logic exhibits unpleasant behavior in some situations:

  • Playing a playlist containing files A,B,C, quitting/saving on C, then playing the individual file A and quitting/saving, causes mpv to resume playing on A when told to resume playing the playlist. The expected behavior is to resume playing C.
  • Playing a playlist containing files A,B,C,D,E, quitting/saving anywhere, then playing another playlist containing files A,C,E, and quitting/saving on any file that's before the current file in the first playlist, confuses mpv when trying to play the first playlist as it tries to resume from the file from the second playlist. The expected behavior is probably that each playlist has its own individual position.
  • Playing a playlist containing files A,B,A, then quitting/saving on the second A, causes mpv to resume from the first A when told to resume playing the playlist.
Expected behavior of the wanted feature

It would be better to replace this heuristic with properly saving the playback position of a playlist file, same as for video files (though counting playlist entry indices instead of time).

Of note is that the current behavior also makes it difficult to implement (either in mpv or as a user script) the option to never delete the currently saved position, and/or save the current position periodically, because lest the remnant / periodically-saved positions are cleaned up in some manner, they interfere with detecting which file in a playlist mpv should resume playback from.

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 with player/configfiles.c, especially the playlist position save and restore logic linked in the issue, and trace the --save-position-on-quit entry point. Completion means restoring a playlist by its saved entry index rather than inferring it from individual file positions, including duplicate entries and overlapping playlists. No test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.