From 65d08fc3d278e8c2d4b614c92b4556c6763c5b68 Mon Sep 17 00:00:00 2001 From: Justin Schultz Date: Mon, 2 Feb 2015 22:30:05 -0800 Subject: [PATCH] Update scraper.py --- scraper.py | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/scraper.py b/scraper.py index e8cfef5..b2ce674 100644 --- a/scraper.py +++ b/scraper.py @@ -27,26 +27,20 @@ def fixExtension(file): return newfile def readConfig(file): - lines=config.read().splitlines() systems=[] - for line in lines: - if not line.strip() or line[0]=='#': + config = ET.parse(file) + configroot = config.getroot() + for child in configroot: + name = child.find('name').text + path = child.find('path').text + ext = child.find('extension').text + pid = child.find('platformid').text + if not pid: continue else: - if "NAME=" in line: - name=line.split('=')[1] - if "PATH=" in line: - path=line.split('=')[1] - elif "EXTENSION" in line: - ext=line.split('=')[1] - elif "PLATFORMID" in line: - pid=line.split('=')[1] - if not pid: - continue - else: - system=(name,path,ext,pid) - systems.append(system) - config.close() + system=(name,path,ext,pid) + systems.append(system) + print name, path, ext, pid return systems def crc(fileName):