feat: poc database script
This commit is contained in:
parent
c39e5cb741
commit
c39f1fd0c0
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
.venv
|
||||
.mypy_cache
|
||||
data
|
||||
|
|
16
src/db.py
16
src/db.py
|
@ -1,5 +1,21 @@
|
|||
import sqlite3
|
||||
import uuid
|
||||
from fileinput import filename
|
||||
|
||||
DATA_FOLDER = "data/"
|
||||
|
||||
con = sqlite3.connect("dataset.db")
|
||||
|
||||
from ppadb.client import Client as AdbClient
|
||||
|
||||
client = AdbClient(host="127.0.0.1", port=5037)
|
||||
device = client.device("13231FDD4003UE")
|
||||
|
||||
filename = uuid.uuid1()
|
||||
result = device.screencap()
|
||||
with open(f"{DATA_FOLDER}/{filename}.png", "wb") as fp:
|
||||
fp.write(result)
|
||||
con.execute(f"INSERT INTO data VALUES ('{filename}',{0},{0},{0.5},{0.5},{0},{0},{0},{0},{0})")
|
||||
con.commit()
|
||||
|
||||
con.close()
|
||||
|
|
Loading…
Reference in a new issue