add metadata for external usage
This commit is contained in:
		
							
								
								
									
										11
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								main.py
									
									
									
									
									
								
							| @@ -51,7 +51,7 @@ def _init_db(conn: sqlite3.Connection): | |||||||
|         ); |         ); | ||||||
|         CREATE TABLE IF NOT EXISTS nicknames( |         CREATE TABLE IF NOT EXISTS nicknames( | ||||||
|             game, player, name, specie, |             game, player, name, specie, | ||||||
|             UNIQUE(game,player, specie) |             UNIQUE(game, player, specie) | ||||||
|         ); |         ); | ||||||
|         """ |         """ | ||||||
|     ) |     ) | ||||||
| @@ -296,6 +296,15 @@ def main(): | |||||||
|                     error(f"bad replay {r}") |                     error(f"bad replay {r}") | ||||||
|                     continue |                     continue | ||||||
|  |  | ||||||
|  |                 db.execute( | ||||||
|  |                     """ | ||||||
|  |                     INSERT INTO games(id, p1, p2, format, uploadtime) | ||||||
|  |                     VALUES (?, ?, ?, ?, ?) | ||||||
|  |                     ON CONFLICT DO NOTHING | ||||||
|  |                     """, | ||||||
|  |                     (replay.id, replay.p1, replay.p2, replay.format, replay.uploadtime), | ||||||
|  |                 ) | ||||||
|  |  | ||||||
|                 parse_log(replay.id, replay.log, into=db) |                 parse_log(replay.id, replay.log, into=db) | ||||||
|                 db.commit() |                 db.commit() | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user