Commit 0da6725e authored by Jonathan Schaeffer's avatar Jonathan Schaeffer
Browse files

Minor modifications

parent 0226e426
......@@ -36,7 +36,7 @@ def scan_volume(path):
Scanne un volume indiqué par son chemin (path).
La fonction lance une commande "du -d4 path" et analyse chaque ligne renvoyée.
Elle renvoie une liste de dictionnaires :
[ {year: 2011, network: 'G', size: '100', files: '14', station: 'STAT', channel: 'BHZ.D'}, ...]
[ {year: 2011, network: 'G', size: '100', station: 'STAT', channel: 'BHZ.D'}, ...]
"""
data = []
volume = os.path.realpath(path)+'/'
......@@ -53,8 +53,7 @@ def scan_volume(path):
path = path.replace(volume, '').split('/')
# Ne pas considérer le seul chemin de niveau 1
if len(path) == 4:
logger.debug("path : %s",{path})
logger.debug("size : %s",{size})
logger.debug("path: %s, size: %s", path, size)
(channel, quality) = path[3].split('.')
data.append({'year': path[0], 'network': path[1], 'station': path[2],
'channel': channel, 'quality': quality, 'size': size})
......@@ -68,9 +67,9 @@ def scan_volumes(volumes):
# En sortie, une liste de dictionnaires :
# [ {stat}, {stat}, ]
volume_stats = []
starttime = datetime.datetime.now()
for volume in volumes:
logger.debug("Preparing scan of volume %s", volume['path'])
starttime = datetime.datetime.now()
if 'path' in volume:
stats = scan_volume(volume['path'])
# On rajoute le type comme un élément de chaque statistique
......@@ -82,7 +81,7 @@ def scan_volumes(volumes):
else:
raise ValueError("Volume has no path key : %s" % (volume))
# on applati la liste de listes :
logger.debug("All volumes scanned in %s",
logger.info("All volumes scanned in %s",
(datetime.datetime.now() - starttime))
return [x for vol in volume_stats for x in vol]
......
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