Example #1
0
    def rescan(spath, fdata: Data, parent_id):
        for f in os.listdir(spath):

            full_path = os.path.join(spath, f)

            if os.path.isfile(full_path):
                fdata.append_file(f, parent_id)
            else:
                pid = fdata.append_dir(f, parent_id)

                Store.rescan(full_path, fdata, pid)
Example #2
0
    def rescan(spath, fd, fdict: Dict, fdata: Data, parent_id):
        for f in os.listdir(spath):

            full_path = os.path.join(spath, f)

            if os.path.isfile(full_path):
                record = fdata.append_file(f, parent_id)
                brecord = record.pack()

                #--- make index
                curr_pos = fd.tell()
                fdict.append_record(record.fid, record.pid, curr_pos,
                                    len(brecord))

                #--- write bdata
                fd.write(brecord)

            else:
                record = fdata.append_dir(f, parent_id)
                brecord = record.pack()

                #--- make index
                curr_pos = fd.tell()
                fdict.append_record(record.fid, record.pid, curr_pos,
                                    len(brecord))

                #--- write bdata
                fd.write(brecord)

                Store.rescan(full_path, fd, fdict, fdata, record.fid)