Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
cd2ogg script by Mountainman
Results 1 to 8 of 8

Thread: cd2ogg script by Mountainman

  1. #1
    Guest

    cd2ogg script by Mountainman

    You guys wanted to see it when I had it done (for the most part). Here it is. Try it out, let me know of any problems, or go ahead and change it and send it back to me. Give some feedback, as this is my first script project.
    Code:
    #!/bin/bash
    ############################################################
    #This is my first attempt at writing a bash script
    #Special thanks goes to Feztaa and Pam at LJR (www.linuxjunior.org)
    #I took part of one Feztaa's scripts that automated mp3 to ogg
    #and added a little to it here and there, changed a little, etc.
    #This script uses cdparanoia to encode files from the cd-rom into
    #wav files and then into Ogg Vorbis format, renaming them as it goes
    #from a name file that you specify at the start of the script.
    #I may add more to it later, I'll let you know.
    #This is cd2ogg v 0.5
    #and is covered by the GNU Public License 8)
    ############################################################
    #!/bin/bash
    ROOT_UID=0 #Only users with $UID 0 have Root priveledges
    E_NOTROOT=67
    
    
    if [ "$UID" -ne "$ROOT_UID" ]  #Checking for root
    then
     echo "Must be Root to run this script."
     exit $E_NOTROOT
    fi
    echo "What is the file holding the titles called?" #This is the file that holds
    read title_file      #the song names
    
    echo "Do you wish to encode an entire cd to .wav(y/n) ?" #encode or already encoded?
    read answer
    if [ $answer = y ]
     then cdparanoia -Q
      cdparanoia -vwB
    
    fi
    if  [ $answer = n ]
    then
     declare -a track #this makes an array to hold the track# in
     echo "Enter the track you want encoded seperated by a space?"
     echo "For example, 1 2 4 6 7" 
     read -a track  #This is where the input gets taken and stored in the array
     element_count=${#track[@]} #This counts the # of tracks entered.
    index=0
     while [ "$index" -lt "$element_count" ]
     do
      cdparanoia -Q
      echo `cdparanoia -vw ${track[$index]} "track_$index.wav"` #this does the work
      let "index = $index + 1"      #to make the .wavs 
     done
    fi
    for t in `cat $title_file`  #This was submitted by Pam at LJR 
    do     #www.linuxjunior.org. He is a much better
     a=`ls -tr *.wav | head -1` #coder that I am. 8)
     oggenc "$a" -q 5 -t "$t"
     rm *.wav
    done
    rm $title_file
    exit 0

  2. #2
    Guest

    Re:cd2ogg script by Mountainman

    an idea might be to add cddb support to write the read_title file - I wouldn't know anything about how to implement this but it would make the script even cooler.

  3. #3

    Re:cd2ogg script by Mountainman

    I was thinking along the same lines as you Lovechild, and I thought it would probably be easy (more fool me!). Could I find a nice little utility that just outputs a nice track listing after querying a cd? If it exists I'd like to know about it.
    After digging around I came up with a solution that involves the use of the following:
    cd-discid - returns info about a cd which can be used to query a cddb server.
    cddbcmd - sends commands to a cddb server.
    Both of these were available as debian packages.
    This is my mini script which queries the cd (in my case /dev/cdrom) and gets the info from a cddb server (in this case the default of freedb.org is used).

    Code:
    discidfull=`cd-discid /dev/cdrom`
    discid=`echo $discid | head --bytes=8`
    # I only use http because it gets through my firewall
    # Query the cddb server so as to get the correct parameters for a full read -
    # those being music category followed by discid, we throw the rest of the query
    # away.
    readparam=`cddbcmd -m http "cddb query $discidfull" | awk '{ print $1, $2; }'`
    # do the full read, for now just let it go to stdout
    cddbcmd -m http "cddb read $readparam"
    Along with some other info, this will list the track names as TITLE1=...,TITLE2=.... etc. This means that with a bit of manipulation, you can relate these TITLE names directly to "track" files and throw away my contribution to the script! :'(

    Edit: Oops, I didn't need that discid shell variable in the end.

  4. #4
    Guest

    Re:cd2ogg script by Mountainman

    I had thought about that when I was first starting this task, but the prog to query the freedb server was in c or c++ (not sure). For now, make sure that this works with no errors, dont remember if I had any or not, but it did encode seperate tracks and whole cds. I might add a query to set the quality level for the ogg encoding, just candy stuff mostly. The freedb thing is worth looking into. I will get back with you guys. Again, let me know how it goes. ;D(Yay! I did my first script) ;D

  5. #5

    Re:cd2ogg script by Mountainman

    I gave the script a try (cut n paste straight from this thread) and I fell foul of that 4th last line:
    Code:
    rm *.wav
    which removed all my freshly ripped wav files I think it should read:
    Code:
    rm $a
    Also, on my suggested cddb querying script, I have found that the initial query can return more than one possible id that can be used to get a track listing for the same cd. Therefore it is necessary to throw all the records away bar one. This is an updated version:
    Code:
    #!/bin/bash
    # Get discid string
    discid=`cd-discid /dev/cdrom`
    # Query cddb server to get parameters required for a full read
    readparam=`cddbcmd -m http "cddb query $discid" | head -1 |
    awk '{ print $1, $2; }'`
    # Do the full read, for now just let it go to stdout
    cddbcmd -m http "cddb read $readparam"

  6. #6
    Guest

    Re:cd2ogg script by Mountainman

    That should remove the wav files after it has encoded them to ogg. Either way, I will change it and try it out. I found a cd-disk id rpm for mandrake but not one for redhat. Havent got it installed yet. But, yeah I will change it to $a and try it out.

  7. #7
    Guest

    Re:cd2ogg script by Mountainman

    I cant get this thing to work on my laptop now. Can you believe that? works fine at home, and gets errors running the same version of linux redhat on my laptop. WTH?

  8. #8
    Moderator
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,760

    Re:cd2ogg script by Mountainman

    What errors?

Similar Threads

  1. Shouts to MountainMan
    By 10Dedfish in forum General Chat
    Replies: 14
    Last Post: 04-19-2005, 04:39 PM
  2. Mountainman!
    By pbharris in forum General Chat
    Replies: 5
    Last Post: 03-20-2004, 02:16 AM
  3. Mountainman
    By stryder144 in forum General Chat
    Replies: 3
    Last Post: 08-12-2003, 10:20 AM
  4. Mountainman ;)
    By in forum General Chat
    Replies: 1
    Last Post: 09-02-2002, 02:14 AM
  5. Mountainman
    By pbharris in forum General Chat
    Replies: 1
    Last Post: 02-14-2002, 04:03 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •