View previous topic :: View next topic |
Author |
Message |
Nuisance-Value n00b
Joined: 12 Apr 2005 Posts: 23
|
Posted: Sun Mar 26, 2006 2:29 am Post subject: |
|
|
I've released a new version of the lossless2lossy script.
http://lossless2lossy.sourceforge.net/
I've added ogg and tagging support and more.
Don't worry I haven't forgotten to add the cue sheet splitting. I'll be adding it soon |
|
Back to top |
|
|
spitzwegerich l33t
Joined: 04 Mar 2003 Posts: 697 Location: Lower Bavaria, Central Europe
|
Posted: Mon Apr 24, 2006 6:59 pm Post subject: |
|
|
Hi!
Are you still working on this script?
Currently I am looking for a way to convert my flac files to vorbis or mp3 files. My flac files are CD images with embedded cue sheet, and I want to get track-wise vorbis/mp3 files. It would be great If that would be possible with your script. _________________ "Work is the curse of the drinking classes."
-Oskar Wilde |
|
Back to top |
|
|
Nuisance-Value n00b
Joined: 12 Apr 2005 Posts: 23
|
Posted: Tue Apr 25, 2006 12:29 am Post subject: |
|
|
Version 1.2 released!
+ Flac Support
+ Wavpack Support
+ Ability to covert wavs
+ Mixed source file type conversion
+ Trans-lossless support
+ Tagging support for all formats
+ Fixed bug with genre not being processed properly
http://lossless2lossy.sourceforge.net/
Hope that helps you
I still haven't added cue splitting I will do it. I have done most of my todo list now... |
|
Back to top |
|
|
Nuisance-Value n00b
Joined: 12 Apr 2005 Posts: 23
|
Posted: Tue May 02, 2006 1:42 pm Post subject: |
|
|
Version 1.21 released!
+ Fixed bug with flac tags
+ Fixed bug with input folder names with spaces not being dealt with.
http://lossless2lossy.sourceforge.net/ |
|
Back to top |
|
|
revertex l33t
Joined: 23 Apr 2003 Posts: 806
|
|
Back to top |
|
|
Pithlit l33t
Joined: 27 Dec 2003 Posts: 887 Location: fuhen
|
Posted: Tue Jun 20, 2006 3:05 pm Post subject: |
|
|
Some of us don't like to use wone for 1 simple fact
If it works in wine (or any of its forks, or similar projects), the developers have a good excuse for not making a native port. That in turn means... there will be less native ports of anything. Which in turn is very bad for Linux.
That is why Nuisanca-Value is doing a great job. And most of us apreciate it refardles of our use (or not use) his product. I myself don't use it (yet) as my script fulfills my needs perfectly. _________________ If someone solves a problem for you say thanks... and put [SOLVED] in the title! |
|
Back to top |
|
|
revertex l33t
Joined: 23 Apr 2003 Posts: 806
|
Posted: Tue Jun 20, 2006 3:36 pm Post subject: |
|
|
@Pithlit
I tottaly agree with you, i don't like run windows apps thought wine instead of run native apps, but sometimes wine is just convenient.
I know the Nuisance-Value scripts have a great -Value, but i don't know if worth install all the ape-mac thingy just to convert few files.
I'm trying to keep my instalation as minimalist as possilbe, there is no proposal to me install files that i will barely use.
That's why im suggesting monkey under wine as a alternative, maybe theres more ppl like me that have only few files to convert.
about wine, it could be a god thing, if ppl run a win app under wine it is a proof that a linux port is needed! |
|
Back to top |
|
|
Pithlit l33t
Joined: 27 Dec 2003 Posts: 887 Location: fuhen
|
Posted: Tue Jun 20, 2006 6:44 pm Post subject: |
|
|
If running apps through wine would mean more ports... we'd be swimming in games (are we?) and apps (hmm???).
Now let's do some simple math...
MAC_399F.exe (2.6 MB) + the whole wine install (including messing with its config that can turn out to be oh-not-so-simple)
or...
mac-3.99-u4-b5.tar.gz (421234B) + lossless2lossy-v1.21.gz (5182B) (or if you prefer my script @ ~1KB)
I don't really think there's any competition.
(I'm sorry if I sound like a bitch but I'll strongly defend what I think is better). If I need any app that has no native linux port (like... IE or Corel Draw, or some game once in a while...) I use Windows. It's a lot better than running stuff in wine. Not to mention it's still cheap... Bought an OEM version of win2k 6 years ago and it costs me like 0.05$/day. Cheap as hell... a lot cheaper than using Cedega for example.
However... use whatever rocks your boat. _________________ If someone solves a problem for you say thanks... and put [SOLVED] in the title! |
|
Back to top |
|
|
revertex l33t
Joined: 23 Apr 2003 Posts: 806
|
Posted: Tue Jun 20, 2006 7:33 pm Post subject: |
|
|
@Pithlit
Oh, no please i'm not wine zealot, but i'm forced to use some crap windoze apps, like IE.
Some web pages in my country are only fully funcional if i use this crap(IE), you can't imagine how i hate be forced to run wine.
It's too much open vmware, boot a vmchine just to browse some crap pages.
Thats why i've got wine installed.
I'm lazy, and some apps just run out of the box under wine.
As a big portage fan surelly i will emerge mac as soon it hit portage, but right now im a bit tired to see my portage overlay growing day after day.
About your script, wonder what i use to batch convert wav to mp3? monkey's audio only decompress ape to wav.
I totally agree that your method is the better one, there's much less steps to convert with your script, the wine thingy is just a dirty alternative. |
|
Back to top |
|
|
spiralvoice Apprentice
Joined: 09 Mar 2004 Posts: 238
|
Posted: Wed Aug 02, 2006 1:18 pm Post subject: |
|
|
Nuisance-Value wrote: | I still haven't added cue splitting I will do it. |
Do you have a clue when you will have finished CUE support? |
|
Back to top |
|
|
Nuisance-Value n00b
Joined: 12 Apr 2005 Posts: 23
|
Posted: Wed Aug 02, 2006 2:12 pm Post subject: |
|
|
I haven't done any work on the lossless2lossy script since the last version. But as people have requested cue support I'll add it asap.
Because I don't use cue files can you tell me what you want it to do and I'll make sure it does it. Can you also tell me what command line programs are best for cue splitting.
BTW are you the same spiralvoice from mldonkey? |
|
Back to top |
|
|
spiralvoice Apprentice
Joined: 09 Mar 2004 Posts: 238
|
Posted: Wed Aug 02, 2006 3:02 pm Post subject: |
|
|
Nuisance-Value wrote: | Because I don't use cue files can you tell me what you want it to do and I'll make sure it does it. |
I have some files like CDImage.ape + CDImage.cue which I want to split into *.mp3
Sample CUE file:
Code: | PERFORMER "put artist name here"
TITLE "put cd title here (CD1)"
FILE "CDImage.ape" WAVE
TRACK 01 AUDIO
TITLE "put track title here 1"
PERFORMER "put artist name here"
INDEX 01 00:00:00
TRACK 02 AUDIO
TITLE "put track title here 2"
PERFORMER "put artist name here"
INDEX 00 03:01:67
INDEX 01 03:05:40
... |
I would like to have a mp3 file for each track, named "$TRACK - $PERFORMER - $TITLE", the mp3 files should also have tags.
Nuisance-Value wrote: | Can you also tell me what command line programs are best for cue splitting. |
I have never done it myself but have a look at this:
http://gimpel.gi.funpic.de/wiki/index.php?title=Howto:convert_ape_to_wav/mp3/ogg_on_Linux#Split_ape_with_cue
Ebuild media-sound/shntool might also help: http://shnutils.freeshell.org/shntool
Nuisance-Value wrote: | BTW are you the same spiralvoice from mldonkey? |
Yes |
|
Back to top |
|
|
Nuisance-Value n00b
Joined: 12 Apr 2005 Posts: 23
|
Posted: Wed Aug 02, 2006 3:53 pm Post subject: |
|
|
spiralvoice wrote: |
Nuisance-Value wrote: | BTW are you the same spiralvoice from mldonkey? |
Yes |
To show my appreciation for your work on mldonkey I will make it a priority to make these additions, please allow about a week as I'm away for the next few days. |
|
Back to top |
|
|
revertex l33t
Joined: 23 Apr 2003 Posts: 806
|
Posted: Thu Aug 03, 2006 8:11 pm Post subject: |
|
|
@spiralvoice
convert ape to mp3 as usual, then use mp3splt, (emerge mp3splt)
mp3splt will slice perfectly if you have the cue file, the syntax is pretty simple.
Code: | mp3splt -c CDImage.cue CDImage.mp3 |
And yes, it will write ID3Tags for every track.
I had sliced lots of albums (APE+CUE) using this method, it even works perfect.
http://gimpel.funpic.de/files/cueape.sh convert in just one step, but bear in mind that it compress to mp3 with "lame --preset standard", just edit the script if you use other presset.
"lame --preset insane" is the way to go for me. |
|
Back to top |
|
|
spiralvoice Apprentice
Joined: 09 Mar 2004 Posts: 238
|
Posted: Thu Aug 03, 2006 10:15 pm Post subject: |
|
|
Nuisance-Value wrote: | To show my appreciation for your work on mldonkey I will make it a priority to make these additions, please allow about a week as I'm away for the next few days. |
Thank you, no need to hurry, its not urgent on my part.
I will try the stuff revertex posted, cueape.sh does not look bad.
I am gonna tell you if its enough for me. |
|
Back to top |
|
|
spiralvoice Apprentice
Joined: 09 Mar 2004 Posts: 238
|
Posted: Thu Aug 03, 2006 11:15 pm Post subject: |
|
|
revertex wrote: | http://gimpel.funpic.de/files/cueape.sh convert in just one step |
Correct, and it works perfectly here, thanks for the tip!
@Nuisance-Value: No need to hurry with cue-support for your script, I got the job done with cueape.sh |
|
Back to top |
|
|
Nuisance-Value n00b
Joined: 12 Apr 2005 Posts: 23
|
Posted: Fri Aug 11, 2006 1:06 am Post subject: |
|
|
Does this mean that cue support for the lossless2lossy script is not needed?
Let me know if people want it and I'll add it |
|
Back to top |
|
|
Tlaloc Guru
Joined: 21 Feb 2005 Posts: 451 Location: Europe - Alps - Tyrol
|
Posted: Fri Aug 25, 2006 6:01 pm Post subject: |
|
|
CUE sheet support would be still appreciated since I would prefer to be able to slpit CD images in flac or ape format to single flac files with tags. Hard disk space is not such a matter anymore and tracks are best converted for a portable media player to mp3 or ogg when needed.
Yes, please do it
Bye, Val. |
|
Back to top |
|
|
dh3rm3 Tux's lil' helper
Joined: 26 Aug 2003 Posts: 101
|
Posted: Fri Sep 08, 2006 3:50 pm Post subject: |
|
|
Well, as I don't want to downgrade any ape to a lossy format, be it ogg or mp3, I wrote this little bash script to convert .ape to .flac files
Hope it'll be useful to someone, so I post it here :
Code: |
#!/bin/bash
# ape to flac
for i in *.ape; do
echo "$i"
tgt=$(echo "$i" | sed -e "s/ape/wav/")
mac "$i" "$tgt" -d
flac --best *.wav
done
|
You can then tweak it to remove tmp .wav files for instance _________________ dh3rm3's place |
|
Back to top |
|
|
Aza n00b
Joined: 19 Sep 2006 Posts: 1
|
Posted: Tue Sep 19, 2006 11:25 am Post subject: Another possibility |
|
|
For those who might be interested in another possibility - there is a JMac project around.
http://jmac.sourceforge.net/
I, for instance, never was able to use the program mentioned in this topic, it always segfaulted on me. Probably it has something to do with the fact, that i use AMD64 system. |
|
Back to top |
|
|
SnEptUne l33t
Joined: 23 Aug 2004 Posts: 656
|
Posted: Fri Aug 24, 2007 9:10 pm Post subject: |
|
|
I couldn't find any good script that can split cue file with tags, so I have modified the lossless2lossy scripts to handle cue splitting with wav/ape file with the same prefix. For example, if the cue file is CDImage.cue, it would expect CDImage.wav or CDImage.ape. It isn't very efficient because it would split the wav file into the original path before copying them to the temp folder, but it works for now.
I also added MPC decoding support. Here's the script:
Code: | #bin/bash
#lossless2lossy version 1.21 - released 02/05/06
#http://sourceforge.net/projects/lossless2lossy/
#or
#http://lossless2lossy.sourceforge.net/
#REQUIREMENTS
#Lame - http://lame.sourceforge.net/ or emerge lame (gentoo)
#MAC - http://sourceforge.net/projects/mac-port/
#ID3V2 - http://sourceforge.net/projects/id3v2/ or emerge id3v2 (gentoo)
#flac - http://flac.sourceforge.net/ or emerge flac (gentoo)
#wavpack - http://www.wavpack.com/ or emerge wavpack (gentoo)
#oggenc - http://www.vorbis.com/
#DESCRIPTION
#This script will convert any files found under the toplevel folder and
#recreate the directory structure. It differs from most other conversion scripts
#because it is able to convert multiple files from multiple directories recursively
#if the lossy file is already in place the file will not be converted so this is ideal if you
#have added new lossless since you last converted to a lossy format
#NOTE:There is no order to the conversion other than the order of the files on the disk
#in otherwords files will not necessarily be encoded by folder.
#USE
#Start script by typing "bash lossless2lossy.sh -h"
#TODO
#add cue sheet splitting
#add genre list lookup for name to number conversion
#Add expert mode where user adds all program parameters for custom encoding
#NOTE: mac is sensitive to non-english characters and requires you linux distro to be using UTF-8 for its files and directories.
#QUESTIONS, suggestions, found bugs or requests visit http://sourceforge.net/projects/lossless2lossy/
#If you find a bug, please use the bug report system found on http://sourceforge.net/tracker/?group_id=162534&atid=824162
#Inspired by Pithlit
#Released under the GPL Licence
#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.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#http://www.gnu.org/licenses/gpl.txt
################
#System colours#
################
e() { echo -e "$@";tput sgr0; }
red="\E[31m"
green="\E[32m"
##############
#System check#
##############
clear
#test to see if mac is installed
if(test -x `whereis -b mac|sed -e 's/[^*]*\:\ //'|sed -e 's/\ [^*]*//'`)
then
e ${green}"mac: found"
else
e ${red}"mac: not found"
e ${red}"You can get it here: http://sourceforge.net/projects/mac-port/"
fi
#test to see if wavpack is installed
if(test -x `whereis -b wvunpack|sed -e 's/[^*]*\:\ //'|sed -e 's/\ [^*]*//'`)
then
e ${green}"wvunpack: found"
else
e ${red}"wvunpack: not found"
e ${red}"You can get it here: http://www.wavpack.com"
fi
#test to see if flac is installed
if(test -x `whereis -b flac|sed -e 's/[^*]*\:\ //'|sed -e 's/\ [^*]*//'`)
then
e ${green}"flac: found"
else
e ${red}"flac: not found"
e ${red}"You can get it here: http://flac.sourceforge.net"
fi
#test to see if lame is installed
if(test -x `whereis -b lame|sed -e 's/[^*]*\:\ //'|sed -e 's/\ [^*]*//'`)
then
e ${green}"lame: found"
else
e ${red}"lame: not found"
e ${red}"You can get it here: http://lame.sourceforge.net/"
fi
#test to see if ogg is installed
if(test -x `whereis -b oggenc|sed -e 's/[^*]*\:\ //'|sed -e 's/\ [^*]*//'`)
then
e ${green}"oggenc: found"
else
e ${red}"oggenc: not found"
fi
#test to see if id3v2 is installed
if(test -x `whereis -b id3v2|sed -e 's/[^*]*\:\ //'|sed -e 's/\ [^*]*//'`)
then
e ${green}"id3v2: found"
else
e ${red}"id3v2: not found"
e ${red}"You can get it here: http://sourceforge.net/projects/id3v2/"
fi
########################
#Command line parameter#
########################
HELP_ERROR="\a${red}Try:\n ${0} -h or --help"
case $1 in
-h|--help)
e
e ${green}"\033[1mlossless2lossy version 1.2 (http://lossless2lossy.sourceforge.net/)\033[0m"
e
e ${red}"QUESTIONS, suggestions, found bugs or requests visit http://sourceforge.net/projects/lossless2lossy/"
e
e "usage:"
e
e "\033[1mmp3\033[0m use: lossless2lossy.sh mp3 [vbr or cbr] [(vbr) 0-9 (cbr) 96,128,256] [lossless directory] [wav directory] [output directory] [save or nosave]"
e
e "\te.g. lossless2lossy.sh mp3 vbr 4 /home/media/lossless/ /home/media/wavs/ /home/media/mp3/ save"
e
e "\033[1mogg\033[0m use: lossless2lossy.sh ogg [vbr or cbr] [(vbr) 0-10 (cbr) 96,128,256] [lossless directory] [wav directory] [output directory] [save or nosave]"
e
e "\te.g. lossless2lossy.sh ogg cbr 128 /home/media/lossless/ /home/media/wavs/ /home/media/ogg/ nosave"
e
e "\033[1mflac\033[0m use: lossless2lossy.sh flac [(quality) 0(fastest)-8(highest)] [lossless directory] [wav directory] [output directory] [save or nosave]"
e
e "\te.g. lossless2lossy.sh flac 4 /home/media/lossless/ /home/media/wavs/ /home/media/flac/ save"
e
e "\033[1mape\033[0m use: lossless2lossy.sh ape [fast/normal/high/extrahigh/insane] [lossless directory] [wav directory] [output directory] [save or nosave]"
e
e "\te.g. lossless2lossy.sh ape high /home/media/lossless/ /home/media/wavs/ /home/media/ape/ save"
e
e "\033[1mwavpack\033[0m (lossless) use: lossless2lossy.sh wavpack [lossless directory] [wav directory] [output directory] [save or nosave]"
e
e "\te.g. lossless2lossy.sh wavpack /home/media/lossless/ /home/media/wavs/ /home/media/wavpack/ save"
e
e "\033[1mwavpack\033[0m (lossless hybrid/lossy) use: lossless2lossy.sh wavpackh [correction or nocorrection] [(quality between) 24-9600] [lossless directory] [wav directory] [output directory] [save or nosave]"
e
e "\te.g. lossless2lossy.sh wavpackh correction 500 /home/media/lossless/ /home/media/wavs/ /home/media/wavpack/ save"
e
e "Explanation:"
e "- vbr (variable bit rate) or cbr (constant bit rate) changes the lossy compression type"
e "- vbr quality setting. Lames default is 4 0=high quality, bigger files. 9=smaller files"
e " for ogg quality settings are between 0 (low) and 10 (high)"
e "- ape quality settings are either fast, normal, high, extra high or insane. Higher compressions take longer to process."
e "- hybrid method with wavpack produces a correction file which when used with the lossy file equates to a lossless file."
e "- wavpack lossy bitrate is specified between 24 and 9600 kbps"
e "- lossless directory is where all of the ape, flac or wavpack files are kept."
e "- wav directory is where either the wav files are stored or where they will temporarily be stored (if nosave is selected)"
e "- output directory is where the converted audio files with be stored."
e "- save or nosave dictates whether or not the in between wav file files will be saved."
exit
;;
mp3)
#check that the correct number of parameters have been entered
if [ $# != "7" ]
then
e ${red}"Incorrect number of parameters"
e $HELP_ERROR
exit
fi
conv_mode=mp3
conv_mode_ext=mp3
case $3 in
0|1|2|3|4|5|6|7|8|9)
VBR_VAR=${3}
;;
96|128|256)
CBR_BIT=${3}
;;
*)
e ${red}"Bit rate or quality number incorrect."
e $HELP_ERROR
exit
;;
esac
if [ $2 = vbr ] || [ $2 = VBR ]
then
MP3_VALUE="-V ${VBR_VAR}"
else
MP3_VALUE="-b ${CBR_BIT}"
fi
#check there are 7 parameters
if [ ${#*} != 7 ]
then
e ${red}"Command line parameters incorrect format."
e $HELP_ERROR
exit
fi
#vbr or cbr?
case $2 in
cbr | CBR)
if [ $3 -lt 96 ]
then
e ${red}"Bit rate or quality parmeter incorrect."
e $HELP_ERROR
exit
fi
;;
vbr | VBR)
if [ $3 -gt 10 ]
then
e ${red}"Bit rate or quality parmeter incorrect."
e $HELP_ERROR
exit
fi
;;
*)
e ${red}"VBR OR CBR parameter incorrect."
e $HELP_ERROR
exit
;;
esac
#check directories exist
if [ -d "${4}" ] && [ -d "${5}" ] && [ -d "${6}" ]
then
test -d "${4}" && APE_PATH="${4}"
test -d "${5}" && TEMP_CONV="${5}"
test -d "${6}" && CONV="${6}"
else
test -d "${4}" || e ${red}"Lossless path not valid"
test -d "${5}" || e ${red}"Temporary path not valid"
test -d "${6}" || e ${red}"lossy path not valid"
e $HELP_ERROR
exit
fi
#save wavs?
case $7 in
save | SAVE)
WAV_STATUS="1"
;;
nosave | NOSAVE)
WAV_STATUS="0"
;;
*)
e ${red}"Save wav parameter incorrect"
e $HELP_ERROR
exit
;;
esac
;;
ogg)
#check that the correct number of parameters have been entered
if [ $# != "7" ]
then
e ${red}"Incorrect number of parameters"
e $HELP_ERROR
exit
fi
conv_mode=ogg
conv_mode_ext=ogg
case $3 in
0|1|2|3|4|5|6|7|8|9|10)
VBR_VAR=${3}
;;
96|128|256)
CBR_BIT=${3}
;;
*)
e ${red}"Bit rate or quality parmeter incorrect"
e $HELP_ERROR
exit
;;
esac
if [ $2 = vbr ] || [ $2 = VBR ]
then
OGG_VALUE="-q ${VBR_VAR}"
else
OGG_VALUE="-b ${CBR_BIT}"
fi
#check there are 7 parameters
if [ ${#*} != 7 ]
then
e ${red}"Command line parameters incorrect format"
e $HELP_ERROR
exit
fi
#vbr or cbr?
case $2 in
cbr | CBR)
if [ $3 -lt 96 ]
then
e ${red}"Bit rate or quality parmeter incorrect"
e $HELP_ERROR
exit
fi
;;
vbr | VBR)
if [ $3 -gt 10 ]
then
e ${red}"Bit rate or quality parmeter incorrect"
e $HELP_ERROR
exit
fi
;;
*)
e ${red}"VBR OR CBR parameter incorrect."
e $HELP_ERROR
exit
;;
esac
#check directories exist
if [ -d "${4}" ] && [ -d "${5}" ] && [ -d "${6}" ]
then
test -d "${4}" && APE_PATH="${4}"
test -d "${5}" && TEMP_CONV="${5}"
test -d "${6}" && CONV="${6}"
else
test -d "${4}" || e ${red}"Lossless path not valid"
test -d "${5}" || e ${red}"Temporary path not valid"
test -d "${6}" || e ${red}"lossy path not valid"
e $HELP_ERROR
exit
fi
#save wavs?
case $7 in
save | SAVE)
WAV_STATUS="1"
;;
nosave | NOSAVE)
WAV_STATUS="0"
;;
*)
e ${red}"Save wav parameter incorrect"
e $HELP_ERROR
exit
;;
esac
;;
flac)
#check that the correct number of parameters have been entered
if [ $# != "6" ]
then
e ${red}"Incorrect number of parameters"
e $HELP_ERROR
exit
fi
conv_mode=flac
conv_mode_ext=flac
case $2 in
0|1|2|3|4|5|6|7|8)
flac_compression=${2}
;;
esac
#check directories exist
if [ -d "${3}" ] && [ -d "${4}" ] && [ -d "${5}" ]
then
test -d "${3}" && APE_PATH="${3}"
test -d "${4}" && TEMP_CONV="${4}"
test -d "${5}" && CONV="${5}"
else
test -d "${3}" || e ${red}"Lossless path not valid"
test -d "${4}" || e ${red}"Temporary path not valid"
test -d "${5}" || e ${red}"lossy path not valid"
e $HELP_ERROR
exit
fi
#save wavs?
case $6 in
save | SAVE)
WAV_STATUS="1"
;;
nosave | NOSAVE)
WAV_STATUS="0"
;;
*)
e ${red}"Save wav parameter incorrect"
e $HELP_ERROR
exit
;;
esac
;;
ape)
#check that the correct number of parameters have been entered
if [ $# != "6" ]
then
e ${red}"Incorrect number of parameters"
e $HELP_ERROR
exit
fi
conv_mode=ape
conv_mode_ext=ape
case $2 in
[fF][aA][sS][tT])
ape_compression='-c1000'
;;
[nN][oO][rR][mM][aA][lL])
ape_compression='-c2000'
;;
[hH][iI][gG][hH])
ape_compression="-c3000"
;;
[eE][xX][tT][rR][aA][hH][iI][gG][hH])
ape_compression="-c5000"
;;
[iI][nN][sS][aA][nN][eE])
ape_compression="-c5000"
;;
*)
e ${red}"compression mode invalid"
e $HELP_ERROR
exit
esac
#check directories exist
if [ -d "${3}" ] && [ -d "${4}" ] && [ -d "${5}" ]
then
test -d "${3}" && APE_PATH="${3}"
test -d "${4}" && TEMP_CONV="${4}"
test -d "${5}" && CONV="${5}"
else
test -d "${3}" || e ${red}"Lossless path not valid"
test -d "${4}" || e ${red}"Temporary path not valid"
test -d "${5}" || e ${red}"lossy path not valid"
e $HELP_ERROR
exit
fi
#save wavs?
case $6 in
save | SAVE)
WAV_STATUS="1"
;;
nosave | NOSAVE)
WAV_STATUS="0"
;;
*)
e ${red}"Save wav parameter incorrect"
e $HELP_ERROR
exit
;;
esac
;;
wavpack)
#check that the correct number of parameters have been entered
if [ $# != "5" ]
then
e ${red}"Incorrect number of parameters"
e $HELP_ERROR
exit
fi
conv_mode=wavpack
conv_mode_ext=wv
#check directories exist
if [ -d "${2}" ] && [ -d "${3}" ] && [ -d "${4}" ]
then
test -d "${2}" && APE_PATH="${2}"
test -d "${3}" && TEMP_CONV="${3}"
test -d "${4}" && CONV="${4}"
else
test -d "${2}" || e ${red}"Lossless path not valid"
test -d "${3}" || e ${red}"Temporary path not valid"
test -d "${4}" || e ${red}"lossy path not valid"
e $HELP_ERROR
exit
fi
#save wavs?
case $5 in
save | SAVE)
WAV_STATUS="1"
;;
nosave | NOSAVE)
WAV_STATUS="0"
;;
*)
e ${red}"Save wav parameter incorrect"
e $HELP_ERROR
exit
;;
esac
;;
wavpackh)
#check that the correct number of parameters have been entered
if [ $# != "7" ]
then
e ${red}"Incorrect number of parameters"
e $HELP_ERROR
exit
fi
conv_mode=wavpack
conv_mode_ext=wv
case $2 in
[cC][oO][rR][rR][eE][cC][tT][iI][oO][nN])
correction=c
;;
[nN][oO][cC][oO][rR][rR][eE][cC][tT][iI][oO][nN])
correction=""
;;
*)
e ${red}"correction input invalid"
e $HELP_ERROR
exit
esac
if [ $3 -lt 24 ] || [ $3 -gt 9600 ]
then
e ${red}"Bit rate or quality parmeter incorrect."
e $HELP_ERROR
exit
fi
#collection wavpack options together
wavpack_options="${correction}b${3}"
#check directories exist
if [ -d "${4}" ] && [ -d "${5}" ] && [ -d "${6}" ]
then
test -d "${4}" && APE_PATH="${4}"
test -d "${5}" && TEMP_CONV="${5}"
test -d "${6}" && CONV="${6}"
else
test -d "${4}" || e ${red}"Lossless path not valid"
test -d "${5}" || e ${red}"Temporary path not valid"
test -d "${6}" || e ${red}"lossy path not valid"
e $HELP_ERROR
exit
fi
#save wavs?
case $7 in
save | SAVE)
WAV_STATUS="1"
;;
nosave | NOSAVE)
WAV_STATUS="0"
;;
*)
e ${red}"Save wav parameter incorrect"
e $HELP_ERROR
exit
;;
esac
;;
*)
e $HELP_ERROR
exit
;;
esac
###########
#FUNCTIONS#
###########
#Read ID3V2 tags
read_tags()
{
while read tag;
do
case "${tag%(*}" in
TIT2*) TIT2="${tag#"TIT2 (Title/songname/content description): "}" ;;
TPE1*) TPE1="${tag#"TPE1 (Lead performer(s)/Soloist(s)): "}" ;;
TALB*) TALB="${tag#"TALB (Album/Movie/Show title): "}" ;;
TYER*) TYER="${tag#"TYER (Year): "}" ;;
TRCK*) TRCK="${tag#"TRCK (Track number/Position in set): "}" ;;
COMM*) COMM="${tag#"COMM (Comments): ()[eng]: "}" ;;
TENC*) TENC="${tag#"TENC (Encoded by): "}" ;;
TCON*) TCON="${tag#"TCON (Content type): "}"; TCON_LONG=${TCON%%(*}; TCON=${TCON##*(}; TCON=${TCON%%)*} ;;
esac
done < <(id3v2 -l "${APE_PATH}/${filename}")
#Read ID3 tags if ID3V2 don't exist
if [ -z ${TIT2} ]
then
while read tag;
do
case ${tag} in
Title*)
TIT2=${tag#Title : }
TIT2=${TIT2%%Artist:*}
TPE1=${tag##*Artist:}
;;
Album*)
TALB=${tag#Album : }
TALB=${TALB%%Year:*}
TYER=${tag##*"Year:"}
TYER=${TYER%%, Genre:*}
TCON=${tag##*Genre:}
TCON_LONG=${TCON%%(*}
TCON=${TCON##*(}
TCON=${TCON%%)*}
;;
Comment*)
COMM=${tag#*Comment:}
COMM=${COMM%%Track:*}
TRCK=${tag##*Track:}
;;
esac
done < <(id3v2 -l "${APE_PATH}/${filename}")
fi
#Remove leading and trailing whitespace from tags
TIT2=`expr "$TIT2" : '[[:space:]]*\(.*\)[[:space:]]*$'`
TPE1=`expr "$TPE1" : '[[:space:]]*\(.*\)[[:space:]]*$'`
TALB=`expr "$TALB" : '[[:space:]]*\(.*\)[[:space:]]*$'`
TYER=`expr "$TYER" : '[[:space:]]*\(.*\)[[:space:]]*$'`
TRCK=`expr "$TRCK" : '[[:space:]]*\(.*\)[[:space:]]*$'`
COMM=`expr "$COMM" : '[[:space:]]*\(.*\)[[:space:]]*$'`
TENC=`expr "$TENC" : '[[:space:]]*\(.*\)[[:space:]]*$'`
TCON=`expr "$TCON" : '[[:space:]]*\(.*\)[[:space:]]*$'`
TCON_LONG=`expr "$TCON_LONG" : '[[:space:]]*\(.*\)[[:space:]]*$'`
if [ "${TCON}" != "" ]
then
if [ ${TCON} -eq "255" ]
then
TCON=""
fi
fi
}
#read flac (ogg) tags
flac_tag()
{
while read tag;
do
case "${tag%(*}" in
[tT][iI][tT][lL][eE]*) TIT2="${tag#[tT][iI][tT][lL][eE]=}" ;;
[aA][rR][tT][iI][sS][tT]*) TPE1="${tag#[aA][rR][tT][iI][sS][tT]=}" ;;
[aA][lL][bB][uU][mM]*) TALB="${tag#[aA][lL][bB][uU][mM]=}" ;;
[dD][aA][tT][eE]*) TYER="${tag#[dD][aA][tT][eE]=}" ;;
[tT][rR][aA][cC][kK][nN][uU][mM][bB][eE][rR]*) TRCK="${tag#[tT][rR][aA][cC][kK][nN][uU][mM][bB][eE][rR]=}" ;;
[cC][oO][mM][mM][eE][nN][tT]*) COMM="${tag#[cC][oO][mM][mM][eE][nN][tT]=}" ;;
[gG][eE][nN][rR][eE]*) TCON_LONG="${tag#[gG][eE][nN][rR][eE]=}" ;;
esac
done < <(metaflac --show-tag=Album --show-tag=Artist --show-tag=Title --show-tag=Date --show-tag=TrackNumber --show-tag=Genre "${APE_PATH}/${filename}")
}
#read tags from cue file
read_cue_tag()
{
e ${green} "Executing cueprint -d album:%T ${APE_PATH}/${cuefile} ..."
while read tag;
do
case "${tag}" in
album*) TALB="${tag#album:}" ;;
esac
done < <(cueprint -d album:%T "$2" && echo "")
e ${green} "Album = $TALB"
e ${green} "Executing cueprint -n $1 $2) ..."
while read tag;
do
case "${tag%(*}" in
title*) TIT2="${tag#title:}" ;;
perfomer*) TPE1="${tag#perfomer:}" ;;
track*) TRCK="${tag#track number:}" ;;
message*) COMM="${tag#message:}" ;;
genre*) TCON_LONG="${tag#genre:}" ;;
esac
done < <(cueprint -n $1 "$2")
#Remove leading and trailing whitespace from tags
TIT2=`expr "$TIT2" : '[[:space:]]*\(.*\)[[:space:]]*$'`
TPE1=`expr "$TPE1" : '[[:space:]]*\(.*\)[[:space:]]*$'`
TALB=`expr "$TALB" : '[[:space:]]*\(.*\)[[:space:]]*$'`
TRCK=`expr "$TRCK" : '[[:space:]]*\(.*\)[[:space:]]*$'`
COMM=`expr "$COMM" : '[[:space:]]*\(.*\)[[:space:]]*$'`
TCON_LONG=`expr "$TCON_LONG" : '[[:space:]]*\(.*\)[[:space:]]*$'`
}
#write id3 tags
write_tag ()
{
id3v2 -t "${TIT2}" -a "${TPE1}" -A "${TALB}" -y "${TYER}" -T "${TRCK}" -c "${COMM}" -g "${TCON}" "${CONV}/${filename%.*}.${conv_mode_ext}"
}
#clear tagging varibles
unset_tags ()
{
#unset tags so untagged get false info
unset TIT2; unset TPE1; unset TALB; unset TYER; unset TRCK; unset COMM; unset TENC; unset TCON; unset TCON_LONG;
}
#############
#CORE SCRIPT#
#############
cd "${APE_PATH}"
while read filename;
do
filename="${filename#*/}"
#process cue file if it exists
if [[ $filename = *.[Cc][Uu][Ee] ]]
then
if [[ -a "${APE_PATH}/${filename%.*}.ape" ]]
then
cuefile="${filename}"
e ${green}"CUE file ${cuefile} detected. Splitting ${APE_PATH}/${filename%.*}.ape according to cue descriptor..."
cuebreakpoints "${APE_PATH}/${cuefile}" | shnsplit -o wav -d "${APE_PATH}" -a "" "${APE_PATH}/${cuefile%.*}.ape" && rm "${APE_PATH}/${cuefile%.*}.ape"
fi
if [[ -a "${APE_PATH}/${filename%.*}.wav" ]]
then
cuefile="${filename}"
e ${green}"CUE file ${cuefile} detected. Splitting ${APE_PATH}/${filename%.*}.wav according to cue descriptor..."
cuebreakpoints "${APE_PATH}/${cuefile}" | shnsplit -o wav -d "${APE_PATH}" -a "" "${APE_PATH}/${cuefile%.*}.wav" && rm "${APE_PATH}/${cuefile%.*}.wav"
fi
fi
done < <(find -depth)
e ${green} "CUEFILE = ${cuefile}"
find -depth | while read filename;
do
filename="${filename#*/}"
#get directory names only so they can be created
CON_DIR=`dirname "${filename}"`
#push through only lossless files
if [[ $filename = *.[Aa][Pp][Ee] ]] || [[ $filename = *.[wW][vV] ]] || [[ $filename = *.[fF][lL][aA][cC] ]] || [[ $filename = *.[wW][aA][vV] ]] || [[ $filename = *.[mM][pP][cC] ]]
then
#skip if already exists
if test -a "${CONV}/${filename%.*}.${conv_mode_ext}"
then
e ${green}"${CONV}/${filename%.*}.${conv_mode} exists, skipping conversion"
else
#create lower level directories but ignore .
if [ "${CON_DIR}" != "." ]
then
mkdir "${TEMP_CONV}/${CON_DIR}" -p
mkdir "${CONV}/${CON_DIR}" -p
fi
case ${filename##*.} in
[Aa][Pp][Ee])
#ape decompression
if test -a "${TEMP_CONV}/${filename%.*}.wav"
then
e ${green}"${TEMP_CONV}/${filename%.*}.wav exists, skipping decompression"
#readtags(function)
read_tags
else
mac "${APE_PATH}/${filename}" "${TEMP_CONV}/${filename%.*}.wav" -d
#readtags(function)
read_tags
fi
;;
[wW][vV])
#wavpack decompression
if test -a "${TEMP_CONV}/${filename%.*}.wav"
then
e ${green}"${TEMP_CONV}/${filename%.*}.wav exists, skipping decompression"
#readtags(function)
read_tags
else
wvunpack "${APE_PATH}/${filename}" "${TEMP_CONV}/${filename%.*}.wav"
#readtags(function)
read_tags
fi
;;
[fF][lL][aA][cC])
#flac depcompression
if test -a "${TEMP_CONV}/${filename%.*}.wav"
then
e ${green}"${TEMP_CONV}/${filename%.*}.wav exists, skipping decompression"
#readtags(function)
flac_tag
else
flac -d "${APE_PATH}/${filename}" -o "${TEMP_CONV}/${filename%.*}.wav"
#readtags(function)
flac_tag
fi
;;
[wW][aA][vV])
if test -a "${APE_PATH}/${cuefile}"
then
e ${green}"Reading tag for track ${filename%.*} using ${APE_PATH}/${cuefile}"
#readtags(function) from cue file
read_cue_tag "${filename%.*}" "${APE_PATH}/${cuefile}"
fi
e ${red}"Wav file found in lossless folder, moving to temp folder and performing conversion. Tags will need to be added manually if cue file is not provided"
e ${green} "Executing cp ${APE_PATH}/${filename} ${TEMP_CONV}/${filename%.*}.wav ..."
cp "${APE_PATH}/${filename}" "${TEMP_CONV}/${filename%.*}.wav"
;;
[mM][pP][cC])
if test -a "${TEMP_CONV}/${filename%.*}.wav"
then
e ${green}"${TEMP_CONV}/${filename%.*}.wav exists, skipping decompression"
#readtags(function)
read_tags
else
mppdec "${APE_PATH}/${filename}" "${TEMP_CONV}/${filename%.*}.wav"
#readtags(function)
read_tags
fi
esac
case "${conv_mode}" in
mp3)
#mp3 compression
lame -h --add-id3v2 --tt "${TIT2}" --ta "${TPE1}" --tl "${TALB}" --ty "${TYER}" --tn "${TRCK}" --tc "${COMM}" --tg "${TCON}" "${MP3_VALUE}" "${TEMP_CONV}/${filename%.*}.wav" "${CONV}/${filename%.*}.mp3"
;;
ogg)
#ogg compression
oggenc -N "${TRCK}" -t "${TIT2}" -l "${TALB}" -a "${TPE1}" -d "${TYER}" -G "${TCON_LONG}" "${OGG_VALUE}" "${TEMP_CONV}/${filename%.*}.wav" -o "${CONV}/${filename%.*}.ogg"
;;
flac)
#flac compression
e ${green} "Executing flac -${flac_compression} ${TEMP_CONV}/${filename%.*}.wav -o ${CONV}/${filename%.*}.flac --tag=Album=${TALB} --tag=Artist=${TPE1} --tag=Title=${TIT2} --tag=Date=${TYER} --tag=TrackNumber=${TRCK} --tag=Genre=${TCON_LONG}"
flac -${flac_compression} "${TEMP_CONV}/${filename%.*}.wav" -o "${CONV}/${filename%.*}.flac" --tag=Album="${TALB}" --tag=Artist="${TPE1}" --tag=Title="${TIT2}" --tag=Date="${TYER}" --tag=TrackNumber="${TRCK}" --tag=Genre="${TCON_LONG}"
;;
ape)
#ape compression
mac "${TEMP_CONV}/${filename%.*}.wav" "${CONV}/${filename%.*}.ape" ${ape_compression}
#write id3 tags
write_tag
;;
wavpack)
#wavpack compression
wavpack -h"${wavpack_options}" "${TEMP_CONV}/${filename%.*}.wav" "${CONV}/${filename%.*}.wv"
#write id3 tags
write_tag
;;
esac
#unset tag memory (function)
unset_tags
if [ "${WAV_STATUS}" = "0" ]
then
rm "${TEMP_CONV}/${filename%.*}.wav"
if [ "${CON_DIR}" != "." ]
then
rmdir "${TEMP_CONV}/${CON_DIR}"
fi
fi
fi
fi
done
e ${green}"\n\t\tConversion Complete"
|
It isn't error free, but it is still better than no cue splitting support at all.
For MPC support, musepack-tools is needed. For cue splitting support, cuetools and shntool is needed.
mac-port is not longer available for download, so you can use jmac instead by replacing "mac" with "java -jar /path/to/jmac.jar".
I wonder why they deleted mac-port. Fortunately, web mirrors still have the tarball for mac. _________________ "There will be more joy in heaven over the tear-bathed face of a repentant sinner than over the white robes of a hundred just men." (LM, 114) |
|
Back to top |
|
|
cayenne l33t
Joined: 17 Oct 2002 Posts: 945 Location: New Orleans
|
Posted: Wed Nov 07, 2007 2:05 am Post subject: Re: Another possibility |
|
|
Aza wrote: | For those who might be interested in another possibility - there is a JMac project around.
http://jmac.sourceforge.net/
I, for instance, never was able to use the program mentioned in this topic, it always segfaulted on me. Probably it has something to do with the fact, that i use AMD64 system. |
I downloaded this...and unzipped it...but, I cannot figure how to use it...I don't know much about java...how to set my PATH to use the command from anywhere...or what to set the classpath to...any ideas?
I tried to emerge search for the mac application alluded to earlier in this thread, but, portage didn't seem to be able to find anything named 'mac'....has this been taken out of portage like xmms was awhile back?
I've found these hard to find old Stones boots that are in this .ape format....and can't for the life of me figure on linux to decode them back to .wav files....
Any help greatly appreciated...
cayenne _________________ Light travels faster than sound. This is why some people appear bright until you hear them speak......... |
|
Back to top |
|
|
SnEptUne l33t
Joined: 23 Aug 2004 Posts: 656
|
Posted: Thu Nov 08, 2007 10:06 pm Post subject: Re: Another possibility |
|
|
cayenne wrote: | Aza wrote: | For those who might be interested in another possibility - there is a JMac project around.
http://jmac.sourceforge.net/
I, for instance, never was able to use the program mentioned in this topic, it always segfaulted on me. Probably it has something to do with the fact, that i use AMD64 system. |
I downloaded this...and unzipped it...but, I cannot figure how to use it...I don't know much about java...how to set my PATH to use the command from anywhere...or what to set the classpath to...any ideas?
I tried to emerge search for the mac application alluded to earlier in this thread, but, portage didn't seem to be able to find anything named 'mac'....has this been taken out of portage like xmms was awhile back?
I've found these hard to find old Stones boots that are in this .ape format....and can't for the life of me figure on linux to decode them back to .wav files....
Any help greatly appreciated...
cayenne |
Hmm... how about "emerge sun-jre-bin"? You don't need to set classpath in Gentoo, that's what java-config is for.
/usr/local/bin should already be in users' path, so if you want to use the script, you just need to download to /usr/local/bin and do a chmod +x.
To run a jar application, the command is java -jar filename. Don't unzip the jar file.
mac was never in offical portage to begin with.
You can use the script in my previous post to decode .ape to wav, or even better, flac. If it is one big ape file with cuesheet, you just need to rename the cue to the same filename as the .ape but with different extension. The script doesn't work well for non-unicode cuesheet however. _________________ "There will be more joy in heaven over the tear-bathed face of a repentant sinner than over the white robes of a hundred just men." (LM, 114) |
|
Back to top |
|
|
|