file to db and db to file

This commit is contained in:
buenosairesam
2025-05-09 02:20:55 -03:00
parent 242928d502
commit f531be7158
6 changed files with 268 additions and 34 deletions

View File

@@ -5,6 +5,7 @@ import time
from pprint import pprint
import task
import state
from pymongo import MongoClient
from zoneinfo import ZoneInfo
@@ -37,6 +38,8 @@ def active_workspace():
for workspace in workspaces:
if workspace[3] == "*":
return int(workspace[0])
return None
return None
def desktop(workspace_index):
@@ -47,7 +50,7 @@ def desktop(workspace_index):
current_workspace = active_workspace()
current_task = task.current()
current_task = state.get_current_task()
last_switch_time = now()
switch = {
@@ -60,8 +63,11 @@ switch = {
switches.insert_one(switch)
while True:
current_task = task.current()
current_task = state.get_current_task()
current_workspace = active_workspace()
state.update_current_workspace(current_workspace)
last_doc = switches.find_one(sort=[("_id", -1)])
if (