-
Notifications
You must be signed in to change notification settings - Fork 230
Description
Is your feature request related to a problem? Please describe.
When executing either run_external_console_command or run_external_command, I'd like some access to the info about the track that the cursor is on, or the list of selected tracks. In other words, wanna be able to move around the various ncmpcpp screens (mostly main playlist), and press buttons to run external commands targeting things I selected in ncmpcpp.
There's a bunch of usecases that need this, but for a concrete example, I wanna make some scripts so that when i press 'S' in ncmpcpp, the selected track would be set to "liked" in another app I have (Navidrome). Similarly, i'd have a button for flagging tracks for certain other playlists, etc.
Describe the solution you'd like
I'd like to be able to do keybinds like this:
def_key "t"
run_external_console_command "/path/to/myscript.sh $@"
dummy
def_key "y"
run_external_command "/path/to/myotherscript.sh $@"
dummy
where $@ (or some other string) would expand into the path of the selected track (directory + filename, relative to "music_dir" of MPD perhaps). or maybe it could set and ENV variable for the external command like $SELETED_PATHS that contains the same info.
Describe alternatives you've considered
I know I can access the "currently playing" track in some way (via mpc), but that's not good enough for the above usecase. Sometimes I need to "target" the selected track, not one that's playing now. (i.e. maybe i'm looking at something that played a few tracks ago, etc.)
Additional context
fwiw, cmus music player does this for their :run command, where the {} expands into list of selected files. https://github.com/cmus/cmus/blob/d0a685d22ca510a911641044f3f7ff6f6b0cc6be/Doc/cmus.txt#L601
Also, a question: what exactly is the difference between run_external_command and run_external_console_command ? I didn't find a lot of explanation in the readme or the code.
Thank you for your attention.