<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: flac2mp3: batch flac to mp3 converter</title>
	<atom:link href="http://www.pixelchaos.net/2007/11/04/flac2mp3-batch-flac-to-mp3-converter/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pixelchaos.net/2007/11/04/flac2mp3-batch-flac-to-mp3-converter/</link>
	<description>random bits for your terminal</description>
	<lastBuildDate>Tue, 03 Aug 2010 15:13:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: curts</title>
		<link>http://www.pixelchaos.net/2007/11/04/flac2mp3-batch-flac-to-mp3-converter/comment-page-1/#comment-392</link>
		<dc:creator>curts</dc:creator>
		<pubDate>Sun, 27 Jul 2008 21:52:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.pixelchaos.net/index.php/archives/35#comment-392</guid>
		<description>Using Waldmeister&#039;s Perl script as a starting point, I&#039;ve streamlined it, made it more robust, made some corrections for Ubuntu, and added some features I needed.  I hope others will find it useful.

&lt;code&gt;
#!/usr/bin/perl
#
# added some code to get id3 info in your mp3s

use Getopt::Std;
my $opt_string = &#039;ho:p:&#039;;
getopts( &quot;$opt_string&quot;, \%opt ) or usage();
usage() if $opt{h};
$opt{o} = &quot;.&quot; if ( $opt{o} eq &quot;&quot; );


sub usage() {
  print STDERR &lt;&lt; &quot;EOF&quot;;

  usage: $0 [-h] [-o directory] [-p prefix] file.flac [file.flac ...]

    -h                    help (this message)
    -o directory          optional destination for MP3 files
    -p prefix             optional text to prepend to each MP3 file

EOF
  exit;
}

if ( ! -d $opt{o} ) {
  print &quot;&#039;$opt{o}&#039; is not a valid directory for output, using current directory...\n&quot;;
  $opt{o} = &quot;.&quot;;
}


# PROGRAMME
$flac=flac;
$metaflac=metaflac;
$lame=lame;
# OPTIONEN
$lame_opt=&quot;--preset extreme -V2 --add-id3v2 --tc \&quot;Curtis Schroeder\&quot; &quot;;
$flacinfo=&quot;flacinfo.txt&quot;;

print &quot;*** flac2mp3 -- Converts .flac to .mp3\n&quot;;

