Background
Many churches record their weekly meetings to CD for duplication and for creating podcasts that are then uploaded to their website or podcasting network. Usually, there are a number of steps involved…steps that a volunteer staff doesn’t have the time or experience to take every week. The goal of this process is to automatically upload an tagged MP3 to a church’s website, at the end of the service, without intervention from the staff.
DISCLAIMERS: The process described below is several years old and needs to be updated, using modern scripting languages and software. It was written for Windows XP, but it’s been successfully tested on Windows 7 and Windows 10. As time allows, I’ll update it to use Powershell, and replace the REALLY old software with more suitable, current versions. I’d also like to add in some logging and notifications, via email or other method, but that’s currently too cumbersome using the batch file method below. Also, there is one step in the process that requires a password to be stored in plain text on the system being used, more details below.
Software used
- cdrip.bat (required) : A Windows batch file that I wrote. It contains all the settings and program calls that make the magic happen.
- VLC Media Player (required) : A free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVDs, Audio CDs, VCDs, and various streaming protocols. http://www.videolan.org/
- WinSCP (required) : https://winscp.net/
- tag.exe (optional): Tag is a small tool to work with tags, via the command line, in various compressed audio formats. If you don’t want or need to tag your MP3s, you can skip this. I’m a firm believer in tagging media files so anyone later can figure out where they came from! (Tag is becoming harder to find, so please email me if you aren’t able to find it using your favorite search engine, and I’ll try to get you a .zip of the version used in this process.)
Install Software
- Download and install VLC Media Player and WinSCP, using the default settings.
- Create the directory: c:\cdrip\
- Create the directory: c:\cdrip\tag\
- Copy tag.exe into c:\cdrip\tag\
- Create the directory: c:\cdrip\tmp\
- Create the directory: c:\media\online audio\
Create and configure cdrip.bat Windows batch file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
@ECHO OFF REM Batch file for automatically ripping a CD in an mp3 and uploading to an FTP Server REM REQUIREMENTS: This script, VLC media player, tag.exe, WinSCP REM INSTRUCTIONS: Put this script in folder c:\cdrip\ REM INSTRUCTIONS: Put tag.exe in c:\cdrip\tag\ REM INSTRUCTIONS: Install VLC media player and adjust path below if needed REM INSTRUCTIONS: Install WinSCP and adjust path below if needed REM INSTRUCTIONS: Create a temp directory and adjust path below if needed REM AUTHOR: DAVID ANTHONY, danthony@crosslinc.com, GRACE BAPTIST CHURCH, gracewestake.com -- April 4, 2015 ECHO *** GBC PODCAST RIPPER*** ECHO *** David Anthony, danthony@crosslinc.com *** ECHO *** Grace Baptist Church, gracewestlake.com *** ECHO *** April 4, 2015 *** ECHO setlocal ENABLEDELAYEDEXPANSION SET /a x=0 REM Confirm paths to on local system SET MEDIADIR=C:\Media\Online Audio\ SET TEMPDIR=c:\cdrip\tmp\ REM Confirm paths to programs SET VLCPATH=C:\Program Files (x86)\VideoLAN\VLC\vlc SET TAGPATH=c:\cdrip\tag\tag.exe SET WINSCPPATH=C:\Program Files (x86)\WinSCP\WinSCP.exe REM Set your WEB site and user information REM SECURITY NOTE: Password is stored in plain text here, so I advise creating a ftp/sftp user that only has access to the specific upload directory on your website SET WEBPROTOCOL=ftp SET WEBHOST=yourwebhost SET WEBUSER=yourusername SET WEBPASS=yourpassword SET WEBDIR=\location\of\mp3\files\on\your\website\ REM Set default MP3 tag information SET TAGARTIST=Your Church Name SET TAGALBUM=Your Sunday Service SET TAGTITLE=Your Title SET TAGCOMMENT=Your Website Address REM YOU SHOULD NOT NEED TO EDIT ANYTHING BELOW cd %TEMPDIR% @REM Set ups %date variable @REM First parses month, day, and year into mm , dd, yyyy formats and then combines to be MMDDYYYY FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B SET yy=%yyyy:~-2% ECHO CURRENT DATE: %CDATE% SET mydate=%yy%%mm%%dd% ECHO mydate: %mydate% IF EXIST "%MEDIADIR%%mydate%.mp3" ( REM Do nothing ECHO MP3 Exists, no need to rip. Skipping to FTP ) ELSE ( REM Do another thing ECHO MP3 Does not exist, ripping from CD ECHO Ripping CD CALL "%VLCPATH%" -I http cdda:///D:/ --cdda-track=!x! :sout=#transcode{vcodec=none,acodec=mp3,ab=64,channels=1,samplerate=22050}:std{access="file",mux=raw,dst="Track_all.mp3"} --sout-keep vlc://quit ECHO Tagging file CALL "%TAGPATH%" Track_all.mp3 --artist "%TAGARTIST%" --album "%TAGALBUM%" --title "%TAGTITLE% %mydate%" --year %YYYY% --comment "%TAGCOMMENT%" ECHO Moving and renaming move Track_all.mp3 "%MEDIADIR%%mydate%.mp3" ) ECHO Creating FTP config file ECHO option batch abort> "%TEMPDIR%ftpcmd.dat" ECHO option confirm off>> "%TEMPDIR%ftpcmd.dat" ECHO open %WEBPROTOCOL%://%WEBUSER%:%WEBPASS%@%WEBHOST%/>> "%TEMPDIR%ftpcmd.dat" ECHO put "%MEDIADIR%%mydate%.mp3" "%WEBDIR%>> "%TEMPDIR%ftpcmd.dat" ECHO close>> "%TEMPDIR%ftpcmd.dat" ECHO FTPing file to %FTPHOST% CALL "%WINSCPPATH%" /script="%TEMPDIR%ftpcmd.dat" ECHO DELETING FTPCMD FILE del "%TEMPDIR%ftpcmd.dat" REM FOR /R D:\ %%G IN (*.cda) DO (CALL :SUB_VLC "%%G") GOTO :eof :SUB_VLC call SET /a x=x+1 ECHO Transcoding %1 REM Here's where the actual transcoding/conversion happens. CALL "%VLCPATH%" -I http cdda:///D:/ --cdda-track=!x! :sout=#transcode{vcodec=none,acodec=mp3,ab=64,channels=1,samplerate=22050}:std{access="file",mux=raw,dst="Track_all.mp3"} --sout-keep vlc://quit :eof |
- Review settings at top of cdrip.bat and make sure they are configured for your specific situation.
- Save cdrip.bat to c:\cdrip\
Create Scheduled Task
In Windows Task Scheduler, create a task that calls c:\cdrip\cdrip.bat once weekly. I’ve set it to occur 25 minutes after the service officially ends. Be sure to check the box allowing the job to run whether a user is logged in or not.
Test
Insert an audio CD into the CD tray and run the Scheduled Task manually. You should see a black command window popup and work it’s way through the cdrip program; ripping the audio tracks into the temp directory, assembling them, tagging the single MP3, and then uploading it to your website’s FTP or SFTP server.
Need Help?
If you get stuck on anything above, leave a comment or contact me via Twitter (@crosslinc), and I’ll be glad to help in any way I can.