2022-02-15 21:16:38 +00:00
|
|
|
from datetime import datetime
|
2022-02-14 07:45:34 +00:00
|
|
|
from pymongo import MongoClient
|
|
|
|
from bson.objectid import ObjectId
|
|
|
|
from time import sleep
|
|
|
|
|
2022-02-14 09:59:21 +00:00
|
|
|
MONGO_URI="mongodb://127.0.0.1:27017/default"
|
2022-02-14 07:45:34 +00:00
|
|
|
|
2022-02-14 09:59:21 +00:00
|
|
|
db = MongoClient(MONGO_URI).get_default_database()
|
2022-02-14 07:45:34 +00:00
|
|
|
|
|
|
|
while True:
|
2022-02-15 21:16:38 +00:00
|
|
|
db.eventlog.insert_one({
|
|
|
|
"timestamp": datetime.utcnow(),
|
|
|
|
"event": "motion-detected",
|
|
|
|
"started": "...",
|
|
|
|
"finished": "...",
|
|
|
|
"component": "motion-detect",
|
|
|
|
"camera": "Server room",
|
|
|
|
"action": "event",
|
|
|
|
"screenshot_count": 1
|
|
|
|
})
|
2022-02-14 07:45:34 +00:00
|
|
|
sleep(1)
|