All pastes #362945 Raw Edit

Something

public text v1 · immutable
·published 2007-02-19 03:55 UTC
rendered paste body
def pretty_todisc(command, type='default'):
    """Return a prettified version of a given todisc Command."""
    assert isinstance(command, Command)
    result = ['%s' % command.args[0]]
    opts = command.args[1:]
    while opts:
        arg = str(opts.pop(0))
        if type == 'burn':
            if arg == app.outfile.outfile.get() or arg.startswith('-'):
                result.append(arg)
            else:
                result[-1] += ' ' + arg
        else:
            if arg.startswith('-') and not re.match('^[-+]?[0-9]+$', arg):
                result.append(arg)
            else:
                result[-1] += ' ' + arg
    return '\n'.join(result)


    def runBurnCommand(self):
        """Run the burning command"""
        burnCmd = self.getBurnCommand()
        outfile = app.outfile.outfile
        format = self.format.getFormat()
        if format == 'dvd':
            burnProgram = 'makedvd'
        elif format == 'svcd':
            burnProgram = 'makevcd'
        pretty_burnCmd = pretty_todisc(burnCmd, 'burn')
        Text = "Running command:\n" + burnProgram
        log.info(Text)
        log.info(pretty_burnCmd)