Simple APE2FLAC converter

Материал из RSU WiKi
(Различия между версиями)
Перейти к: навигация, поиск
 
Строка 1: Строка 1:
<nowiki><pre>#!/bin/bash
+
<pre>#!/bin/bash
 
# Copyright (c) 2007 Juriy Foboss.  All rights reserved.
 
# Copyright (c) 2007 Juriy Foboss.  All rights reserved.
 
#
 
#
Строка 45: Строка 45:
 
  fi
 
  fi
  
echo "Work complete!"</pre></nowiki>
+
echo "Work complete!"</pre>

Версия 21:34, 24 января 2007

#!/bin/bash
# Copyright (c) 2007 Juriy Foboss.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.


# Cheking if all needed programs are installed
for PROGZ in perl mac flac; do
 WPROGZ=`which $PROGZ`
 if test $? -ne 0; then
  # Error message is printed by 'which'
  exit 1
 fi
done

# Checking if APE files are presented in the directory
WAPE=`ls *.ape 2>&1`
if test $? -ne 0; then
 echo "No files to convert! Exiting."
 exit 1
fi

 # Converting APE->WAV->FLAC
 for j in *.ape; do
  nice mac "$j" "$j.wav" -d
  rm -f "$j"
  nice flac -8 "$j.wav"
  rm -f "$j.wav"
  echo "$j converted."
  echo "----------------------------"
 done

 echo "Renaming all \".ape.flac\" files to \".flac\"..."
 for i in *.ape.flac; do mv "$i" "${i/.ape.flac}".flac; done

 WCUE=`ls *.cue 2>&1`
 if test $? -ne 2; then
   for k in *.cue; do
    echo "CUE file $k found! Updating..."
    ls -1 -b *.cue | xargs perl -pi -w -e 's/.ape/.flac/g;';
   done
 fi

echo "Work complete!"
Личные инструменты
Пространства имён

Варианты
Действия
Навигация
Инструменты