IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Batch processing with an Export Config
rko31415
post May 18 2016, 02:38
Post #1


Member


Group: Full Members
Posts: 96
Joined: 22-October 13
Member No.: 18669
Mp3tag Version: 2.58



I recently realized you can run batch operations within an export configuration. This makes the export function very powerful. For example, below I test each of my podcasts against a standardized list of album names. My file naming convention is album - title, and this validates the album portion of the filename.

I use standard Export looping operations to build a temporary folder of files entitled album.txt and then check for the existence of the album portion of the podcast filename against these folder files.

Perhaps this is not the most elegant programming, but it illustrates how you can integrate tag names into a batch executable.

Basically I used Export looping to build an expanded batch file. Note: you need to double the batch variable percentage signs beyond the normal batch doubling of percentage signs for this to work.

CODE
$filename($getEnv('USERPROFILE')'\desktop\AlbumTagChk.bat',ANSI)
@Echo Off
chcp 1254
if NOT EXIST g:\trashit\ mkdir g:\trashit\
$loop(%album%)
echo. 2>g:\trashit\"$replace(%album%,'%','%%')".txt
$loopend()
echo The following process takes about 15 minutes. Go get a coffee.
setlocal DisableDelayedExpansion
for /r "G:\itunes\Podcasts\" %%%%i in (*.*) do (
  set "buffer=%%%%~nxi"
  setlocal EnableDelayedExpansion
  for /f "tokens=1* delims=¬" %%%%j in ("!buffer: - =¬!") do (
  endlocal
  set "input=%%%%j"
  set "file=%%%%i"
  setlocal EnableDelayedExpansion
  if NOT EXIST G:\trashit\!input!.txt echo !file!
  endlocal
  )
)
for /r "H:\itunes\Podcasts\" %%%%i in (*.*) do (
  set "buffer=%%%%~nxi"
  setlocal EnableDelayedExpansion
  for /f "tokens=1* delims=¬" %%%%j in ("!buffer: - =¬!") do (
  endlocal
  set "input=%%%%j"
  set "file=%%%%i"
  setlocal EnableDelayedExpansion
  if NOT EXIST G:\trashit\!input!.txt echo !file!
  endlocal
  )
)
rmdir g:\trashit\ /s/q
pause

$puts(REM,'Reads the Albumtags folder & creates disposable folder filled with 1 .txt file 4 ea. album')
$puts(REM,'Recurses the Main Library checking the Album in the Album - Title.mp3 naming convention')
$puts(REM,'Displays filenames where the Album portion of filename not found in the disposable folder')
$puts(REM,'The Albumtags folder s.b. the only folder in Mp3tag for this Export Config to work properly')


Hope this is helpful for some folks.
rko
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: 26th July 2017 - 23:36