Commit 501704c8 authored by Inkhey's avatar Inkhey

better generator for file

parent 549f22af
......@@ -115,16 +115,15 @@ 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)
for root, dirs, files in filtered_walk(".",
if( root.count("/") == depth):
for d in dirs:
path = os.path.join(root, d)
size = self._get_size_dir(path)
......@@ -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
mdepth = None
c = self.conn.cursor()
# TODO : gérer profondeur et ignorer fichier dans .git ?
g = self._gInsertFile(depth,mdepth)
g = self._gInsertFile(depth)
'''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