|
|
|
@ -67,13 +67,23 @@ class fs: |
|
|
|
self.id = id |
|
|
|
|
|
|
|
def write_to_db(self): |
|
|
|
pass |
|
|
|
'''stores self.hash_files in database, along with a backup id and hash_func parameters''' |
|
|
|
for hash,files in self.hash_files.item() |
|
|
|
for file in files: |
|
|
|
self.cur.execue('INSERT INTO paths VALUES (?,?)',[hash,file]) |
|
|
|
self.con.commit() |
|
|
|
|
|
|
|
def morph(self,other): |
|
|
|
'''renames/copies all files in self.top to match other''' |
|
|
|
pass |
|
|
|
|
|
|
|
def backup(self,other): |
|
|
|
'''fills in self.hash_file {hash:[filepaths]}''' |
|
|
|
paths = hashify(self.top,self.hashfunc) |
|
|
|
for filepath,hash in paths: |
|
|
|
self.hash_file.setdefault(hash,[]).append(filepath) |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
import os |
|
|
|
test = fs(os.getcwd()) |