Esempio n. 1
0
    def monitorFilter(self):
        while True:
            # get current messages
            messages = self.web3.geth.shh.get_filter_messages(self.filter_id)
            print('polling...')

            # go through all messages active right now
            for message in messages:
                content = message['payload']
                contentS = bytes.fromhex(content.hex()[2:]).decode('utf-8')
                Header, fileHash, prof = contentS.split('\r\n')
                print(Header, fileHash, prof, '\n\n\n')
                # If help is needed and device has enough resources - sendHelp
                if Header == 'HELP':
                    if not self.busy():
                        self.sendHelp(fileHash)

                    fs = FileStorage()
                    # fs.retrieve_from_hash(fileHash)

                # If our help request has been pushed by someone then release job
                elif Header == 'FIN':
                    if self.newFileHash == fileHash:
                        self.newFileHash = ''
                        self.helpAsked = False

            time.sleep(1)
Esempio n. 2
0
 def __init__(self, dbDir, masterPassword):
     self.dbDir = dbDir
     dbPath = os.path.join(dbDir, DBFILE)
     if not os.path.isdir(dbDir):
         raise Exception("Data folder not found: " + dbDir)
     self.pull()
     self.fs = FileStorage(dbPath, masterPassword)
Esempio n. 3
0
from fileStorage import FileStorage

fileStorage = FileStorage()
while True:
    print('\n')
    fileName = input("Uploading File's Name: ")

    info = fileStorage.upload(fileName)
    print(info)