4

I have few bat files created to record my favorite audio streams but I would like to include the dates in the output file.

Is there a way to include the date in the output file name with the code below?

I would like the file to show a format similar to this wzakfrimix-Jan 01 2016.mp3 or something close enough.

"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" "http://208.46.117.156:80/7/648/72151/v1...et/wzak-fm" :sout=#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}:file{dst="X:\WzakFriMix.mp3",no-overwrite}:sout-keep
0

1 Answer 1

3

Adding date stamp to vlc recorded streams

I have few bat files created to record my favorite audio streams but I would like to include the dates in the output file.

Is there a way to include the date in the name of the output file for the code below? For the example I would like the file to show a format similar to this "wzakfrimix-Jan 01 2016.mp3"

See if one of the below will get this done as expected assuming your favorite stream URLs can be plugged in as an array on separate lines and tabbed as mentioned in the script notes below as well as the [first] topmost example.

The topmost script iterates your favorite URL stream paths (the array as big or as little as you need it) in a loop. Otherwise (maybe how you do it now with multiple batch files) you could just hard code the Month Name, Month Day Number, and Year variables into the destination file name manually (example below).

Again, two variations below which may suffice for your need but I did set some of the script logig variables up top of each example.


SCRIPT NOTES

These are setup for run as batch scripts and not manually from command line with copy and paste; otherwise, I'd need to add examples for doing it that was as well.

The below image is the top script example where each http://~ path needs to be valid and supposedly different per line. Take lines out that are not needed or add others as needed but all need to have valid paths to download the file you are about to stream record into MP3 files.

  • Batch Array Logic Image (iterate value per line of the array)

    enter image description here



Batch Script Examples

With a List of URLs for your Streams (as a batch script)

@ECHO ON
SET VLC=C:\Program Files (x86)\VideoLAN\VLC\vlc.exe
SET MM=%DATE:~4,2%
SET YYYY=%DATE:~10,4%
SET DD=%DATE:~7,2%

:VBSDynamicBuild
SET TempVBSFile=%tmp%\~tmpMnthTemp.vbs
IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"
ECHO WScript.Echo(MonthName(%MM%,True))>>"%TempVBSFile%"
FOR /F %%A IN ('CSCRIPT //nologo "%TempVBSFile%"') DO SET Mmm=%%~A

:VLCStreamURLs
FOR %%B IN (
    "http://208.46.117.156/7/648/72151/v1/interactive.akacast.akamaistream.net/wzak-fm"
        "<http://ValidPath2/~>"
        "<http://ValidPath3/~>"
        "<http://ValidPath4/~>
        "<http://ValidPath5/~>"
        "<http://ValidPath6/~>"
        "<http://ValidPath7/~>"
) DO (
    "%VLC%" "%%~B" :sout=#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}::file{dst="X:\%%~NB-%Mmm% %DD% %YYYY%%%~XB",no-overwrite} :sout-keep
)
GOTO EOF

Single URL per Batch Script (may be similiar to how you do this now)

@ECHO ON
SET VLC=C:\Program Files (x86)\VideoLAN\VLC\vlc.exe
SET MM=%DATE:~4,2%
SET YYYY=%DATE:~10,4%
SET DD=%DATE:~7,2%

:VBSDynamicBuild
SET TempVBSFile=%tmp%\~tmpMnthTemp.vbs
IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"
ECHO WScript.Echo(MonthName(%MM%,True))>>"%TempVBSFile%"
FOR /F %%A IN ('CSCRIPT //nologo "%TempVBSFile%"') DO SET Mmm=%%~A

:VLCStreamURL
"%VLC%" "http://208.46.117.156/7/648/72151/v1/interactive.akacast.akamaistream.net/wzak-fm" :sout=#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}::file{dst="D:\wzakfrimix-%Mmm% %DD% %YYYY%.mp3",no-overwrite} :sout-keep
GOTO EOF
7
  • Do you want me to try each set code in notepad and save as .bat file and test? I tried each code and I get errors. I am new to all this and have no coding experience.
    – jp0213x
    Commented Jan 1, 2016 at 15:04
  • Here is an example of the url, I ripped from website and inserted into the vlc. 208.46.117.156:80/7/648/72151/v1/…
    – jp0213x
    Commented Jan 1, 2016 at 18:19
  • I am using a windows 7 machine " Errors from vlc are "input can't be opened" "File reading failed"
    – jp0213x
    Commented Jan 1, 2016 at 18:55
  • I am having no luck with the code above.
    – jp0213x
    Commented Jan 1, 2016 at 19:46
  • YES!!! that bottom code worked, I got an error at first but noticed that the drive letter was different and changed it back. Thanks! So I should be able to use this a template for the rest of my batch files.
    – jp0213x
    Commented Jan 1, 2016 at 23:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .