Example #1
0
def send_files_list():
    cmd = "get_file_list"
    message = [[], ("cmd", cmd)]
    files = ""

    for item in Util.get_files_in_directory(Util.local_files_path):
        files += item + ";"

    message.append(("files", files))
    return message
Example #2
0
def send_files_list(TCP_IP, PORT_IP):
	cmd = "get_file_list"
	message = [[], ("cmd", cmd)]
	files = ""

	for item in Util.get_files_in_directory(Util.local_files_path):
		files += item + ";"

	message.append(("files", files))

	print(message)
def get_files_needed(msg):
  received_files = msg.split(",")
  received_files = received_files[-1].split(';')

  local_files = ""
  str_final = ""

  for item in Util.get_files_in_directory(Util.local_files_path):
    local_files += item + ";"

  local_list_files = local_files.split(';')

  needed_files = set(received_files) - set(local_list_files)

  for i in needed_files:
      str_final += i + ';'
  print str_final
  return str_final
def send_files_list(TCP_IP, PORT_IP):
	cmd = "get_file_list"
	message = [[], ("cmd", cmd)]
	files = ""

	for item in Util.get_files_in_directory(Util.local_files_path):
		files += item + ";"

	message.append(("files", files))

	MESSAGE = str(message)
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	s.connect((TCP_IP, PORT_IP))
	s.send(MESSAGE)
	#data = s.recv(BUFFER_SIZE)
	s.close()

	global state
	state = "final"
def server_files_list_request(TCP_IP, PORT_IP):

	cmd = "get_file_list"
	message = ("cmd", cmd)

	print("Request")
	global data_teste
	msg = data_teste

	received_files = msg.split(",")
	received_files = received_files[-1].split(';')

	local_files = ""
	str_final = ""

	for item in Util.get_files_in_directory(Util.local_files_path):
		local_files += item + ";"

	local_list_files = local_files.split(';')

	needed_files = set(received_files) - set(local_list_files)

	for i in needed_files:
	    str_final += i + ';'
	print str_final
	#return str_final

	#Envio
	# s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	# s.connect((TCP_IP, PORT_IP))
	# s.send(str_final)
	# data = s.recv(BUFFER_SIZE)
	# s.close()

	global state
	state = "final"
Example #6
0
#!/usr/bin/python
from time import *
from socket import *
import socket
import time
import threading 	#Alterado este import
import Util 		#Inserido este import

cmd = "get_file_list"
message = [[], ("cmd", cmd)]
files = ""

for item in Util.get_files_in_directory(Util.local_files_path):
	files += item + ";"

message.append(("files", files))
print message
Example #7
0
def atualizar_lista_logs():
    lista_logs = Util.get_files_in_directory(path_logs)
    lista_logs_terceiros = Util.get_files_in_directory(path_logs_terceiros)