Register
It is currently Mon Oct 20, 2014 3:14 pm

Simple APE2FLAC converter


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sat Jan 27, 2007 10:13 pm   

Joined: Sat Jan 27, 2007 10:01 pm
Posts: 1
Code:
#!/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!"


Top
 Profile  
 PostPosted: Sat Jan 27, 2007 10:17 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 669
Location: Des Moines, Iowa
Thanks for posting the script foboss.

Welcome to bashscripts.org :D


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP