|
Documentation
Copyright (c) 2008 Kerry Mitchell Released under the GNU Lesser General Public License Version 3 (LGPLv3) PurposeI had a need. I wanted something that could help me handle my FLAC library. Verify that the files were not corrupt, Re-Encode them if a new version of FLAC came out that had better compression, decode them back to a WAV file, or allow me to easily convert to MP3s for portable devices. I considered a VB GUI app, possibly a VB console app... but decided that I wanted the freedom of a VB Script. The code isn't compiled, and if I need something for a special situation, this provides an easy way to modify the code. There are other applications out there, probably with more features, but for simplicty and ease of use, I rolled my own. Basic useYou set up a config file with the values you want to use, and then run the program (optioanlly with command line parameters). Some of the required information is:
The program can be run in one of the following modes at a time:
There are three choices
Accepts a Y or N value. If N, the script will execute in standard single command window mode. If the Y value is used, the script will check the number of processors, if it detects only one the script will process normally. If more that one processor is detected, multi-processor mode will be used. In multi-processor mode, the initial window will process the directory/file list/file only, no actual file processing. The script will spawn 1 additional script for each processor with the same initial command line that was used to run the program. Each of these "child" processes will actually process the file. If a child process fails, it will be detected and restarted. This process uses files in the Temp directory to pass information back and forth betweem the running scripts.
Used to determine which tagger will be used for copying tags from FLAC to MP3. Tag.exe will be used to remove ID3v2 tags from FLAC files regardless of the selection.
A little discussion on the other command line/config file parameters: HELP Only valid on the command line, will display a list of valid parameters PAUSE Valid on the command line with no value (just -PAUSE), or in the configuration file on a line by itself. This will cause the program to pause after execution rather than just exiting. LOGDIR If this parameter is used, it should be the first command line argument or first entry in the config file. The log directory to be used. This parameter can include variables (internal variables and Commnd Line/Config File properties). These variables should be included inline surrounded by % (percent) signs or ^ (carats). In addition to the normal variables, the following may also be used:
The directory that the script resides in Allows a format using the start time from the script, the format can be any combination of the following: For example, given a script (D:\Re-FLACer\Re-FLACer.vbs) run in MP3 mode with a start date/time of January 2, 2008 at 3:45:05 PM and a LOGDIR of %SCRIPTDIR%\%DATE-YYYYMMDD HHMISS%-%MODE% or ^SCRIPTDIR^\^DATE-YYYYMMDD HHMISS^-^MODE^, the log directory would be: D:\Re-FLACer\20080102 154505-MP3 CONFIG The program always expects a configuration file (Re-FLACer.cfg) to be present in the script directory. This config file is read first, then any command line options are processed in the order they appear on the command line. You can load another config file from the command line that can override any values that exist in the original config file, or appear on the command line earlier than the CONFIG parameter. SYNCHRONIZE If this flag is set to Y then all files that are encoded or decoded will have the file modified date set to that of the original file. If the file dates and times are equal, the file will be skipped. LOGFILENAME The program will log all of it's information to the LOGFILENAME in the script directory TARGETDIR If this parameter is left blank, the action will occur the the original file's directory. If this value is populated, the resulting directory (if any) will be determined based on the type of Input:
COPYFILEMASKS This parameter will contain a pipe (|) delimited list of file masks that should be copied to the TARGETDIR. You can specify the fill filename, or a standard DOS mask that includes the ? or * wildcards. The mask will be applied regardless in a case-insensitive manner. For example, to copy the folder image and any log files, you would use a COPYFILEMASKS=folder.jpg|*.log FLAC Related
The full path and filename to flac.exe
Parameters used to decode files from FLAC
Parameters used to encode a file to FLAC
Parameters used to test a FLAC file for validity
The full path and filename to metaflac.exe
Skip the file for processing if the version of the FLACPROGRAM is the same as the version of the FLAC file being processed.
Valid values are Y or N. This parameter is only valid for the ENCODE and REFLAC modes. Will only process the files using the DIR parameter. The top level DIR cannot be a UNC path, it must contain a drive letter. Replay Gain will be added using metaflac with the "--show-sample-rate" and "--add-replay-gain" parameters. All files in a given directory will be considered part of the album. If SYNCHRONIZE=Y and all files already have Replay Gain, the processing will be skipped.
metaflac parameters to be used to apply Replay Gain.
Images can only be added to MP3s if the tagger used is MetaMP3. Tag does not support images. This is a pipe (|) delimited list of sources that should be used when encoding from FLAC to MP3. The list is in the format type:value. The type can be either File or FLAC:
This is a mask used to determine the tags from a WAV file that is encoded to FLAC. The mask can include directory structures as well as the filename. Examples: This example includes the last 2 subfolders and the filename TagMask=%Artist%\%Album%\%TrackNumber% %Title% This example includes all of the tag information in the filename TagMask=%Genre%-%Artist%-%Album%-%TrackNumber% %Title%
This file is used in conjunction with the TAGMASK during an encode from WAV operation. If there is additional information that should be tagged in the FLAC file, it would be included in this file (just a filename) in the directory of the original WAV file. This is for cases where the filename may not contain all of the required tagging information (year, genre, etc.). The entries in this file will override and tag information taken from the WAV filename. The file will be in the format: 1 Line per tag, the tag name, and equal sign and the tag value. Lame Related
The full path and filename to lame.exe
The lame parameters that should be used when encoding to MP3 Tag Related
The full path and filename to tag.exe
If this has a value of Y, ID3v2 tags will be removed prior to the operations. This only occurs if the TARGETDIR parameter is left blank. MetaMP3
The full path and filename to metamp3.exe
Parameters that will be used on the command line. --frame parameters will be appended to the parameters specified here. ==imgResize== (Now included in the executable)
The resize mode to be used. Valid values are"MAX - smaller images will not be scaled up, but larger images willbe scaled downALWAYS - larger and smaller images will be resized
The dimension to use (this will be the largest dimension, the other dimension of the image will be calculated, maintaining the aspect ratio of the image).
A Y or N, Y means the image will be resized, an N turns this functionality off. Only valid if using metamp3. The following files all reside in the script directory, and are written to based on the associated KEEP parameter
The list of files that were processed successfully
The list of files that did not complete
The list of files that were skipped because of the VERSIONSKIP parameter. External ProgramsThis program is just a wrapper around functionality available in other programs. It makes use of the following executables:
Makes use of flac.exe and metaflac.exe, these programs can be obtained from http://flac.sourceforge.net/ on the Download page, click on the link to download FLAC for Windows (command-line tools only).
Makes use of Tag to identify and remove ID3v2 tags. This program can be obtained from http://synthetic-soul.co.uk/tag/
LAME is an MPEG Audio Layer III (MP3) encoder licensed under the LGPL. It can be downloaded from http://lame.sourceforge.net
MetaMP3 is used to copy tags from FLAC files to MP3 files when in MP3 mode http://www.hydrogenaudio.org/forums/index.php?showtopic=49751
This file will be used to map FLAC tags to MP3 frames. The following web pages contain information about the available tags:
The first field in the file is the FLAC tag, the second field is the MP3 frame, and the final the information that be added to the beginning of the tag. The first and second field are separated by an equal sign (=), the second and third field is separated by a carat (^). ThanksI also wanted to thank Synthetic Soul (http://www.synthetic-soul.co.uk/) for his work on flac-113.bat, and the other related batch files. They helped me determine what I wanted the script to do. DISCLAIMER: This software is provided by the author "AS IS" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the author be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. |
Sign in to add a comment
To get Reflacer to work successfully on Windows 7 64-bit, I had to change the reflacer.exe object to XP SP3 compatibility mode (right click object, then properties)