def getParser(filepath): extension = os.path.splitext(filepath)[1] if extension == ".csv": return tabular.Tabular() if extension == ".json": return jsoner.JSONer() elif extension == ".db" or extension == ".sqlite": try: tableNames = core.getDbTableNames( filepath ) except: raise UnrecognizedDBError("Error reading from %s" % filepath) if "handle" in tableNames: return ios6.IOS6() elif "group_member" in tableNames: return ios5.IOS5() elif "TextMessage" in tableNames: return googlevoice.GoogleVoice() elif "sms" in tableNames: return android.Android() print term.red_on_black("unrecognized database details and structure:") print getDbInfo( file.name ) raise UnrecognizedDBError("Unknown sqlite database: [%s]" % os.path.basename(filepath)) elif extension == "": return bugle.Bugle() elif extension == ".xml": return xmlmms.XMLmms() raise UnrecognizedDBError("Unknown extension %s" % extension)
def getParser(filepath): extension = os.path.splitext(filepath)[1] if extension == ".csv": return tabular.Tabular() if extension == ".json": return jsoner.JSONer() elif extension == ".db" or extension == ".sqlite": try: tableNames = core.getDbTableNames( filepath ) except: raise UnrecognizedDBError("Error reading from %s" % filepath) if "handle" in tableNames: return ios6.IOS6() elif "group_member" in tableNames: return ios5.IOS5() elif "TextMessage" in tableNames: return googlevoice.GoogleVoice() elif "sms" in tableNames: return android.Android() print term.red_on_black("unrecognized database details and structure:") print getDbInfo( file.name ) raise UnrecognizedDBError("Unknown sqlite database: [%s]" % os.path.basename(filepath)) elif extension == ".xml": return xmlmms.XMLmms() raise UnrecognizedDBError("Unknown extension %s" % extension)
def getParser(file): extension = os.path.splitext(file.name)[1] if extension == ".csv": return csv.CSV() elif extension == ".db" or extension == ".sqlite": file.close() tableNames = core.getDbTableNames(file.name) if "handle" in tableNames: return ios6.IOS6() elif "group_member" in tableNames: return ios5.IOS5() elif "TextMessage" in tableNames: return googlevoice.GoogleVoice() elif "sms" in tableNames: return android.Android() elif extension == ".xml": return xmlmms.XMLmms() raise UnrecognizedDBError()
def getParser(file): extension = os.path.splitext(file.name)[1] if extension == ".csv": return csv.CSV() elif extension == ".db" or extension == ".sqlite": file.close() tableNames = core.getDbTableNames( file.name ) if "handle" in tableNames: return ios6.IOS6() elif "group_member" in tableNames: return ios5.IOS5() elif "TextMessage" in tableNames: return googlevoice.GoogleVoice() elif "sms" in tableNames: return android.Android() elif extension == ".xml": return xmlmms.XMLmms() raise UnrecognizedDBError()
def getParser(file): extension = os.path.splitext(file.name)[1] if extension == ".csv": return csv.CSV() elif extension == ".db" or extension == ".sqlite": file.close() try: tableNames = core.getDbTableNames( file.name ) except: raise UnrecognizedDBError("Error reading from %s" % file.name) if "handle" in tableNames: return ios6.IOS6() elif "group_member" in tableNames: return ios5.IOS5() elif "TextMessage" in tableNames: return googlevoice.GoogleVoice() elif "sms" in tableNames: return android.Android() info = getDbInfo( file.name ) raise UnrecognizedDBError("Unknown sqlite database: [%s]\n%s" % (os.path.basename(file.name), info)) elif extension == ".xml": return xmlmms.XMLmms() raise UnrecognizedDBError("Unknown extension %s" % extension)