Help with Sega CD Ripping.

A nice (keyboard based) front end for Arcade / Console game emulators.

Moderator: battlecat

Help with Sega CD Ripping.

Postby Zombie » Tue Sep 25, 2012 1:40 am

What's wrong with this code?

Code: Select all
#!/usr/bin/python

import os
import commands
from sys import argv

# programs
SOURCE_DRIVE = "/dev/cdrom"
DD_COMMAND = "/bin/dd"
CDPARANOIA_COMMAND = "/usr/bin/cdparanoia --quiet"
# Not needed because not ripping to MP3s
LAME_COMMAND = "/usr/bin/lame --quiet --preset insane"
LAME_COMMAND = "/bin/cp"
RM_COMMAND = "/bin/rm"

if (len(argv)  <2):
    print "USAGE: rip-sega-cd.py <title>"
else:
    title = argv[1]
    print "ripping " + title

    # rip ISO-9660 filesystem in the first track
    data_rip_command = DD_COMMAND + " if=" + SOURCE_DRIVE + " of=\"" + title + ".iso\""
    print "ripping data track..."
    print data_rip_command
    commands.getstatusoutput(data_rip_command)
    print

    # rip CD audio tracks -> MP3 files until cdparanoia reports an error
    # actually, leaving as WAV files because we're writing back to disc, not saving for emulation
    print "ripping audio tracks..."
    n = 2
    error = 0
    rm_command = RM_COMMAND + " cdda.wav"
    while (error == 0):
        # rip
        audio_rip_command = '%(cmd)s %(n)d' % \
            { 'cmd' : CDPARANOIA_COMMAND, 'n' : n }
        print audio_rip_command
        commands.getstatusoutput(audio_rip_command)

        # encode
        audio_encode_command = '%(cmd)s cdda.wav "%(title)s %(n)02d.mp3"' % \ 
            { 'cmd' : LAME_COMMAND, 'title' : title, 'n' : n } 
        # copying file instead
        audio_encode_command = '%(cmd)s cdda.wav "%(title)s %(n)02d.wav" % \
            { 'cmd' : LAME_COMMAND, 'title' : title, 'n' : n }
        print audio_encode_command
        if (commands.getstatusoutput(audio_encode_command)[0]):
            error = 1

        # cleanup
        print rm_command
        commands.getstatusoutput(rm_command)

        n = n + 1
        print
User avatar
Zombie
 
Posts: 791
Joined: Mon Oct 06, 2008 2:52 pm

Return to Wah!Cade

Who is online

Users browsing this forum: No registered users and 1 guest

cron