From 0026f5bc86a21ff9dd17e3a51bf8bbab51544a7f Mon Sep 17 00:00:00 2001
From: Daniel STAN <daniel.stan@crans.org>
Date: Thu, 24 May 2012 10:31:11 +0200
Subject: [PATCH] Ajout d'un converter initial

---
 converter.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100755 converter.py

diff --git a/converter.py b/converter.py
new file mode 100755
index 0000000..db2bb38
--- /dev/null
+++ b/converter.py
@@ -0,0 +1,19 @@
+import json
+import glob
+import os
+# Basic converter to json, avec roles nounous partout
+
+init_path = '/home/dstan/crans/passwords/'
+final_path = '/home/dstan/crans/passwords/v2/'
+
+os.chdir(init_path)
+
+filenames = glob.glob('*.asc')
+
+encoder=json.JSONEncoder()
+for filename in filenames:
+    nf = file(final_path+filename[:-4]+'.json','w')
+    
+    nf.write(encoder.encode({'roles':['nounous']\
+        ,'contents':open(filename).read()}))
+        
-- 
GitLab