The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to burn DVD on the fly? satimis Shell Programming and Scripting 0 05-20-2008 06:17 AM
How to burn a bootable DVD on aix 5.3? rainbow_bean AIX 5 04-07-2008 06:12 PM
Burn-CD 1.7.3 (Default branch) iBot Software Releases - RSS News 0 01-06-2008 05:50 PM
how to burn a CD/DVD in solaris8 environment surainbow SUN Solaris 8 09-18-2007 04:38 AM
how to burn these files...? D-iew BSD 4 10-14-2004 10:11 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-12-2007
bog333 bog333 is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 3
Music cd burn

Allo.
I do a program using shell script to burn cds and dvds because I don't want to install one with kde or gnome dependance. I want to optimize one of my shell script. this shell script is to burn music cds. I juste have to go in shell and write :
burn_cd_music audio1.mp3 audio2.mp3 audio1.ogg audio1.wav
and the shell script copy file in /tmp/cd_temp, converte them in .wav and burn the cd. It's fonctionnal, but I don't want to have temporary file.....
Can I use pipe or buffer to do that, and how?
Sorry for my english, if you don't understand, I will try to better explain


Give me you ideas
My script is:
#!/bin/bash
#do a liste of the mp3 files and one for the ogg file
for i in $@
do
j=`echo $i | cut -f2 -d '.'`
if test $j = 'ogg'
then
list1="$list1 $i"
fi
if test $j = 'mp3'
then
list2="$list2 $i"
fi
done

#copy the file in /tmp/cd_temp (I don't want to do this)
mkdir /tmp/cd_temp
for i in $@
do
cp $i /tmp/cd_temp/
done

#go at the files directory
cd /tmp/cd_temp

#convert the ogg file in wav file
for i in list1
do
sox `basename $i .ogg`.ogg `basename $i .ogg`.wav
rm `basename $i .ogg`.ogg
done

#convert the mp3 file in wav file
for i in list2
do
mpg123 -w `basename $i .mp3`.wav $i
rm `basename $i .mp3`.mp3
done

#burn CD
cdrecord dev=ATA:0,0,0 -eject speed=2 -pad -audio *.wav

#erase the temporary file
rm -r /tmp/cd_temp/
  #2 (permalink)  
Old 06-12-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
Bog,
Since I don't know your application, I could not test this
script -- see if it works for you:
Code:
#!/bin/bash

#Saves the current directory
mSaveDir=`pwd`

#Save the list of "ogg" and "wav" files
mListogg=""
mListmp3=""
for mFileName in $@
do
  j=`echo $mFileName | cut -f2 -d '.'` 
  if test $j = 'ogg' 
  then
    mListogg=${mListogg}" "$mFileName
  fi
  if test $j = 'mp3' 
  then
    mListmp3=${mListmp3}" "$mFileName
  fi
done

#make the "/tmp/cd_temp/" directory
mkdir /tmp/cd_temp

#go at the files directory
cd /tmp/cd_temp

#convert the ogg file in wav file 
for mFileName in ${mListogg}
do
  mBaseName=`basename $mFileName .ogg`
  mFullogg=$mSaveDir"/"$mBaseName".ogg"
  mFilewav=$mBaseName".wav"
  sox $mFullogg $mFilewav
done

#convert the mp3 file in wav file 
for mFileName in ${mListmp3}
do
  mBaseName=`basename $mFileName .mp3`
  mFullmp3=$mSaveDir"/"$mBaseName".mp3"
  mFilewav=$mBaseName".wav"
  mpg123 -w mFilewav ${mFullmp3}
done

#burn CD
cdrecord dev=ATA:0,0,0 -eject speed=2 -pad -audio *.wav

#erase the temporary file
rm -r /tmp/cd_temp/
  #3 (permalink)  
Old 06-12-2007
bog333 bog333 is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 3
Tank you,
your script don't copy the original file in /tmp/cd_temp and it's good (better then my script).we have the first step, but now is it possible to don't create any temporary file. is it possible to directly pass all the convertion too cdrecord by pipe. My gold it's too eliminate all of the temporary file.
  #4 (permalink)  
Old 06-12-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
Bog,
Temporary files are used by the application.
It requires a code change in the application.
  #5 (permalink)  
Old 06-12-2007
bog333 bog333 is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 3
what kind of change can I do to eliminate the temporary file? I know that it's posible somme time to do that with pipe, but I think it's not applicable in this situation. have it a buffer in shell script?

thanks in advance
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0