Exemplo n.º 1
0
def downloadFile(downFile):

    f = open("metadata.json", "r")
    readJSON = json.load(f)
    f.close()

    noOfChunks = 0
    idx = 0
    cnt = 0

    print ("\n[SYSTEM] Finished read metadata for download\n")

    for item in range(0, len(readJSON)):
        if readJSON[item]['fileName'] == downFile:
            noOfChunks = readJSON[item]['numberOfChunks']
            googleDrive.downlaod_file(readJSON[item]['fileID'], "chunk%d" % idx)
            idx += 1
        else:
           cnt += 1
    if cnt == len(readJSON):
        print ("[ERROR ] That file doesn't exist in google drive")
    else:
        print("[SYSTEM] Downloaded all chunk filer for download\n")
        joinFiles(downFile, noOfChunks)
Exemplo n.º 2
0
def division_thread_by_one_item(fileName, originID, replica1ID, replica2ID, idx):
    googleDrive.downlaod_file(fileName, originID, replica1ID, replica2ID, "chunk{0}".format(idx))
Exemplo n.º 3
0
def division_thread_by_download_count(fileName, originIdList, replicaOneList, replicaTwoList, start):
    for item in range(len(originIdList)):
        googleDrive.downlaod_file(fileName, originIdList[item], replicaOneList[item], replicaTwoList[item], "chunk{0}".format(start+item))