Feature Request: Tool parameter options


#1

Using MP3Tag Tools, it is possible to run an external application, and to pass several parameters to the external application. Currently, these parameters are generally limited to fixed text, a single file name, or a filepath. More complex operations require use of the exporting capability to create batch files that run or used as input to the external application.

This request relates to the ability to pass a list, e.g. all the file names that are currently selected, to the external application. For example, MP3GAIN can be invoked using a command line as follows:

Mp3gain.exe /s I track1.mp3 track2.mp3 track3.mp3 track4.mp3

This command enables mp3gain to analyze the volumes of the listed tracks, understanding that the list represents an album whose tracks should be adjusted together.

Implementing this feature could also help to alleviate the problem where mp3gain, or any external application, is invoked once for each file selected, thereby running many instances of the external application simultaneously.


#2

It can be a lot simpler than that. You can pass a folder path to an already created batch file or script, which can in turn expand the file list and launch the application that needs a list. I have a similar script (VBScript) that runs metaflac.exe to add ReplayGain to FLAC files. Since metaflac can't expand a wildcard (*.flac) argument, it too needs a list of files.

In Mp3tag's tool configuration dialog there's a checkbox labeled "for all selected files". Just leave this unchecked and the tool will only be run once. In practice, this means that you only need to select one file in the folder to launch the tool.


#3

JJ,

Thanks for your quick response. Your thoughts helped me to think of a partial solution as follows:

Tool1: Uses "for all selected files", and invokes a script that adds each %_filename_ext% to "list.txt".

Tool2: invokes a script that runs the external application and passes along the data from "list.txt".

A potential problem with this solution is that a bunch of windows will be opened up (depending on the number of files selected), potentially crashing my computer. (The capability to wait for the first window to close before starting the second, akin to start /wait, has already been brought up elsewhere in this forum.)

I still believe the original feature request has merit in that:

  1. The capability to pass an ad hoc list (not based on path or filename wildcards) of files, based on the currently selected files, to a external application does not currently exist (without a programming exercise).
  2. The capability is of general use.
  3. The capability is not too difficult to implement (what do I know)...

I'm still all ears regarding an elegant solution - one that can be implemented with a single Tool, and not crash my computer if a large number of files is selected.


#4

You mention something that might even be considered an argument against Mp3tag implementing this... When you select a large number of files, you can't pass an arbitrarily large number of arguments on the command line, as there's a limit to the number of characters that can be in a command line (8192, IIRC). Normally, you would only pass a folder/album's worth of file names to mp3gain.

There shouldn't be any need to run two tools to accomplish this. Anything that can generate a list of file names within a folder should also be able to run an EXE (batch file, VBScript, PowerShell, etc.).

I've attached a VBScript (mp3g.txt - you'll have to change the extention to .vbs) that is a modification of my FLAC ReplayGain script, and should do the job. Set it up in Mp3tag's tools similar to the following, changing the name to whatever you like, and setting the location of the vbs script on your system:

Name: Mp3gain
Path: C:\WINDOWS\system32\wscript.exe
Parameter: "C:\util\mp3g.vbs" /d:0 "%_folderpath%"
(unchecked) for all selected files

In the script itself, edit lines 4 and 5 to point to the location of mp3gain.exe on your system, and to set the Mp3gain options that you use.

mp3g.txt (3.7 KB)


#5

JJ-

Nice script - works great. I have dabbled in VBS but would never have come up with anything as nice as that.

However, I think I am going to stick with my "Export-to-create-a-batch-file" approach. My export file contains one line per album. Each line invokes mp3gain and passes it a parameter based on the track's tag. Specifically, I use %contentgroup% to define whether replaygain_track_gain or replaygain_album_gain should be applied to the tracks in the album. I do not think it is possible to pass %contentgroup%, or any other descriptive tag, to an external application.

Foobar boiled ReplayGain operations down to 6 functions that make sense to me:

  1. Scan selected files on a per track basis
  2. Scan selected files as a single album.
  3. Scan selected files as albums (by tags)
  4. Remove ReplayGain information from files
  5. Apply track ReplayGain
  6. Apply album ReplayGain

I think I can make export configurations that match these functions closely enough. If I'm successful, I'll start another thread, more specifically focused on "Adding Volume Leveling to MP3Tag".

Thanks for your help.


#6

I just discovered that version 1.5.2 of the command-line mp3gain.exe doesn't need each file to be enumerated and can instead use a simple wildcard (*.mp3). It's not mentioned in the documentation.

For this particular application, the capability requested is therefore unnecessary. Invoking the tool becomes trivial.


#7

That's the way I was using it already. As long as files are named with a strict convention (e.g. %artist%-%album%-%track%-%title%.mp3), you can leave all of your tracks in one huge directory and export %artist%-%album%*.mp3 to each line in a batch file.

That is still not the same as the generic capability of passing an ad hoc list of files....


#8

No it's not, but do you actually do that? Jam everything together into one huge directory? Most people avoid doing that. Then it doesn't matter what your file naming convention is - *.mp3 covers it.


#9

MP3Tag's renaming capability makes it very easy to change from one directory structure (all in one) to another (subdirectories for artist, album, etc.). For ReplayGain tagging, I guess I'm going to use subdirectories...