LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-04-2009, 03:00 PM   #1
nerak99
Member
 
Registered: Feb 2006
Distribution: FC 15
Posts: 42

Rep: Reputation: 2
Itunes to mp3 or ogg or whatever


I wanted to convert my Itunes collection from my old mac to work on my FC10 box. I have posted here because this script does not quite work.
I have taken two other scripts from some this and other unix forums and almost made a recursive converter from what I saw in those.

At the moment the script sits at the root of the Music folder and when called by name it recursively works through the folder and converts the files at the end of the tree. (Currenlty it deletes intermediate files but not the original m4a files). It almost works(:-()

It would be more elegant to have a file in /usr/bin called m4a2mp3 or m4a2ogg which you gave a couple of parameters to and it then did its stuff.

Any takers?


Code:
#!/bin/sh
traverse()
{
 for i in *
  do
   ls "$i"
  done  
    if [ -d "$i" ]; then 
        cd  "$i"
        ls "$i"
        traverse     
    else 
        cd "$i"
        for j in *.m4a;
          do
            ls "$j"
            faad "$j"
            x=`echo "$j"|sed -e 's/.m4a/.wav/'`
            y=`echo "$j"|sed -e 's/.m4a/.mp3/'`
        faad -i "$j" 2>trackinfo.txt 
	title=`grep 'title: ' trackinfo.txt|sed -e 's/title" //'`
	artist=`grep 'album: ' trackinfo.txt|sed -e 's/artist" //'`
	album=`grep 'title: ' trackinfo.txt|sed -e 's/album" //'`
	genre=`grep 'title: ' trackinfo.txt|sed -e 's/genre" //'`
	track=`grep 'title: ' trackinfo.txt|sed -e 's/track" //'`
	year=`grep 'title: ' trackinfo.txt|sed -e 's/year" //'`
           lame --alt-preset 160 --tt "$title" --ta "$artist" --tl "$album" --tg "$genre" --tn "$track"$ --ty "$year" "$x" "$y"
          
        rm trackinfo.txt
        rm "$x"
     done
fi


}

Last edited by nerak99; 05-04-2009 at 03:04 PM.
 
Old 05-05-2009, 03:53 PM   #2
clvic
Member
 
Registered: Feb 2008
Location: Rome, Italy
Distribution: OpenSuSE 11.x, vectorlinux, slax, Sabayon
Posts: 206
Blog Entries: 2

Rep: Reputation: 45
It maybe you absolutely want to do this by script... but I suggest you using some good sound converter, such as "soundkonverter" which I suggest, or transkode. Both can also be installed as amarok plugins, but for mass conversions I think that using the standalone program is better.

In addition to what you would do with your script, these programs also organize your collection in folders as you like and flexibly rename the files, and can work in parallel on more than one file, in case you have more than one cpu core.

If you still want to go by scripting, you could try to simplify it by using the excellent ffmpeg command line program, that basically converts from any audio/video input file to any output format.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
AudioKonverter users....converting iTunes to mp3 cbjhawks Linux - Software 0 04-22-2009 09:18 AM
Speaking of .ogg vs .mp3 - .mp3 format now the center of legal battles Shadoglare Linux - News 1 04-16-2007 11:02 AM
MP3 or OGG in C exvor Programming 2 05-20-2006 02:22 PM
*.ogg --> *.mp3 zeky Linux - Software 3 04-11-2006 08:18 PM
mp3 to ogg gbj General 2 11-09-2003 03:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration