Simple APE2FLAC converter

Материал из RSU WiKi
(Различия между версиями)
Перейти к: навигация, поиск
Строка 1: Строка 1:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
#!/bin/bash
 
#!/bin/bash
# Copyright (c) 2007 Juriy Foboss.  All rights reserved.
+
# Copyright (c) 2007 Juriy Strashnov.  All rights reserved.
 
#
 
#
 
# This program is free software; you can redistribute it and/or modify
 
# This program is free software; you can redistribute it and/or modify
Строка 49: Строка 49:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
== References ==
 
== References ==
 +
* [[Полезности для работающих в командной строке *nix]]
 
* [http://tldp.org/LDP/abs/html/ Advanced Bash-Scripting Guide. An in-depth exploration of the art of shell scripting]
 
* [http://tldp.org/LDP/abs/html/ Advanced Bash-Scripting Guide. An in-depth exploration of the art of shell scripting]
 
[[Category: Linux]]
 
[[Category: Linux]]
 
[[Category: Bash]]
 
[[Category: Bash]]

Версия 16:16, 8 июля 2011

#!/bin/bash
# Copyright (c) 2007 Juriy Strashnov.  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!"

References

Личные инструменты
Пространства имён

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