It is annoying sometimes you download some ISOs and they come in RARs but this is just how it is for now. Nowadays I have a quad-core system that really doesn't take much time to extract even a dual-layer ISO out of maximum compressed RAR set, but I still use this script to burn. You can disable skipping SFV checking, etc, but I would not recommend that as wodim does not care if unrar returns an error. It will burn erroneous data from that point on.
The whole point is that you are piping what unrar gives to stdout to wodim's stdin.
A shell command would be similar to the following:
#!/bin/sh unrar -p -inul therarfile.rar theisofile.iso | wodim speed=8 driveropts=burnfree tsize=$TSIZE -dao -eject -v -
You need 2 things though in this case, that you would have to fetch manually with unrar. Namely, you need the ISO file name and the uncompressed size of it. To get this data, use unrar -l. You will get similar output to below:
UNRAR 3.91 freeware Copyright (c) 1993-2009 Alexander Roshal
Volume somerar.rar
Name Size Packed Ratio Date Time Attr CRC Meth Ver
-------------------------------------------------------------------------------
someiso.iso 4052987904 49999901 --> 09-06-10 22:51 -rw------- 0D3D03BA m1g 2.9
-------------------------------------------------------------------------------
1 4052987904 49999901 1% volume 1
So now we see the TSIZE to use with wodim is 4052987904 and the ISO file name is someiso.iso.
The Python script below does the work above for you, and even handles RARs and ISOs with spaces in the name. It also handles casing like ISO vs iso.
Don't laugh at my Python inabilities! If you have any revisions, please comment.
Filename: burnrariso
#!/usr/bin/python import glob import subprocess import sys # Debugging # skip = True norartest = True skip = False r = 0 # Check if SFV file is present and check SFV if so p = "*.sfv" if glob.glob(p): print 'Found SFV file, verifying...' if skip != True: r = subprocess.call(['cksfv', '-f', glob.glob(p)[0]]) if r != 0: print 'Check errors above.' sys.exit(1) else: print 'Could not find any SFV files. Skipping CRC32 verification.' # Test extraction before burning p = "*.rar" if glob.glob(p): print 'Testing extraction...' f = glob.glob(p) q = "*.part01.rar" if glob.glob(q): f = glob.glob(q) s = "*.part001.rar" if glob.glob(s): f = glob.glob(s) if skip != True and norartest != True: r = subprocess.call(['unrar', 't', f[0]]) if r != 0: print 'Check errors above.' sys.exit(1) else: print 'No RARs found.' sys.exit(1) # Find if there is an ISO within the RAR f work = list(['', '']) r = subprocess.Popen(['unrar', 'l', f[0]], stdout=subprocess.PIPE) for line in r.stdout: if 'iso' in line or 'ISO' in line: work = line.split() break r.wait() # Handle spaces in ISO file name fn = work[0] if 'iso' not in fn and 'ISO' not in fn: fn = '' i = 0 for iso in work: if 'iso' in iso or 'ISO' in iso: fn += iso i += 1 break fn += iso + ' ' i += 1 if 'iso' not in fn and 'ISO' not in fn: print 'No ISO file found.' sys.exit(1) if 'iso' in work[0] or 'ISO' in work[0]: i = 1 tsize = work[i] print 'Command:' print ' unrar p -inul ' + f[0] + ' ' + '"' + fn + '"' + ' | wodim speed=8 driveropts=burnfree tsize=' + tsize + ' -dao -eject -v -' if len(fn) > 0: r1 = subprocess.Popen(['unrar', 'p', '-inul', f[0], fn], stdout=subprocess.PIPE, close_fds=True) r2 = subprocess.Popen(['wodim', 'speed=8', 'driveropts=burnfree', 'tsize=' + tsize, '-dao', '-eject', '-v', '-'], stdin=r1.stdout, close_fds=True) r1.stdout.close() r2.wait() r1.wait() #if r1 != 0: # print 'An error occurred. Check above.' # sys.exit(1)
Comments
Post new comment