Added uploaderID monitor

This commit is contained in:
AnthorNet 2015-05-05 10:06:41 +02:00
commit e2bcca0c72
3 changed files with 14 additions and 4 deletions

View File

@ -14,7 +14,7 @@
"supplyLevel": "Low",
"sellPrice": 1138,
"demand": 42,
"demandLevel": "Med"
"demandLevel": "Med",
"timestamp": "2014-11-17T12:34:56+00:00"
}
}

View File

@ -8,7 +8,7 @@
"message": {
"systemName": "Eranin",
"stationName": "Azeban Orbital",
"timestamp": "2014-11-17T12:34:56+00:00"
"timestamp": "2014-11-17T12:34:56+00:00",
"commodities": [
{
"name": "Gold",

View File

@ -51,8 +51,17 @@ class Monitor(Thread):
softwareID = json['header']['softwareName'] + ' | ' + json['header']['softwareVersion']
c = db.cursor()
c.execute('UPDATE uploaders SET hits = hits + 1 WHERE `name` = ? AND `dateStats` = ?', (softwareID, currentDate))
c.execute('INSERT OR IGNORE INTO uploaders (name, dateStats) VALUES (?, ?)', (softwareID, currentDate))
c.execute('UPDATE softwares SET hits = hits + 1 WHERE `name` = ? AND `dateStats` = ?', (softwareID, currentDate))
c.execute('INSERT OR IGNORE INTO softwares (name, dateStats) VALUES (?, ?)', (softwareID, currentDate))
db.commit()
# Update uploader count
uploaderID = json['header']['uploaderID']
c = db.cursor()
c.execute('UPDATE uploaders SET hits = hits + 1 WHERE `name` = ? AND `dateStats` = ?', (uploaderID, currentDate))
c.execute('INSERT OR IGNORE INTO uploaders (name, dateStats) VALUES (?, ?)', (uploaderID, currentDate))
db.commit()
@ -66,6 +75,7 @@ class Monitor(Thread):
print softwareID
print uploaderID
print schemaID
print currentDate
sys.stdout.flush()