Skip to content

Commit

Permalink
fix wormhole sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mustaballer committed Sep 8, 2023
1 parent a03bd59 commit a94c303
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion openadapt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
# APP CONFIGURATIONS
"APP_DARK_MODE": False,
# SCRUBBING CONFIGURATIONS
"SCRUB_ENABLED": True,
"SCRUB_ENABLED": False,
"SCRUB_CHAR": "*",
"SCRUB_LANGUAGE": "en",
# TODO support lists in getenv_fallback
Expand Down
8 changes: 5 additions & 3 deletions openadapt/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from typing import Any
import os
import time

from dictalchemy import DictableModel
from loguru import logger
Expand Down Expand Up @@ -198,10 +199,11 @@ def export_recording(recording_id: int) -> str:
recording_id (int): The ID of the recording to export.
Returns:
str: The file path of the new database.
str: The file path of the new database with timestamp.
"""
db_fname = f"recording_{recording_id}.db"
target_path = config.ROOT_DIRPATH / db_fname
timestamp = int(time.time())
db_fname = f"recording_{recording_id}_{timestamp}.db"
target_path = config.RECORDING_DIRECTORY_PATH / db_fname
target_db_url = f"sqlite:///{target_path}"

target_engine = create_engine(target_db_url, future=True)
Expand Down
3 changes: 2 additions & 1 deletion openadapt/share.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def send_recording(recording_id: int) -> None:
recording_id (int): The ID of the recording to send.
"""
zip_file_path = export_recording_to_folder(recording_id)
print(zip_file_path)

assert zip_file_path, zip_file_path
try:
Expand Down Expand Up @@ -187,7 +188,7 @@ def visualize_recording(db_name: str) -> None:
with Session(engine) as session:
os.system("alembic upgrade head")
# Visualize the recording
visualize.main(session)
visualize.main(None, False, session)
except Exception as exc:
# Handle any exceptions that may occur during visualization
logger.exception(exc)
Expand Down
8 changes: 6 additions & 2 deletions openadapt/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
from loguru import logger
from nicegui import events, ui
from notifypy import Notify
from sqlalchemy.orm import session
from tqdm import tqdm
import click

from openadapt import config
from openadapt import config, crud
from openadapt.crud import get_latest_recording, get_recording
from openadapt.events import get_events
from openadapt.privacy.providers.presidio import PresidioScrubbingProvider
Expand Down Expand Up @@ -133,8 +134,11 @@ def toggle_dark_mode(
type=str,
help="The timestamp of the recording to visualize.",
)
def main(timestamp: str, notify: bool = True) -> None:
def main(timestamp: str, notify: bool = True, sesh: session.Session = None) -> None:
"""Visualize a recording."""
if sesh:
crud.db = sesh

configure_logging(logger, LOG_LEVEL)

ui_dark = ui.dark_mode(config.VISUALIZE_DARK_MODE)
Expand Down

0 comments on commit a94c303

Please sign in to comment.