IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Creating a playlist with REACT, An alternative way to do it (not Tag)
Paul Burger
post Aug 6 2008, 16:00
Post #1





Group: Members
Posts: 22
Joined: 21-July 08
Member No.: 56082



QUOTE (Synthetic Soul @ Aug 5 2008, 17:46) *
I guess that you could just use ECHO commands in your config to append to a playlist, e.g.:

CODE
ECHO $cdartist$ - $album$ [$date$]\$track$ - $title$.mp3>>@OutRoot@\Music\MP3\Playlists\$cdartist$ - $album$.m3u

You may have to escape some characters though, otherwise ampersands (for example) will cause problems. Certainly a possibility though.


Thanks, I did not realise the "#" was just a comment field in the m3u file.

I tried adding your echo command between "PushD" and "PopD" as I thought it was a loop so all I got was a playlist file in the correct place with only 1 file in it. (I use F10/image).

I also tried this...

CODE
DIR /B *.flac >> temp.txt
FOR %%f IN (temp.txt) DO (ECHO ..\$cdartist$ - $album$ [$year$]\%%f>>"..\++Playlists\$cdartist$ - $album$ [$year$].m3u")


...but it does not want to loop through the contents of the temp file but rather sees it as a literal.

It produces a file with only one entry.

"..\Enya - The Memory Of Trees [1995]\temp.txt"

The temp.txt contains.

CODE
01 - The Memory Of Trees.flac
02 - Anywhere Is.flac
03 - Pax Deorum.flac
04 - Athair Ar Neamh.flac
05 - From Where I Am.flac
06 - China Roses.flac
07 - Hope Has A Place.flac
08 - Tea-House Moon.flac
09 - Once You Had Gold.flac
10 - La Sonadora.flac
11 - On My Way Home.flac


Any ideas?

Just in case you're wondering, I had to add the "++" to the playlist directory in order to get it to be the top most directory. I do not feel like scrolling all the way to "P" to get to the playlist. It's possible that there is an better way, but the "++" should work.

Thanks again for the help.

Regards
Paul
Go to the top of the page
+Quote Post
Synthetic Soul
post Aug 6 2008, 16:37
Post #2





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



Try:

CODE
FOR /F "tokens=* delims=" %%f IN (temp.txt) DO (ECHO ..\$cdartist$ - $album$ [$year$]\%%f>>"..\++Playlists\$cdartist$ - $album$ [$year$].m3u")

I believe that is the right syntax to process temp.txt (I haven't examined the ECHO code to see if that is correct).


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
Paul Burger
post Aug 6 2008, 17:13
Post #3





Group: Members
Posts: 22
Joined: 21-July 08
Member No.: 56082



QUOTE (Synthetic Soul @ Aug 6 2008, 17:37) *
Try:

CODE
FOR /F "tokens=* delims=" %%f IN (temp.txt) DO (ECHO ..\$cdartist$ - $album$ [$year$]\%%f>>"..\++Playlists\$cdartist$ - $album$ [$year$].m3u")

I believe that is the right syntax to process temp.txt (I haven't examined the ECHO code to see if that is correct).


Thanks this worked.

I only tested my syntax in a bat file which seemed to work.

Regards
Paul
Go to the top of the page
+Quote Post
Synthetic Soul
post Aug 6 2008, 18:21
Post #4





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



Good news.

Just remember that some characters - ampersand being a prime example - will cause you problems.

I'm not sure if you can surround the path in double quotes in the playlist file, but that might be the easiest solution.

[code]ECHO "..\$cdartist$ - $album$ [$year$]\%%f">>"..\++Playlists\$cdartist$ - $album$ [$year$].m3u"/code]


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
Paul Burger
post Aug 7 2008, 08:24
Post #5





Group: Members
Posts: 22
Joined: 21-July 08
Member No.: 56082



QUOTE (Synthetic Soul @ Aug 6 2008, 19:21) *
Just remember that some characters - ampersand being a prime example - will cause you problems.

I'm not sure if you can surround the path in double quotes in the playlist file, but that might be the easiest solution.

[code]ECHO "..\$cdartist$ - $album$ [$year$]\%%f">>"..\++Playlists\$cdartist$ - $album$ [$year$].m3u"/code]


