You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Accessing selected song info from run_external_command #605
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:
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.)
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.
changed the title [-]Accessing selected song info from run_external_command/run_external_console_command[/-][+]Accessing selected song info from run_external_command[/+]on Aug 14, 2024
Yes this would be useful in numerous ways like I keep a different database to hold the ratings of songs, with this I could easily pass the filepath of the song to the script that rates the song. Also to send songs to the Trash than permanently delete the song. It will also make group/classify/process songs.
Or at least provide a way of getting the current selected song as the current song being played is not always going to be the same the one user has selected in the player.
From a little experimentation, it seems like run_external_console_command handles commands which modify the contents of the terminal. Like, for example, other TUI programs.
If you try to use a TUI program with run_external_command, when you return to ncmpcpp a lot of the UI will be missing.
Activity
[-][FEATURE / QUESTION][/-][+]Accessing selected song info from run_external_command/run_external_console_command[/+][-]Accessing selected song info from run_external_command/run_external_console_command[/-][+]Accessing selected song info from run_external_command[/+]pt321 commentedon Aug 21, 2024
Yes this would be useful in numerous ways like I keep a different database to hold the ratings of songs, with this I could easily pass the filepath of the song to the script that rates the song. Also to send songs to the Trash than permanently delete the song. It will also make group/classify/process songs.
Or at least provide a way of getting the current selected song as the current song being played is not always going to be the same the one user has selected in the player.
jwren0 commentedon Oct 23, 2024
From a little experimentation, it seems like run_external_console_command handles commands which modify the contents of the terminal. Like, for example, other TUI programs.
If you try to use a TUI program with run_external_command, when you return to ncmpcpp a lot of the UI will be missing.