In the settings, you can set a keyboard shortcut to run a shell or system command. There are also separate options to run shell or system commands on selected songs. I have never seen any documentation that explains how to use this.
First, I don't understand the difference between a system command and a shell command. Second, let's say I want to run a shell command,
cp * ~/Temp where * are my selected songs. What would be the syntax in the arguments?
A system command is an executable file, a shell command is passed to the shell, usually bash, and the shell parse it and execute it, it may just run an executable file, but it can do a lot more, like multiple commands, conditions, loops ..., which also comes at a cost of potentially having to escape some characters so they are not interpreted specially. By the way in your example with a *, it's the shell that replace the * with a list of files (which is very useful from a command line, not so much from within gmb)
There is not much documentation for this, though one is the tooltip in the argument entry, the other is the common scheme of replacing fields like %t or $title in gmb, you can check the fields tab to see the variable you can use for each field.
"Run a shell command"
- will run a shell command, so if you want to copy the current song's file you can put "cp $f ~/Temp",
- variables such as %f, %t or $album will refer to the current song ie: the one playing or that would be played if you'd press play.
"Run a shell command on selected songs"
- will, like the tooltip mention, either run one command if $files is used, such as "cp $files ~/Temp" or run one command for each selected file with "cp $f ~/Temp"
- variables such as %f, %t or $album will refer to each selected songs in the focused widget of the current window
of course with cp, one command for all files or one command per file doesn't make much of a difference, but that can be handy with other commands
An easy way to experiment is launching gmb from a terminal and using a command such as "echo %t" or "ls -l %f" and check the output in the terminal.
Hi Quentin, thanks so much for the reply, and sorry for my slow response. I didn't get a notification email, but I'll check my settings.
This is great. I don't know perl, and I've always wished I could contribute something to gmb. Maybe I could write some clever bash command to extend its functionality.
The echo experiment worked fine. cp $f ~/Temp has mixed results, partly because multiple tracks can be selected in different windows. I had a few tracks selected in an open playlist, and then I went to the artist panel and selected some more, but it only copied the tracks in the playlist. Any subsequent tests caused gmb to crash.
Anyway, I will keep playing with this. I have my music collection synced to my phone, and I used a symlink to make the paths match, so I can mount my phone, select a bunch of songs, and now I can easily select a bunch of songs and create a playlist with one key command. That's exciting.
I'm following gmb on github, and I'm so glad to see it's still in active development. I spend years and years looking for the ultimate music manager, and I still think gmb blows everything else out of the water. If I have any ideas for features or improvements, would you rather I mention that here, or on github?
Thanks again for everything you're doing.