From 242928d502ccc97385dc5342229694b97f751a8e Mon Sep 17 00:00:00 2001 From: buenosairesam Date: Thu, 8 May 2025 23:40:54 -0300 Subject: [PATCH] clean up and org --- Dockerfile | 13 --- deskmeter.sh | 4 - dmapp/dm.sh | 10 ++ dmapp/dmcore/__init__.py | 14 --- dmmain.py => dmapp/dmcore/main.py | 34 +------ dmapp/dmcore/sample_task_file | 161 ++++++++++++++++++++++++++++++ dmapp/dmcore/task.py | 23 +++++ dmweb.sh | 4 - docker-compose.template.yml | 20 ---- notes.md | 2 - testdbus.py | 8 -- 11 files changed, 197 insertions(+), 96 deletions(-) delete mode 100644 Dockerfile delete mode 100644 deskmeter.sh create mode 100644 dmapp/dm.sh rename dmmain.py => dmapp/dmcore/main.py (70%) create mode 100644 dmapp/dmcore/sample_task_file create mode 100644 dmapp/dmcore/task.py delete mode 100644 dmweb.sh delete mode 100644 docker-compose.template.yml delete mode 100644 notes.md delete mode 100644 testdbus.py diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 87497ab..0000000 --- a/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM python:3.9-alpine - -RUN apk add --update - -COPY . /src - -WORKDIR /src - -RUN - -EXPOSE 8080 - -ENTRYPOINT [""] \ No newline at end of file diff --git a/deskmeter.sh b/deskmeter.sh deleted file mode 100644 index a920e89..0000000 --- a/deskmeter.sh +++ /dev/null @@ -1,4 +0,0 @@ -sudo systemctl start mongod.service -. ~/mdir/venvs/deskmeter/bin/activate -cd ~/mdir/python/deskmeter -python3 dmmain.py diff --git a/dmapp/dm.sh b/dmapp/dm.sh new file mode 100644 index 0000000..67f3d2c --- /dev/null +++ b/dmapp/dm.sh @@ -0,0 +1,10 @@ +sudo systemctl start mongod.service +. /home/mariano/wdir/venv/dm/bin/activate +cd /home/mariano/wdir/def/deskmeter +nohup python3 dmmain.py >dm.out 2>dm.err & + +cd /home/mariano/wdir/def/deskmeter/dmapp +nohup python3 run.py >dm.out 2>dm.err & + +cd ~ +exit diff --git a/dmapp/dmcore/__init__.py b/dmapp/dmcore/__init__.py index 826dded..e69de29 100644 --- a/dmapp/dmcore/__init__.py +++ b/dmapp/dmcore/__init__.py @@ -1,14 +0,0 @@ -class ActiveDesktop: - - def __init__(self, desktops, unlabeled = "Other"): - self.desktops = desktops - - - def active_workspace(): - - workspaces = subprocess.check_output(["wmctrl", "-d"]) \ - .decode("utf-8").strip("\n").split("\n") - - for workspace in workspaces: - if workspace[3] == "*": - return int(workspace[0]) \ No newline at end of file diff --git a/dmmain.py b/dmapp/dmcore/main.py similarity index 70% rename from dmmain.py rename to dmapp/dmcore/main.py index 3e0d907..1dacb15 100644 --- a/dmmain.py +++ b/dmapp/dmcore/main.py @@ -4,6 +4,7 @@ import subprocess import time from pprint import pprint +import task from pymongo import MongoClient from zoneinfo import ZoneInfo @@ -22,38 +23,9 @@ dailies = db.daily desktops = ("Plan", "Think", "Work", "Other", "Away", "Work", "Work") -task_file = "/home/mariano/LETRAS/org/task/main" - -# desktops = ("Admin", -# "Learn", -# "Tasks", -# "Other", -# "Text", -# "Video", -# "Away") - - unlabeled = "Away" -def extract(line): - if line.rstrip().endswith("*"): - pipe_index = line.find("|") - if pipe_index != -1 and len(line) > pipe_index + 8: - value = line[pipe_index + 1 : pipe_index + 9] - return value - return None - - -def read_and_extract(file_path): - with open(file_path, "r") as file: - for line in file: - value = extract(line) - if value: - return value - return None - - def active_workspace(): workspaces = ( subprocess.check_output(["wmctrl", "-d"]) @@ -75,7 +47,7 @@ def desktop(workspace_index): current_workspace = active_workspace() -current_task = read_and_extract(task_file) +current_task = task.current() last_switch_time = now() switch = { @@ -88,7 +60,7 @@ switch = { switches.insert_one(switch) while True: - current_task = read_and_extract(task_file) + current_task = task.current() current_workspace = active_workspace() last_doc = switches.find_one(sort=[("_id", -1)]) diff --git a/dmapp/dmcore/sample_task_file b/dmapp/dmcore/sample_task_file new file mode 100644 index 0000000..4c298f4 --- /dev/null +++ b/dmapp/dmcore/sample_task_file @@ -0,0 +1,161 @@ +work + default | ffbe198e * + vhs | c851ce32 + dlt | b4378ac5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +??? + +think + lectura + guitarra + design patterns + data structures + politica + + cursos + code + microsaas + soft + oratoria + memoria |1dc8a7c2 + + video + blender + motion graphics + unreal + houdini + nuke + +plan + entrevistas + rapid fort |00799f93 + calestino |f58a2919 + celara |64898a2f + +work + boat + spots |5fc751ec + dani: si mejor extraer dl y sfr manual + revisar ami -| + publisher + mapear codigo |462682ac + credentials + completar lista |d602b2d8 + simulations + reunion caro + OCIO class |f6f23db6 + + generar cache + dani: tracker / entity + graph? + averiguar opciones |9d794a0b + + personal + deskmeter |ec01a5a8 + autoweekcal + frontend apps + qt / wxwidgets / c + android remote control + react native + + meetdrop + qtbase + 100ms + + portfolio + subtitulos + + encript + + video + script canon linux + audio + compresor obs + configurar hydrogen + + + musica + piano + liebestraum + arpegios and scales + AbM + course exercises + encoding + storing + retrieve + write chords + sonata + arpegios and scales + C#m + course exercises + encoding + storing + retrieve + write chords + + guitar + surf riders + + dance + elegir videos + + +plan + hablar con kimda para actualizar sombrero + habilitar obsidian j + +work + config aws cli for boat/mcrn + just start/stop ecs + api + spoty + +think on the interview + design patterns + algos and ds + + +maxi |9f551a34 + alinear month/date + scroll, recenter (today) + align sum + show 3M before / 9M after + + + dlt + whatsapp |f217b606 + seo and analytics |7422cfe3 + dockerizar |acbd9f7f + landing page |9719a462 + documento |c6b0af75 + carga |be7e496f + update look |51c5b6d6 + instagram ads |76e7b629 + wrap up |92014034 diff --git a/dmapp/dmcore/task.py b/dmapp/dmcore/task.py new file mode 100644 index 0000000..e34c4a3 --- /dev/null +++ b/dmapp/dmcore/task.py @@ -0,0 +1,23 @@ +task_file = "/home/mariano/LETRAS/org/task/main" + + +def extract(line): + if line.rstrip().endswith("*"): + pipe_index = line.find("|") + if pipe_index != -1 and len(line) > pipe_index + 8: + value = line[pipe_index + 1 : pipe_index + 9] + return value + return None + + +def read_and_extract(file_path): + with open(file_path, "r") as file: + for line in file: + value = extract(line) + if value: + return value + return None + + +def current(): + return read_and_extract(task_file) diff --git a/dmweb.sh b/dmweb.sh deleted file mode 100644 index f309259..0000000 --- a/dmweb.sh +++ /dev/null @@ -1,4 +0,0 @@ -sudo systemctl start mongod.service -. ~/mdir/venvs/deskmeter/bin/activate -cd ~/mdir/python/deskmeter/dmapp -python3 run.py diff --git a/docker-compose.template.yml b/docker-compose.template.yml deleted file mode 100644 index 93ed948..0000000 --- a/docker-compose.template.yml +++ /dev/null @@ -1,20 +0,0 @@ -app: - build: . - command: python -u app.py - ports: - - "5000:5000" - volumes: - - .:/app - links: - - db -db: - image: mongo:latest - hostname: test_mongodb - environment: - - MONGO_INITDB_DATABASE= - - MONGO_INITDB_ROOT_USERNAME= - - MONGO_INITDB_ROOT_PASSWORD= - volumes: - - ./init-db.js:/docker-entrypoint-initdb.d/init-db.js:ro - ports: - - 27017:27017 \ No newline at end of file diff --git a/notes.md b/notes.md deleted file mode 100644 index 566a26b..0000000 --- a/notes.md +++ /dev/null @@ -1,2 +0,0 @@ -check weird thing of not showing the workspace where you start the dmmain script unless you move the window around -solve the bug of falsely counting the workspace you are on, because it counts from the last switch (once you switch it shows correctly) \ No newline at end of file diff --git a/testdbus.py b/testdbus.py deleted file mode 100644 index b8dcb08..0000000 --- a/testdbus.py +++ /dev/null @@ -1,8 +0,0 @@ -def active_workspace(): - - workspaces = subprocess.check_output(["wmctrl", "-d"]) \ - .decode("utf-8").strip("\n").split("\n") - - for workspace in workspaces: - if workspace[3] == "*": - return int(workspace[0])