<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -13,6 +13,8 @@
 # Thanks:
 #       Those comments at:
 #       http://www.linuxtutorialblog.com/post/solution-converting-flac-to-mp3
+#       Thatch's fork and fixes at:
+#       http://github.com/
 # WebPage:
 #       https://github.com/tacvbo/yaflac2mp3/tree
 #
@@ -35,7 +37,8 @@ usage()
 
     cat&lt;&lt;EOF
 
-Usage: $0 [-l &lt;lame&gt;] [-f &lt;flac&gt;] [-x &lt;lame_opts&gt;] [-s &lt;source&gt;] [-d &lt;dest&gt;] [-i]
+Usage: $0 [-l &lt;lame&gt;] [-f &lt;flac&gt;] [-x &lt;lame_opts&gt;]
+          [-s &lt;source&gt;] [-d &lt;dest&gt;] [-o] [-i]
 Usage: $0 -h
 
 Default options:
@@ -46,6 +49,8 @@ Default options:
   &lt;dest&gt;      = ${DEST}
   &lt;id3_tool&gt;  = ${ID3}
 
+  If you use -o, an existing mp3 file at destination dir it's overwritten
+
   If you use -i, id3_tool is set to id3v2.
   This is only necessary if your LAME version doesn't tag properly
 
@@ -54,7 +59,7 @@ EOF
     exit ${EXIT}
 }
 
-while getopts l:f:x:d:s:hi name; do
+while getopts l:f:x:d:s:hio name; do
 
     case &quot;${name}&quot; in
         l)
@@ -72,10 +77,13 @@ while getopts l:f:x:d:s:hi name; do
         d)
             DEST=&quot;${OPTARG}&quot;
             ;;
+        o)
+            OVRWRT=yes
+            ;;
         i)
             ID3=&quot;$(which id3v2 || echo '')&quot;
-            if [ ! -x &quot;$ID3&quot; ]; then
-                printf &quot;Requested id3v2 but not found.  Only using lame.\n\n&quot;
+            if [[ ! -x &quot;$ID3&quot; ]]; then
+                echo -e &quot;Requested id3v2 but not found.  Only using lame.\n\n&quot;
             fi
             ;;
         h)
@@ -91,15 +99,17 @@ if [[ ! -d &quot;${DEST}&quot; ]]; then
   mkdir -p &quot;${DEST}&quot;
   [[ &quot;$?&quot; != &quot;0&quot; ]] &amp;&amp; exit 2
 fi
-[[ ! -d &quot;${SOURCE}&quot; ]] &amp;&amp; printf &quot;\&quot;${SOURCE}\&quot; is not a directory\n\n&quot; &amp;&amp; usage 1
+[[ ! -d &quot;${SOURCE}&quot; ]] &amp;&amp; echo &quot;\&quot;${SOURCE}\&quot; is not a directory&quot; &amp;&amp; usage 1
 
 old_IFS=${IFS}
 IFS='
 '
-files=( `find &quot;${SOURCE}&quot; \( -type f -o -type l \) -a -name '*.flac'` )
+files=( `find &quot;${SOURCE}&quot; \( -type f -o -type l \) -a -iname '*.flac'` )
 
 for N_files in ${!files[@]}
   do
+    dst_file=&quot;${DEST}/${files[${N_files}]/%\.flac/.mp3}&quot;
+    [[ -e &quot;$dst_file&quot; ]] &amp;&amp; [[ -z $OVRWRT ]] &amp;&amp; continue
     vars=( `metaflac --no-utf8-convert --export-tags-to=- &quot;${files[${N_files}]}&quot;` )
 
     for N_vars in ${!vars[@]}
@@ -120,7 +130,7 @@ for N_files in ${!files[@]}
         ${date:+--ty} ${date} \
         ${genre:+--tg} ${genre} \
         ${comment:+--tc} ${comment} \
-        - &quot;${DEST}/${files[${N_files}]/\.flac/.mp3}&quot;
+        - &quot;${dst_file}&quot;
 
     # User should only run this if they know their version of lame doesn't tag
     # properly.  Does this happen in practice?  LAME 3.98 supports id3 v1 and v2
@@ -132,7 +142,7 @@ for N_files in ${!files[@]}
         ${date:+--year} ${date} \
         ${genre:+--genre} ${genre} \
         ${comment:+--comment} ${comment} \
-        &quot;${DEST}/${files[${N_files}]/\.flac/.mp3}&quot;
+          &quot;${dst_file}&quot;
 
 done
 IFS=${old_IFS}</diff>
      <filename>yaflac2mp3.sh</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f6fe7f53b30d1176e45edca6118640b6e0ce6978</id>
    </parent>
  </parents>
  <author>
    <name>Octavio Ruiz</name>
    <email>tacvbo@tacvbo.net</email>
  </author>
  <url>http://github.com/tacvbo/yaflac2mp3/commit/047d672cd7b4f5445e3cf1e358baf83914b3c5c8</url>
  <id>047d672cd7b4f5445e3cf1e358baf83914b3c5c8</id>
  <committed-date>2009-10-20T17:39:30-07:00</committed-date>
  <authored-date>2009-10-20T17:39:30-07:00</authored-date>
  <message>Some fixes from Thatch's fork and overwrite (-o) option added</message>
  <tree>1126fb7964364df9d62f7935292750fc05c364f8</tree>
  <committer>
    <name>Octavio Ruiz</name>
    <email>tacvbo@tacvbo.net</email>
  </committer>
</commit>
