Exemple #1
0
def makeSizeList(lockssURL, name, password, limit, collectionFilter=None):
    rawAuidList = getAUIDList(lockssURL, name, password)
    auidList = []
    if collectionFilter:
        regObject = re.compile(collectionFilter)
        for auid in rawAuidList:
            if regObject.match(auid):
                auidList.append(auid)
    else:
        auidList = rawAuidList
        
    totalSize = 0L
    collectedAuids = []
    for auid in auidList:
        auidTotal = 0L
        fileString = getFileString(lockssURL, auid, name, password)
        fileDictList = makeFileDictList(fileString, "")
        for fileDict in fileDictList:
            auidTotal = auidTotal + fileDict["size"]
        if totalSize + auidTotal > limit:
            break
        totalSize = totalSize + auidTotal
        collectedAuids.append(auid)
    
    return collectedAuids
Exemple #2
0
def makeBagFromAUID(lockssURL, auid, name, password, newBagPath, fetchProxy, fill=False):
    """
    Try and automate the process
    """
    fileString = getFileString(lockssURL, auid, name, password)
    #print fileString
    hashString = getHashString(lockssURL, auid, name, password)
    fileDictList = makeFileDictList(fileString, hashString, True)
    
    makeBag(auid, fileDictList, newBagPath, fetchProxy, None, fill)
    
    if fill:
        fillBag(lockssURL, fileDictList, auid, newBagPath, name, password)
        addMD5Manifest(newBagPath, fileDictList)
Exemple #3
0
def calculateSize(lockssURL, name, password, collectionFilter):
    rawAuidList = getAUIDList(lockssURL, name, password)
    print("Total number of AUIDs in LOCKSS cache is %s" % len(rawAuidList))
    auidList = []
    for auid in rawAuidList:
        if auid.startswith(collectionFilter):
            auidList.append(auid)
    print("Number of AUIDs that begin with '%s'is %s" % (collectionFilter, len(auidList)))
    totalSize = 0L
    for auid in auidList:
        auidTotal = 0L
        fileString = getFileString(lockssURL, auid, name, password)
        fileDictList = makeFileDictList(fileString, "")
        for fileDict in fileDictList:
            auidTotal = auidTotal + fileDict["size"]
        print("Size of files in auid %s is %s" % (auid, auidTotal))
        totalSize = totalSize + auidTotal
            
    return totalSize