Adding quotes produces a file with quotes :-/

Would putting it all in a single variable not help?

When you're testing like this, is there a way to execute the image.cfg file without having to rip the entire cd again?

Anyway, thank you for all the help so far. I think I got the mechanics of REACT sorted to get the result I was looking for. (Well, at least for the bulk of my collection.)

Now it's just the replaygain monster I need to tame. Is there is specific thread that I must post for rg advice?

Regards
Paul
Go to the top of the page
+Quote Post
Synthetic Soul
post Aug 7 2008, 09:46
Post #6





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



QUOTE (Paul Burger @ Aug 7 2008, 08:24) *
Adding quotes produces a file with quotes :-/
I didn't know whether that was acceptable syntax. I've quickly tested in foobar and it appears not. sad.gif

QUOTE (Paul Burger @ Aug 7 2008, 08:24) *
Would putting it all in a single variable not help?
I don't really know what you mean, give it a try!

QUOTE (Paul Burger @ Aug 7 2008, 08:24) *
When you're testing like this, is there a way to execute the image.cfg file without having to rip the entire cd again?
Not sure. I tend to test using a small CD image mounted on a virtual drive (Nero or Virtual CloneDrive). Thinking about it, I did add the ability to call REACT on the command line passing it the path to a cuesheet. If you have the WAVE , CUE and LOG files created by EAC you may be able to do it this way.

QUOTE (Paul Burger @ Aug 7 2008, 08:24) *
Now it's just the replaygain monster I need to tame. Is there is specific thread that I must post for rg advice?
If it's REACT-specific either the REACT behemoth thread or a new thread in "CD Hardware/Software". If it is general RG questions then a new thread in "General Audio", or check the wiki.

One other thing that may be of use:

If you check my CREATE-M3U.BAT, which is linked to from the REACT:Creating A Playlist wiki article, you will see that I do this to process the filename:

CODE
REM Escape ampersand and caret
SET tmpString="%~nx1"
SET tmpString=%tmpString:^=^^%
SET tmpString=%tmpString:&=^^^&%
REM Remove quotes
SET tmpString=%tmpString:"=%
REM Write filename to playlist
ECHO %tmpString%>>"%~dp1\%~2"


If you amended the first line to:

CODE
SET tmpString="..\$cdartist$ - $album$ [$year$]\%%f"

.. and the last to:
CODE
ECHO %tmpString%>>"..\++Playlists\$cdartist$ - $album$ [$year$].m3u"

.. that could help.


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
Paul Burger
post Aug 7 2008, 13:08
Post #7





Group: Members
Posts: 22
Joined: 21-July 08
Member No.: 56082



Did we just loose a few posts?

Anyway, to recap.

CODE
REM ** Create playlist in (flac) playlist directory
DIR /B *.flac >> temp.txt
FOR /F "tokens=* delims=" %%f IN (temp.txt) DO (ECHO ..\$cdartist$ - $album$ [$year$]\%%f>>"..\++Playlists\$cdartist$ - $album$ [$year$].m3u")
DEL temp.txt


Does the trick. However, it might not work when name contain "&" for example.

Adding quotes to the line to echo simply insert quotes into the file which means it's no longer an valid playlist. Not sure if this can be catered for?

I'm happy with the setup now as it would work for 90% (or possibly more) of my collection.

Then is there is way to execute the REACT-image.cfg file without having to rip/create all the files again, assuming of course that I did not delete required the files.

Thanks
Paul
Go to the top of the page
+Quote Post
Synthetic Soul
post Aug 7 2008, 13:12
Post #8





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



I guess you didn't see your PM. biggrin.gif


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
Paul Burger
post Aug 7 2008, 13:37
Post #9





Group: Members
Posts: 22
Joined: 21-July 08
Member No.: 56082



