示例#1
0
def getFilesFromFolder(folder, types=[".mp3"]):
    fileList = []
    iterations = 0
    spinner = Spinner()
    if os.path.isdir(folder):
        for root, _, files in os.walk(folder):
            if len(files) == 0:
                break
            for file in files:
                iterations += 1
                spinner.message = "Analysing folder: '{}' - Files: {} - Duplicates: {} - ".format(
                    folder, iterations, DUPLICATES.total)
                spinner.next()
                path = os.path.join(root, file)
                size = os.path.getsize(path)
                extension = os.path.splitext(file)[-1]
                filter_duplicates(extension, types, path, fileList, size)
            spinner.clearln()
    return fileList
示例#2
0
print("")

block_hash = None
spinner = Spinner()
while True:
    current_block = w3.eth.block_number
    got_confirmations = current_block - BLOCK_HEIGHT
    if current_block < BLOCK_HEIGHT:
        spinner.message = f"Waiting for target block. {current_block} of {BLOCK_HEIGHT} "
        spinner.update()
        for i in range(10):
            time.sleep(0.1)
            spinner.next()
        continue
    if block_hash is None:
        spinner.clearln()
        print(f'Target block {current_block} mined!')
        block_hash = w3.eth.get_block(BLOCK_HEIGHT).hash
        print(
            f"Hash of the block {BLOCK_HEIGHT} is {GREEN}{block_hash.hex()}{ENDC}"
        )
        print(f"See it on Etherscan https://etherscan.io/block/{BLOCK_HEIGHT}")
    if got_confirmations <= CONFIRMATIONS:
        spinner.message = f'Waiting confirmations {got_confirmations} of {CONFIRMATIONS} '
        spinner.update()
        spinner.next()
        for i in range(10):
            time.sleep(0.1)
            spinner.next()
        continue
    spinner.clearln()