mp3.sh: Asking for advice

From: Fafa Hafiz Krantz (fteg_at_london.com)
Date: 10/31/05

  • Next message: Michał Masłowski: "Re: Freebsd / FireFox / Macromedia Flash : The Quest"
    To: questions@freebsd.org
    Date: Mon, 31 Oct 2005 08:02:34 -0500
    
    

    Hello!

    I got this script here:

    #!/bin/sh
    #
    # Generate SFV and M3U for MP3 releases.
    # $URBAN: mp3.sh,v 1.0 2005/10/24 15:05:09 fafa Exp $
    #

    for file in `find . -name \*.nfo | sed 's,^\./,,'`; do

            directory="`dirname ${file}`"
            prefix="`basename ${file} | sed 's/.nfo//g'`"
            current="`basename ${directory}`"
            sfv="${directory}/${prefix}.sfv"
            m3u="${directory}/${prefix}.m3u"

                    cd ${directory}
                    
                    rm -f *.sfv
                    rm -f *.m3u
                    
                    touch ${sfv}
                    if [ test `cfv -C *.mp3 > &>/dev/null` -nq 0 ]
                            echo "CFV returned non-zero result."
                            break
                    fi
                    
                    cat ${current}.sfv | awk '! /^;/' > ${sfv}
                    rm -f ${current}.sfv
                    
                    for mp3 in *.mp3;
                    do echo "${mp3}" >> ${m3u};
                    done

            echo "$directory: Done"

    done

    In some cases though, an album contains two or more CDs -- making the files start
    with 3 digits, and not 2 like normal -- such as cd/track: 101, 102 etc. for CD1 and
    201, 202 etc. for CD2. If this is the case, then one .m3u (playlist) should be
    generated for each CD, like ${prefix}-cd1.m3u, ${prefix}-cd2.m3u etc.

    Now, I'm a super newbie when it comes to scripting. I have no idea what to do. I've
    been told I can use sed, or maybe echo $filename | egrep '^[[:digit:]]{2}[^[:digit:]]'
    but I am clueless as to how I could make that all work with my script.

    If anybody has a clue, please do share it :)

    Thanks you all ...

    --
    Fafa Hafiz Krantz
      Research Designer @ http://www.bleed.com
    -- 
    ___________________________________________________
    Play 100s of games for FREE! http://games.mail.com/
    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
    

  • Next message: Michał Masłowski: "Re: Freebsd / FireFox / Macromedia Flash : The Quest"

    Relevant Pages

    • Re: MP3s and Linux [ogg format]
      ... I just had a look at the script itself and that is how it works. ... there is little loss to get worried about (the mp3 to wav product may just ... be exactly what ogg captures anyway). ... > stores the output as a wav file. ...
      (Fedora)
    • Re: [SLE] bash Script Using Filenames with Embedded Spaces
      ... system where I have the mp32ogg utility to convert mp3 to ogg files which k3b can handle: ... The correct version of your script is: ... Some might argue that the double quotes at echo are superfluous; but they are not: ... You can do that in interactive usage, but refrain from it in shell scripts. ...
      (SuSE)
    • my perl script for ripping mp3s...aka MP3scRIPt
      ... This is a Perl script to convert audio cd tracks to mp3s. ... Possibly root privs to access the cdrom device ... - this is mainly a problem on 'variety cds', mp3 files suffering from this ill ...
      (comp.unix.bsd.freebsd.misc)
    • Re: OT: CD index software
      ... your entire CD collection to MP3? ... You can point the first script at a directory on ... recursively reads all the MP3 ID3 tags into a hash and saves the hash ...
      (uk.rec.motorcycles)
    • simple bash script help
      ... I have no bash script skills at all - need all the help I ... I want to convert a collection of mp3 files to wave or cdr. ... this one reports "basename: too many arguments" ...
      (comp.unix.shell)