QUOTE (Synthetic Soul @ Aug 7 2008, 14:12) *
I guess you didn't see your PM. biggrin.gif


Yes, sorry about that... You could have just deleted the message(s) if you want.

Your "tempstring" suggestion above is what I meant with using a single variable. I'll give it a bash.

As for calling REACT from the command line, do you mean I can simply do the following?

CODE
cd C:\"Program Files"\React2
REACT2 C:\"Music (EAC)"\"Enya - The Memory of Trees [1991].cue"


All the files, wav, 5 cue files and jpg are still in this directory.

Regards
Paul
Go to the top of the page
+Quote Post
Synthetic Soul
post Aug 7 2008, 14:23
Post #10





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



That's the idea. The cue will have to point correctly to the WAVE and the log needs to be correctly named (as per EAC original). I'm assuming that's the original image cuesheet.

I implemented it, tested it briefly and forgot about it, so I can't vouch too strongly for it. All the code does is use the details in the cuesheet to create the parameters required to call REACT normally. In fact, I think it may actually just create the parameters and call another instance of REACT with those parameters before exiting. I think.


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
Paul Burger
post Aug 7 2008, 16:19
Post #11





Group: Members
Posts: 22
Joined: 21-July 08
Member No.: 56082



QUOTE (Synthetic Soul @ Aug 7 2008, 15:23) *
That's the idea. The cue will have to point correctly to the WAVE and the log needs to be correctly named (as per EAC original). I'm assuming that's the original image cuesheet.

I implemented it, tested it briefly and forgot about it, so I can't vouch too strongly for it. All the code does is use the details in the cuesheet to create the parameters required to call REACT normally. In fact, I think it may actually just create the parameters and call another instance of REACT with those parameters before exiting. I think.


Calling REACT from the command line, works just fine.

I wish I knew about this a week ago already ;-) The other thing I also wish I realised sooner is that I should switch off the (additional) Ogg & MP3 encoding while I'm testing ;-)

The trick is to of course run in Debug mode (Debug=1) at least once as that leaves all the files intact. Thereafter you can just call it from the command line.

So what I have now which seems to work is.

CODE
IF NOT @Flac@==1 GOTO end_flac_tracks
    SET dest="@TrackDir_Flac@%trackDir%"
    SET playlist="@OutRoot@\FLAC\++Playlists"
    IF NOT EXIST %dest% MKDIR %dest%
    IF NOT EXIST %playlist% MKDIR %playlist%
    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
        REM ** Create playlist in (flac) playlist directory
        DIR /B *.flac >> temp.txt
        SET tempString=..\$cdartist$ - $album$ [$year$]\%%f
        FOR /F "tokens=* delims=" %%f IN (temp.txt) DO (ECHO %tempString%>>"..\++Playlists\$cdartist$ - $album$ [$year$].m3u")
REM        DEL temp.txt
        SET tempString=""
        IF EXIST "@cuesheet@" COPY /Y "@cuesheet@" "$cdartist$ - $album$ [$year$].cue"
        IF EXIST "@albumfile@.[*].cue" COPY /Y "@albumfile@.[*].cue" "$cdartist$ - $album$ [$year$].[*].cue"
        COPY /Y "@eaclog@" "$cdartist$ - $album$ [$year$].EAC.log"
        IF %have_cover%==1 COPY /Y "@cover@" "folder.jpg"
        REM ** Add read-only attribute to all files in the destination folder and it's subfolders.
        ATTRIB +R *.* /S
    POPD
:end_flac_tracks


Trying to add quotes to tempString still adds the quotes into the playlist file.

Edit: Ok looking at it again, I can't understand why it is working as I'm setting tempString outside the for loop, so in theory %%f should not have a value yet or am I missing something?

I think I'll stick with this for now and if I have problems with the "&", I'll look to add your batch file trick mentioned above.

Ideally I'll have to move setting the playlist directory to the ini file, but I'll wait to see what Akkurat is releasing this weekend.

Regards
Paul

This post has been edited by Paul Burger: Aug 7 2008, 16:25
Go to the top of the page
+Quote Post
Synthetic Soul
post Aug 7 2008, 16:58
Post #12





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



I haven't tested this, but this is the way I tend to do things (I use labels to create what I think of as functions to keep things, IMHO, more clear):

CODE
REM ** Create playlist in (flac) playlist directory
DIR /B *.flac >> temp.txt
FOR /F "tokens=* delims=" %%f IN (temp.txt) DO CALL :WriteToPlaylist "..\$cdartist$ - $album$ [$year$]\%%f"
DEL temp.txt

Then add the "function" WriteToPlaylist to the end of the config:

CODE
:WriteToPlaylist
REM Escape ampersand and caret
SET tmpString=%1
SET tmpString=%tmpString:^=^^%
SET tmpString=%tmpString:&=^^^&%
REM Remove quotes
SET tmpString=%tmpString:"=%
REM Write filename to playlist
ECHO %tmpString%>>"..\++Playlists\$cdartist$ - $album$ [$year$].m3u"
GOTO :EOF


It may work...


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
Paul Burger
post Aug 7 2008, 17:30
Post #13





Group: Members
Posts: 22
Joined: 21-July 08
Member No.: 56082



QUOTE (Synthetic Soul @ Aug 7 2008, 17:58) *
I haven't tested this, but this is the way I tend to do things (I use labels to create what I think of as functions to keep things, IMHO, more clear):

CODE
REM ** Create playlist in (flac) playlist directory
DIR /B *.flac >> temp.txt
FOR /F "tokens=* delims=" %%f IN (temp.txt) DO CALL :WriteToPlaylist "..\$cdartist$ - $album$ [$year$]\%%f"
DEL temp.txt

Then add the "function" WriteToPlaylist to the end of the config:

CODE
:WriteToPlaylist
REM Escape ampersand and caret
SET tmpString=%1
SET tmpString=%tmpString:^=^^%
SET tmpString=%tmpString:&=^^^&%
REM Remove quotes
SET tmpString=%tmpString:"=%
REM Write filename to playlist
ECHO %tmpString%>>"..\++Playlists\$cdartist$ - $album$ [$year$].m3u"
GOTO :EOF


It may work...


Jip, that works and is much neater. Thanks

I don't know whether it is required but I added brackets around the function call.

Should I post the entire image.cfg file here to make it easier for someone that might want to do the same or pass it on to Akkurat for inclusion in his release?

(I'm still new here and not sure what the protocol is, but I guess when I start to add the playlist variable to the ini file, then we have another fork in your and Akkurat's releases?)

Thanks again for the help, it turns something that could've been very frustrating into fun.

Regards
Paul
Go to the top of the page
+Quote Post
Akkurat
post Aug 7 2008, 20:41
Post #14


REACT Mod developer


Group: Developer
Posts: 929
Joined: 14-November 07
From: Finland
Member No.: 48750



QUOTE (Paul Burger @ Aug 7 2008, 19:30) *
Should I post the entire image.cfg file here to make it easier for someone that might want to do the same or pass it on to Akkurat for inclusion in his release?

(I'm still new here and not sure what the protocol is, but I guess when I start to add the playlist variable to the ini file, then we have another fork in your and Akkurat's releases?)

Only if you release your own mod with that change. Now it's just your own custom REACT configuration (I too have my own very very custom setup). And there's no need to post me this, I've already planned to make creating playlists (with Tag though) as a feature in REACT in the future.
Go to the top of the page
+Quote Post
Paul Burger
post Aug 11 2008, 07:37
Post #15





Group: Members
Posts: 22
Joined: 21-July 08
Member No.: 56082



QUOTE (Akkurat @ Aug 7 2008, 21:41) *
Only if you release your own mod with that change. Now it's just your own custom REACT configuration (I too have my own very very custom setup). And there's no need to post me this, I've already planned to make creating playlists (with Tag though) as a feature in REACT in the future.


Thanks Akkurat, I now understand how it works.

Thanks again for keeping the project moving forward and making it easier for newbies to get going.

Regards
Paul
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st August 2014 - 04:43