Exemple #1
0
def getIndex():
    if request.remote_addr not in list_of_client:
        list_of_client.append(request.remote_addr)
        print('new connection comes from', request.remote_addr)
    files, folders = get_index(directory=request.form['path'])
    json_result = jsonify({'listfiles': files, 'listfolders': folders})
    if DEBUG: print({'listfiles': files, 'listfolders': folders})
    return json_result
def index_change():
    server_filemeta, server_folder_list = writeIndex()
    local_filemeta, local_folder_list = get_index(defaultpath)
    different_file = set(local_filemeta).difference(set(server_filemeta))
    different_folder = set(local_folder_list).difference(set(server_folder_list))
    local_removed_file = set(server_filemeta).difference(set(local_filemeta)).difference(different_file)
    local_removed_folder = set(server_folder_list).difference(set(local_folder_list)).difference(different_folder)
    return list(different_file), list(different_folder), list(local_removed_file), list(local_removed_folder)