REACT:Adding Support For Disc Information: Difference between revisions

From Hydrogenaudio Knowledgebase
(Swapped [] for "" with discname)
No edit summary
 
Line 202: Line 202:
This tip is a result of [[User:Synthetic Soul|Synthetic Soul's]] dogged pursuit of a method to pass additional meta data into the [[REACT]] config files.  This particular method was first documented in [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=50273&view=findpost&p=486531 this post] in the [http://www.hydrogenaudio.org/forums/index.php?showtopic=50273 REACT 2 thread].
This tip is a result of [[User:Synthetic Soul|Synthetic Soul's]] dogged pursuit of a method to pass additional meta data into the [[REACT]] config files.  This particular method was first documented in [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=50273&view=findpost&p=486531 this post] in the [http://www.hydrogenaudio.org/forums/index.php?showtopic=50273 REACT 2 thread].


[[Category:REACT|Adding Support For Disc Information]]
[[Category:REACT Guides|Adding Support For Disc Information]]

Latest revision as of 19:38, 29 July 2010

This page provides code examples to allow you to update your image and track config files to create folders and tags using the @discnumber@, @totaldiscs@ and @discname@ tokens which are provided by default with Synthetic Soul's REACT Mod.

The code used includes settings for TAK, which can be added by following the guide "REACT:Adding Support For TAK". If you do not require TAK support you can either leave this code as-is, or remove any line referring to TAK.

Requirements

  • A version of REACT which has the Additional Meta Data dialogue, i.e.: Synthetic Soul's REACT Mod.
  • The beta version of metamp3, in order to set the TXXX frame "setsubtitle" for MP3 files, if @discname@ is provided.


REACT-image.cfg

Add the code below, somewhere at the beginning of your CFG file.

REM ** Create Disc-related tags if we have a set

REM If a disc name has been provided
IF "@discname@" EQU "" GOTO end_discname
SET discName=discname
SET discName=@%discname%@
IF "@discname@" EQU "%discName%" GOTO end_discname

	REM Set tagging switches
	SET Disc_Flac=-T "discname=@discname@"
	SET Disc_Wavpack=-w "discname=@discname@"
	REM SET Disc_MP3=--frame TSST:"@discname@"
	SET Disc_MP3=--frame "TXXX[setsubtitle]:@discname@"
	SET Disc_OggEnc2=-c "discname=@discname@"
	SET Disc_Tak=-t "discname=@discname@"
	SET Disc_Flac_acdir=-T $qdiscname=@discname@$q
	SET Disc_Wavpack_acdir=-w $qdiscname=@discname@"$q
	REM SET Disc_MP3_acdir=--frame TSST:$q@discname@$q
	SET Disc_MP3_acdir=--frame $qTXXX[setsubtitle]:@discname@$q
	SET Disc_OggEnc2_acdir=-c $qdiscname=@discname@$q
	SET Disc_Tak_acdir=-t $qdiscname=@discname@$q

	REM Add disc name to image and track folder paths
	SET imageDir=%imageDir%\$discname$
	SET trackDir=%trackDir%\$discname$

	GOTO :end_discnumber

:end_discname

REM Ensure that we have numeric values
SET /A discNumber = @discnumber@ + 0
SET /A totalDiscs = @totaldiscs@ + 0

REM IF a valid disc number and total number of discs has been provided
IF %totalDiscs% LEQ 1 GOTO :end_discnumber
IF %discNumber% LEQ 0 GOTO :end_discnumber

	REM Set tagging switches
	SET Disc_Flac=-T "discnumber=@discnumber@" -T "totaldiscs=@totaldiscs@"
	SET Disc_Wavpack=-w "discnumber=@discnumber@" -w "totaldiscs=@totaldiscs@"
	SET Disc_MP3=--frame TPOS:"@discnumber@/@totaldiscs@"
	SET Disc_NeroAac=--disk "@discnumber@/@totaldiscs@"
	SET Disc_OggEnc2=-c "discnumber=@discnumber@" -c "totaldiscs=@totaldiscs@"
	SET Disc_Tak=-t "discnumber=@discnumber@" -t "totaldiscs=@totaldiscs@"
	SET Disc_Flac_acdir=-T $qdiscnumber=@discnumber@$q -T $qtotaldiscs=@totaldiscs@$q
	SET Disc_Wavpack_acdir=-w $qdiscnumber=@discnumber@$q -w $qtotaldiscs=@totaldiscs@$q
	SET Disc_MP3_acdir=--frame TPOS:$q@discnumber@/@totaldiscs@$q
	SET Disc_NeroAac_acdir=--disk $q@discnumber@/@totaldiscs@$q
	SET Disc_OggEnc2_acdir=-c $qdiscnumber=@discnumber@$q -c $qtotaldiscs=@totaldiscs@$q
	SET Disc_Tak_acdir=-t $qdiscnumber=@discnumber@$q -t $qtotaldiscs=@totaldiscs@$q

	REM Add disc number to image and track folder paths
	SET imageDir=%imageDir%\Disc @discnumber@
	SET trackDir=%trackDir%\Disc @discnumber@

:end_discnumber

The code below uses the FLAC image section to demonstrate the use of the %imageDir% and %Disc_Flac% variables. You will need to amend the other sections accordingly.

IF NOT @ImageExt@==flac GOTO end_flac_image
	SET dest="@ImageDir_Flac@%imageDir%"
	IF NOT EXIST %dest% MKDIR %dest%
	IF %embed_cover%==1 SET Cover_tag=--picture="|image/jpeg|||@cover@"
	@tools@\flac.exe @Opt_Flac@ %RG_Flac% %Cover_tag% %Disc_Flac% -T "%ArtistField%=@cdartist@" -T album="@album@" -T totaltracks="@numtracks@" -T date="@year@" -T genre="@genre@" -T comment="@comment@" -T encoded-by="%USERNAME%" -T encoding="Flac @Ver_Flac@ @Opt_Flac@" --tag-from-file="cuesheet=@cuesheet@" --tag-from-file="eaclog=@eaclog@" "@source@" -o "@image@"
	MOVE /Y "@image@" %dest%
	MOVE /Y "@cuesheet@" %dest%
	IF %have_cover%==1 COPY /Y "@cover@" %dest%\"@basename@.jpg"
:end_flac_image

The code below uses the FLAC tracks section to demonstrate the use of the %trackDir% and %Disc_Flac_acdir% variables. You will need to amend the other sections accordingly.

IF NOT @Flac@==1 GOTO end_flac_tracks
	SET dest="@TrackDir_Flac@%trackDir%"
	IF NOT EXIST %dest% MKDIR %dest%
	PUSHD %dest%
		IF @various@==1 SET VA_tag=-T $qalbum artist=@VA@$q
		IF %embed_cover%==1 SET Cover_tag=--picture=$#x
		@tools@\acdir.exe --overwrite --output "%TrackName%.flac" --extra-opt "|image/jpeg|||@cover@" --pipe "TITLE $n/$N flac $#T & @tools@\flac.exe @Opt_Flac@ %Cover_tag% %VA_tag% %Disc_Flac_acdir% -T artist=$#a -T album=$#T -T title=$#t -T tracknumber=$n/$N -T date=$q@year@$q -T genre=$q@genre@$q -T comment=$q@comment@$q -T encoded-by=$q%USERNAME%$q -T encoding=$qFlac @Ver_Flac@ @Opt_Flac@$q - -o $#o" "@sourcecuesheet@"
		IF %add_rg%==1 @tools@\Glob.exe -v -c @tools@\metaflac.exe %RG_MetaFlac% *.flac
		COPY /Y "@eaclog@" "EAClog.txt"
		IF %have_cover%==1 COPY /Y "@cover@" "folder.jpg"
		IF EXIST "@albumfile@.[*].cue" COPY /Y "@albumfile@.[*].cue" .
	POPD
:end_flac_tracks


REACT-track.cfg

Remove the lines:

SET TrackDir_Flac="@TrackDir_Flac@"
SET TrackDir_Wavpack="@TrackDir_Wavpack@"
SET TrackDir_MP3="@TrackDir_MP3@"
SET TrackDir_AAC="@TrackDir_AAC@"
SET TrackDir_OGG="@TrackDir_OGG@"

... and replace them with the code below:

REM ** Create Disc-related tags if we have a set

REM If a disc name has been provided
IF "@discname@" EQU "" GOTO end_discname
SET discName=discname
SET discName=@%discname%@
IF "@discname@" EQU "%discName%" GOTO end_discname

	REM Set tagging switches
	SET Disc_Flac=-T "discname=@discname@"
	SET Disc_Wavpack=-w "discname=@discname@"
	REM SET Disc_MP3=--frame TSST:"@discname@"
	SET Disc_MP3=--frame "TXXX[setsubtitle]:@discname@"
	SET Disc_OggEnc2=-c "discname=@discname@"
	SET Disc_Tak=-t "discname=@discname@"

	REM Add disc name to folder path
	SET trackDir=%trackDir%\$discname$

	GOTO :end_discnumber

:end_discname

REM Ensure that we have numeric values
SET /A discNumber = @discnumber@ + 0
SET /A totalDiscs = @totaldiscs@ + 0

REM IF a valid disc number and total number of discs has been provided
IF %totalDiscs% LEQ 1 GOTO :end_discnumber
IF %discNumber% LEQ 0 GOTO :end_discnumber

	REM Set tagging switches
	SET Disc_Flac=-T "discnumber=@discnumber@" -T "totaldiscs=@totaldiscs@"
	SET Disc_Wavpack=-w "discnumber=@discnumber@" -w "totaldiscs=@totaldiscs@"
	SET Disc_MP3=--frame TPOS:"@discnumber@/@totaldiscs@"
	SET Disc_NeroAac=--disk "@discnumber@/@totaldiscs@"
	SET Disc_OggEnc2=-c "discnumber=@discnumber@" -c "totaldiscs=@totaldiscs@"
	SET Disc_Tak=-t "discnumber=@discnumber@" -t "totaldiscs=@totaldiscs@"

	REM Add disc number to folder path
	SET trackDir=%trackDir%\Disc @discnumber@

:end_discnumber


SET TrackDir_Flac="@TrackDir_Flac@%trackDir%"
SET TrackDir_Wavpack="@TrackDir_Wavpack@%trackDir%"
SET TrackDir_MP3="@TrackDir_MP3@%trackDir%"
SET TrackDir_AAC="@TrackDir_AAC@%trackDir%"
SET TrackDir_OGG="@TrackDir_OGG@%trackDir%"
SET TrackDir_Tak="@TrackDir_Tak@%trackDir%"

The code below uses the FLAC section to demonstrate the use of the %Disc_Flac% variable. You will need to amend the other sections accordingly.

IF NOT @Flac@==1 GOTO end_flac_tracks
	IF NOT EXIST %TrackDir_Flac% MKDIR %TrackDir_Flac%
	PUSHD %TrackDir_Flac%
		IF @various@==1 SET VA_tag=-T "album artist=@VA@"
		IF %embed_cover%==1 SET Cover_tag=--picture="|image/jpeg|||@cover@"
		ECHO ON
		@tools@\flac.exe @Opt_Flac@ %Cover_tag% %VA_tag% %Disc_Flac% -T artist="@artist@" -T album="@album@" -T tracknumber="@track@/@numtracks@" -T title="@title@" -T date="@year@" -T genre="@genre@" -T comment="@comment@" -T encoded-by="%USERNAME%" -T encoding="Flac @Ver_Flac@ @Opt_Flac@" "@source@" -o "%TrackName%.flac"
		@ECHO OFF
		IF %have_cover%==1 IF NOT EXIST folder.jpg COPY "@cover@" folder.jpg
	POPD
:end_flac_tracks


%imageDir% and %trackDir%

You may note that I use lines like:

SET imageDir=%imageDir%\$discname$

when I could use:

SET imageDir=\$discname$

This is simply so that the same technique could be used in other sections, before or after the section, all moving toward creating a variable that extends the base path. Using this technique all sections can append, or prepend, to %imageDir% and %trackDir% harmoniously.

For example, I might add another section, before these sections, to deal with an @albumsubtitle@ token. This section may end up setting:

SET imageDir=%imageDir% ($albumsubtitle$)

which could result in:

($albumsubtitle$)\Disc @discnumber@


Related Thread

This tip is a result of Synthetic Soul's dogged pursuit of a method to pass additional meta data into the REACT config files. This particular method was first documented in this post in the REACT 2 thread.