Commit 501704c8 authored by Inkhey's avatar Inkhey

better generator for file

parent 549f22af
......@@ -115,20 +115,19 @@ class sqlGit(object):
data = line.split('[;;|\/|;;]')
yield (data)
def _gInsertFile(self,depth,mdepth):
def _gInsertFile(self,depth):
for root, dirs, files in filtered_walk(".", depth=depth):
for fn in files:
path = os.path.join(root, fn)
size = os.path.getsize(path)
data = (fn, size, root)
yield(data)
for root, dirs, files in filtered_walk(".",
depth=depth,
min_depth=mdepth):
for d in dirs:
path = os.path.join(root, d)
size = self._get_size_dir(path)
data = (d, size, root)
if( root.count("/") == depth):
for d in dirs:
path = os.path.join(root, d)
size = self._get_size_dir(path)
data = (d, size, root)
yield(data)
def _gInsertLFC(self,l):
......@@ -197,13 +196,9 @@ class sqlGit(object):
def insert_file(self,depth):
''' insert file data into file table, depth define how precise
file data will be.'''
if depth > 0:
mdepth = depth
else:
mdepth = None
c = self.conn.cursor()
# TODO : gérer profondeur et ignorer fichier dans .git ?
g = self._gInsertFile(depth,mdepth)
g = self._gInsertFile(depth)
c.executemany(
'''INSERT INTO file(name,size,dir)
values (?,?,?);''', g)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment