Exemplo n.º 1
0
def buildCommand(line, server_ip):
    commands = line.split(' ')
    base_command = commands[0]
    if base_command == "download":
        try:
            descriptor = commands[1]
            dispatchDescriptor(descriptor)
        except IndexError:
            print("No Descriptor Provided")
        except IOError:
            print("No Such Descriptor")
    
    if base_command == "exit":
        dispatchExit()
    
    if base_command == "get":
        try:
            sendSearchRequest.sendSearchRequest(server_ip, base_command, commands[1],
                                                commands[2])
        except IndexError:
            print("Invalid Parameters")
            
    if base_command == "search":
        try:
            sendSearchRequest.sendSearchRequest(server_ip, base_command, commands[1],
                                                '')
        except IndexError:
            print("No FileName to Search")
Exemplo n.º 2
0
def buildCommand(line, server_ip):
    commands = line.split(' ')
    base_command = commands[0]
    if base_command == "download":
        try:
            descriptor = commands[1]
            dispatchDescriptor(descriptor)
        except IndexError:
            print("No Descriptor Provided")
        except IOError:
            print("No Such Descriptor")

    if base_command == "exit":
        dispatchExit()

    if base_command == "get":
        try:
            sendSearchRequest.sendSearchRequest(server_ip, base_command,
                                                commands[1], commands[2])
        except IndexError:
            print("Invalid Parameters")

    if base_command == "search":
        try:
            sendSearchRequest.sendSearchRequest(server_ip, base_command,
                                                commands[1], '')
        except IndexError:
            print("No FileName to Search")
Exemplo n.º 3
0
 def get(self):
     results = self.search_results.get().split(' ')
     index = self.search_list.curselection()
     desc_info = results[int(index[0])].split("'")[1].split('--')
     self.setStatus(desc_info[0]+'--'+desc_info[1]+' Getting Descriptor..')
     sendSearchRequest.sendSearchRequest(self.server_ip.get(),
                                         'get', desc_info[0],
                                             desc_info[1])
     self.setStatus("Descriptor Receieved")
     self.refreshDescriptorList()
Exemplo n.º 4
0
 def get(self):
     results = self.search_results.get().split(' ')
     index = self.search_list.curselection()
     desc_info = results[int(index[0])].split("'")[1].split('--')
     self.setStatus(desc_info[0] + '--' + desc_info[1] +
                    ' Getting Descriptor..')
     sendSearchRequest.sendSearchRequest(self.server_ip.get(), 'get',
                                         desc_info[0], desc_info[1])
     self.setStatus("Descriptor Receieved")
     self.refreshDescriptorList()
Exemplo n.º 5
0
 def search(self):
     sendSearchRequest.sendSearchRequest(self.server_ip.get(),
                                         'search',
                                         self.search_text.get(),
                                         '',self)
     self.setStatus("Search Request Sent")
Exemplo n.º 6
0
 def search(self):
     sendSearchRequest.sendSearchRequest(self.server_ip.get(), 'search',
                                         self.search_text.get(), '', self)
     self.setStatus("Search Request Sent")