foreach (@ARGV) {
  print &quot;\n\n*** Now processing &quot;, $_, &quot;\n&quot;;
  if (!($_ =~ /\.flac$/)) {
    print &quot;Skipping $_\n&quot;;
    next;
  }

  # Convert spaces in filename to underscores as flac can&#039;t handle spaces
  if ( $_ =~ /\ /) {
     $file = $_;
     $file =~ s/ /_/g;
     system(&quot;mv &#039;$_&#039; &#039;$file&#039;&quot;);
  }
  else { $file = $_ }

  # getting the meta data (title, album, etc.)
  system(&quot;$metaflac --export-tags-to=$flacinfo &#039;$file&#039;&quot;);
  open ( $info, &quot;$flacinfo&quot; ) or die &quot;No such file: $flacinfo\n&quot;;
  my @metainfo;
  while ( ! eof $info ) {
    $line = ;
    chomp $line;
    @metainfo = split /=/, $line;

    if   ( $metainfo[0] =~ /ARTIST/i ) { $ARTIST  = $metainfo[1]; }
    elsif( $metainfo[0] =~ /ALBUM/i )  { $ALBUM   = $metainfo[1]; }
    elsif( $metainfo[0] =~ /DATE/i )   { $YEAR    = $metainfo[1]; }
    elsif( $metainfo[0] =~ /TITLE/i )  { $TITLE   = $metainfo[1]; }
    elsif( $metainfo[0] =~ /TRACKN/i ) { $TRACKNo = $metainfo[1]; }
  }

  # Remove leading zero from track number
  $TRACKNo =~ s/0(\d)/$1/;

  # Metainfo for lame
  $LAMEmeta=&quot;--tt \&quot;$TITLE\&quot; --ta \&quot;$ARTIST\&quot; --tl \&quot;$ALBUM\&quot; --tn $TRACKNo --ty $YEAR &quot;;

  # Now converting follows
  system(&quot;$flac -d &#039;$file&#039;&quot;);
  $file =~ s/\.flac$/.wav/;
  $target = $file;
  $target =~ s/\.wav$/.mp3/;
  system(&quot;$lame $lame_opt $LAMEmeta &#039;$file&#039; &#039;$opt{o}/$opt{p}$target&#039;&quot;);
  unlink $file;
  print &quot;\n&quot;;
}
unlink $flacinfo;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Using Waldmeister&#8217;s Perl script as a starting point, I&#8217;ve streamlined it, made it more robust, made some corrections for Ubuntu, and added some features I needed.  I hope others will find it useful.</p>
<p><code><br />
#!/usr/bin/perl<br />
#<br />
# added some code to get id3 info in your mp3s</p>
<p>use Getopt::Std;<br />
my $opt_string = 'ho:p:';<br />
getopts( "$opt_string", \%opt ) or usage();<br />
usage() if $opt{h};<br />
$opt{o} = "." if ( $opt{o} eq "" );</p>
<p>sub usage() {<br />
  print STDERR &lt;&lt; "EOF";</p>
<p>  usage: $0 [-h] [-o directory] [-p prefix] file.flac [file.flac ...]</p>
<p>    -h                    help (this message)<br />
    -o directory          optional destination for MP3 files<br />
    -p prefix             optional text to prepend to each MP3 file</p>
<p>EOF<br />
  exit;<br />
}</p>
<p>if ( ! -d $opt{o} ) {<br />
  print "'$opt{o}' is not a valid directory for output, using current directory...\n";<br />
  $opt{o} = ".";<br />
}</p>
<p># PROGRAMME<br />
$flac=flac;<br />
$metaflac=metaflac;<br />
$lame=lame;<br />
# OPTIONEN<br />
$lame_opt="--preset extreme -V2 --add-id3v2 --tc \"Curtis Schroeder\" ";<br />
$flacinfo="flacinfo.txt";</p>
<p>print "*** flac2mp3 -- Converts .flac to .mp3\n";</p>
<p>foreach (@ARGV) {<br />
  print "\n\n*** Now processing ", $_, "\n";<br />
  if (!($_ =~ /\.flac$/)) {<br />
    print "Skipping $_\n";<br />
    next;<br />
  }</p>
<p>  # Convert spaces in filename to underscores as flac can't handle spaces<br />
  if ( $_ =~ /\ /) {<br />
     $file = $_;<br />
     $file =~ s/ /_/g;<br />
     system("mv '$_' '$file'");<br />
  }<br />
  else { $file = $_ }</p>
<p>  # getting the meta data (title, album, etc.)<br />
  system("$metaflac --export-tags-to=$flacinfo '$file'");<br />
  open ( $info, "$flacinfo" ) or die "No such file: $flacinfo\n";<br />
  my @metainfo;<br />
  while ( ! eof $info ) {<br />
    $line = ;<br />
    chomp $line;<br />
    @metainfo = split /=/, $line;</p>
<p>    if   ( $metainfo[0] =~ /ARTIST/i ) { $ARTIST  = $metainfo[1]; }<br />
    elsif( $metainfo[0] =~ /ALBUM/i )  { $ALBUM   = $metainfo[1]; }<br />
    elsif( $metainfo[0] =~ /DATE/i )   { $YEAR    = $metainfo[1]; }<br />
    elsif( $metainfo[0] =~ /TITLE/i )  { $TITLE   = $metainfo[1]; }<br />
    elsif( $metainfo[0] =~ /TRACKN/i ) { $TRACKNo = $metainfo[1]; }<br />
  }</p>
<p>  # Remove leading zero from track number<br />
  $TRACKNo =~ s/0(\d)/$1/;</p>
<p>  # Metainfo for lame<br />
  $LAMEmeta="--tt \"$TITLE\" --ta \"$ARTIST\" --tl \"$ALBUM\" --tn $TRACKNo --ty $YEAR ";</p>
<p>  # Now converting follows<br />
  system("$flac -d '$file'");<br />
  $file =~ s/\.flac$/.wav/;<br />
  $target = $file;<br />
  $target =~ s/\.wav$/.mp3/;<br />
  system("$lame $lame_opt $LAMEmeta '$file' '$opt{o}/$opt{p}$target'");<br />
  unlink $file;<br />
  print "\n";<br />
}<br />
unlink $flacinfo;<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Waldmeister</title>
		<link>http://www.pixelchaos.net/2007/11/04/flac2mp3-batch-flac-to-mp3-converter/comment-page-1/#comment-195</link>
		<dc:creator>Waldmeister</dc:creator>
		<pubDate>Fri, 09 May 2008 22:22:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.pixelchaos.net/index.php/archives/35#comment-195</guid>
		<description>Some funny things happen while using Provoxy:

open ( IN, &quot;$flacinfo&quot; ) or die &quot;No such file: $flacinfo\n&quot;;

It should read _o p e n_, not PrivoxyWindowOpen.</description>
		<content:encoded><![CDATA[<p>Some funny things happen while using Provoxy:</p>
<p>open ( IN, &#8220;$flacinfo&#8221; ) or die &#8220;No such file: $flacinfo\n&#8221;;</p>
<p>It should read _o p e n_, not PrivoxyWindowOpen.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Waldmeister</title>
		<link>http://www.pixelchaos.net/2007/11/04/flac2mp3-batch-flac-to-mp3-converter/comment-page-1/#comment-194</link>
		<dc:creator>Waldmeister</dc:creator>
		<pubDate>Fri, 09 May 2008 22:18:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.pixelchaos.net/index.php/archives/35#comment-194</guid>
		<description>&lt;code&gt;
#!/usr/bin/perl
#
# added some code to get id3 info in your mp3s

# PROGRAMME
$flac=flac;
$metaflac=metaflac;
$lame=lame;
# OPTIONEN
$lame_opt=&quot;--preset extreme --add-id3v2 --tc \&quot;Waldmeisters Musiktruhe\&quot; &quot;;
$flacinfo=&quot;flacinfo.txt&quot;;

print &quot;*** flac2mp3  -- Converts .flac to .mp3\n&quot;;

foreach (@ARGV) {
print &quot;\n\n*** Now processing &quot;, $_, &quot;\n&quot;;
if (!($_ =~ /\.flac$/)) {
print &quot;Skipping $_\n&quot;;
next;
}

# getting the meta data (title, interpret, etc.)
system(&quot;$metaflac --export-tags-to=$flacinfo $_&quot;);
open ( IN, &quot;$flacinfo&quot; ) or die &quot;No such file: $flacinfo\n&quot;;
$i = 0;
while ( $line =  ) {
  chomp $line;
  ($metainfo[$i],$metainfo[$i 1]) = split (m/=/, $line);
  $i =2;
}

for( $i = 0; $i &lt; @metainfo; $i   ) {
  if( $metainfo[$i] =~ /ARTIST/ ) { $ARTIST = $metainfo[$i 1]; }
  elsif( $metainfo[$i] =~ /ALBUM/ ) { $ALBUM= $metainfo[$i 1]; }
  elsif( $metainfo[$i] =~ /YEAR/ ) { $YEAR= $metainfo[$i 1]; }
  elsif( $metainfo[$i] =~ /TITLE/ ) { $TITLE= $metainfo[$i 1]; }
  elsif( $metainfo[$i] =~ /TRACKNo/ ) { $TRACKNo= $metainfo[$i 1]; }
}

# Metainfo for lame
$LAMEmeta=&quot;--tt \&quot;$TITLE\&quot; --ta \&quot;$ARTIST\&quot; --tl \&quot;$ALBUM\&quot; --tn $TRACKNo --ty $YEAR  &quot;;

# now converting follows
`$flac -d &quot;$_&quot;`;
$_ =~ s/\.flac$/.wav/;
$target = $_;
$target =~ s/\.wav$/.mp3/;
`$lame $lame_opt $LAMEmeta &quot;$_&quot; &quot;$target&quot;`;
`rm &quot;$_&quot;`;
}

`rm $flacinfo`;
print &quot;\n&quot;;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p><code><br />
#!/usr/bin/perl<br />
#<br />
# added some code to get id3 info in your mp3s</p>
<p># PROGRAMME<br />
$flac=flac;<br />
$metaflac=metaflac;<br />
$lame=lame;<br />
# OPTIONEN<br />
$lame_opt="--preset extreme --add-id3v2 --tc \"Waldmeisters Musiktruhe\" ";<br />
$flacinfo="flacinfo.txt";</p>
<p>print "*** flac2mp3  -- Converts .flac to .mp3\n";</p>
<p>foreach (@ARGV) {<br />
print "\n\n*** Now processing ", $_, "\n";<br />
if (!($_ =~ /\.flac$/)) {<br />
print "Skipping $_\n";<br />
next;<br />
}</p>
<p># getting the meta data (title, interpret, etc.)<br />
system("$metaflac --export-tags-to=$flacinfo $_");<br />
open ( IN, "$flacinfo" ) or die "No such file: $flacinfo\n";<br />
$i = 0;<br />
while ( $line =  ) {<br />
  chomp $line;<br />
  ($metainfo[$i],$metainfo[$i 1]) = split (m/=/, $line);<br />
  $i =2;<br />
}</p>
<p>for( $i = 0; $i &lt; @metainfo; $i   ) {<br />
  if( $metainfo[$i] =~ /ARTIST/ ) { $ARTIST = $metainfo[$i 1]; }<br />
  elsif( $metainfo[$i] =~ /ALBUM/ ) { $ALBUM= $metainfo[$i 1]; }<br />
  elsif( $metainfo[$i] =~ /YEAR/ ) { $YEAR= $metainfo[$i 1]; }<br />
  elsif( $metainfo[$i] =~ /TITLE/ ) { $TITLE= $metainfo[$i 1]; }<br />
  elsif( $metainfo[$i] =~ /TRACKNo/ ) { $TRACKNo= $metainfo[$i 1]; }<br />
}</p>
<p># Metainfo for lame<br />
$LAMEmeta="--tt \"$TITLE\" --ta \"$ARTIST\" --tl \"$ALBUM\" --tn $TRACKNo --ty $YEAR  ";</p>
<p># now converting follows<br />
`$flac -d "$_"`;<br />
$_ =~ s/\.flac$/.wav/;<br />
$target = $_;<br />
$target =~ s/\.wav$/.mp3/;<br />
`$lame $lame_opt $LAMEmeta "$_" "$target"`;<br />
`rm "$_"`;<br />
}</p>
<p>`rm $flacinfo`;<br />
print "\n";<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kerry</title>
		<link>http://www.pixelchaos.net/2007/11/04/flac2mp3-batch-flac-to-mp3-converter/comment-page-1/#comment-121</link>
		<dc:creator>Kerry</dc:creator>
		<pubDate>Thu, 14 Feb 2008 02:51:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.pixelchaos.net/index.php/archives/35#comment-121</guid>
		<description>For windows users, I&#039;ve created a vbscript that allows for reflacing files using the latest version of the encoder, Decode to WAV, encode from WAV, or re-encode as MP3, copying the tags from the FLAC to MP3.  You can also use the script to synchronize your FLAC library to either WAV or MP3.

The code is available on Google Code under the Reflacer project.</description>
		<content:encoded><![CDATA[<p>For windows users, I&#8217;ve created a vbscript that allows for reflacing files using the latest version of the encoder, Decode to WAV, encode from WAV, or re-encode as MP3, copying the tags from the FLAC to MP3.  You can also use the script to synchronize your FLAC library to either WAV or MP3.</p>
<p>The code is available on Google Code under the Reflacer project.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
