Skip to content

command: add support for using playlist entry id for several playlist management commands - #18267

Open
na-na-hi wants to merge 8 commits into
mpv-player:masterfrom
na-na-hi:entry-id
Open

command: add support for using playlist entry id for several playlist management commands#18267
na-na-hi wants to merge 8 commits into
mpv-player:masterfrom
na-na-hi:entry-id

Conversation

@na-na-hi

Copy link
Copy Markdown
Contributor

This PR adds support for using playlist entry id for several playlist management commands (playlist-play-index/loadfile/loadlist/playlist-remove/playlist-move).

This allows the entry to be manipulated specified by its playlist entry id, which does not change when other playlist items are changed or shuffled, so it resolves a race condition when the playlist is changed by another client while one client is finding the index of a specific item.

Fixes: #10082

na-na-hi added 8 commits July 14, 2026 21:04
Will be used in later commits for commands using playlist entry id.
This prevents overflow when specifying very large index values
in later commits.
Add id flag which makes it use playlist entry id specified by the
optional second argument for manipulation.

This also removes the roundtrip entry->index->entry conversion when
"current" is used as pos.
Only 0,1,2,3,8 are read by get_load_action.
Add id flag which makes it interprets index parameter as playlist
entry id.
Add id flag which makes it use playlist entry id specified by the
optional second argument for manipulation.
Add a flag which makes it use playlist entry id for the index arguments.
@kasper93

Copy link
Copy Markdown
Member

I would like to merge #17458 before this one, for the interface simplification.

@na-na-hi

Copy link
Copy Markdown
Contributor Author

I would like to merge #17458 before this one, for the interface simplification.

That PR is incompatible with the API design of the current PR, specifically:

            {"index", OPT_INT(v.i),
                M_RANGE(LOAD_POS_NONE, INT_MAX), OPTDEF_INT(LOAD_POS_NONE)},

The current PR changes the type of this argument to OPT_INT64 so M_RANGE(LOAD_POS_NONE, INT_MAX) cannot stay because playlist entry id can be any 64 bit int.

@kasper93

Copy link
Copy Markdown
Member

The current PR changes the type of this argument to OPT_INT64 so M_RANGE(LOAD_POS_NONE, INT_MAX) cannot stay because playlist entry id can be any 64 bit int.

It should be possible to change the range here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improves playlist management through IPC

2 participants