-
Notifications
You must be signed in to change notification settings - Fork 288
/
warberryModel.py
33 lines (24 loc) · 950 Bytes
/
warberryModel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sqlite3
import subprocess
class warberryModel:
def __init__(self):
self.conn = sqlite3.connect('warberry.db')
self.cursor = self.conn.cursor()
def connectDB(self):
self.conn = sqlite3.connect('warberry.db')
self.cursor = self.conn.cursor()
def insertWarBerryModel(self):
subprocess.call("sudo cat /proc/cpuinfo | grep Revision | awk {'print $3'} > Results/model", shell=True)
modelPI="Custom"
with open('Results/model', 'r') as pi_model:
for model in pi_model:
modelPI=model.strip()
subprocess.call("rm Results/model", shell=True)
db_in=("WarberryPI", modelPI)
self.connectDB()
self.cursor.execute('INSERT INTO warberry (WarBerryName, WarBerryModel) VALUES (?,?)', db_in)
self.conn.commit()
self.conn.close()
if __name__ == '__main__':
x=warberryModel()
x.insertWarBerryModel()