Logo Search packages:      
Sourcecode: hellanzb version File versions  Download package

def Hellanzb::PostProcessorUtil::processRars (   postProcessor  ) 

If the specified directory contains rars, unrar them. 

Definition at line 440 of file PostProcessorUtil.py.

00440                               :
    """ If the specified directory contains rars, unrar them. """
    if not isFreshState(postProcessor.dirName, 'rar'):

    # loop through a sorted list of the files until we find the first
    # rar, then unrar it. skip over any files we know unrar() has
    # already processed, and repeat
    processedRars = []
    files = os.listdir(postProcessor.dirName)
    files.sort(dotRarFirstCmp) # .rars come first
    start = time.time()
    unrared = 0
    for file in files:
        absPath = os.path.normpath(os.path.join(postProcessor.dirName, file))
        if absPath not in processedRars and not os.path.isdir(absPath) and \
                isRar(absPath) and not isDuplicate(absPath) and \
                not PAR2_LEFTOVER_SUFFIX.search(absPath) and not absPath.endswith('_broken'):
            # Found the first rar. this is always the first rar to start extracting with,
            # unless there is a .rar file. However, rar seems to be smart enough to look
            # for a .rar file if we specify this incorrect first file anyway
            justProcessedRars = unrar(postProcessor, file)

            # Move the processed rars out of the way immediately
            for rar in justProcessedRars:
            unrared += 1

    processComplete(postProcessor.dirName, 'rar')
    rarTxt = 'rar group'
    if unrared > 1:
        rarTxt += 's'
    e = time.time() - start
    info('%s: Finished unraring (%i %s, took: %s)' % (archiveName(postProcessor.dirName), unrared,
                                                      rarTxt, prettyElapsed(e)))

## From unrarsrc-3.4.3

// rar return codes

def unrar(postProcessor, fileName, pathToExtract = None):

Generated by  Doxygen 1.6.0   Back to index