Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions app/src-tauri/src/google_meet/ingest.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use std::sync::Arc;
use tokio::sync::Mutex;
use tauri::{AppHandle, Runtime};
use crate::google_meet::types::{MeetingId, IngestOutcome};
use crate::google_meet::transcript_store::MeetingTranscriptStore;

pub async fn flush_meeting<R: Runtime>(
_app: &AppHandle<R>,
_account_id: &str,
_meeting_id: MeetingId,
_store: &Arc<Mutex<MeetingTranscriptStore>>,
) -> IngestOutcome {
IngestOutcome::Pending
}
33 changes: 33 additions & 0 deletions app/src-tauri/src/google_meet/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
pub mod ingest;
pub mod transcript_store;
pub mod types;

use std::sync::Arc;
use tauri::{AppHandle, Manager, Runtime};
use tokio::sync::Mutex;

pub use transcript_store::MeetingTranscriptStore;
pub use types::{CaptionLine, IngestOutcome, MeetingId};

pub async fn record_caption_batch<R: Runtime>(
app: &AppHandle<R>,
meeting_id: MeetingId,
batch: Vec<CaptionLine>,
) {
if let Some(store) = app.try_state::<Arc<Mutex<MeetingTranscriptStore>>>() {
let mut store = store.lock().await;
store.record_caption_batch(meeting_id, batch);
}
}

pub async fn flush_meeting<R: Runtime>(
app: &AppHandle<R>,
account_id: &str,
meeting_id: MeetingId,
) -> IngestOutcome {
if let Some(store) = app.try_state::<Arc<Mutex<MeetingTranscriptStore>>>() {
ingest::flush_meeting(app, account_id, meeting_id, &store).await
} else {
IngestOutcome::Retry("MeetingTranscriptStore not found in app state".to_string())
}
}
23 changes: 23 additions & 0 deletions app/src-tauri/src/google_meet/transcript_store.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use std::collections::HashMap;
use crate::google_meet::types::{MeetingId, MeetingTranscript, CaptionLine};

#[derive(Default)]
pub struct MeetingTranscriptStore {
transcripts: HashMap<MeetingId, MeetingTranscript>,
}

impl MeetingTranscriptStore {
pub fn record_caption_batch(&mut self, _meeting_id: MeetingId, _batch: Vec<CaptionLine>) {
}

pub fn record_transcript(&mut self, _transcript: MeetingTranscript) {
}

pub fn get_transcript(&self, _meeting_id: &MeetingId) -> Option<&MeetingTranscript> {
None
}

pub fn remove_transcript(&mut self, _meeting_id: &MeetingId) -> Option<MeetingTranscript> {
None
}
}
26 changes: 26 additions & 0 deletions app/src-tauri/src/google_meet/types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CaptionLine {
pub speaker: String,
pub text: String,
pub ts: i64,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub struct MeetingId(pub String);

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MeetingTranscript {
pub id: MeetingId,
pub started_at: i64,
pub lines: Vec<CaptionLine>,
pub ended_at: Option<i64>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum IngestOutcome {
Persisted,
Pending,
Retry(String),
}
4 changes: 4 additions & 0 deletions app/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mod core_process;
mod core_rpc;
mod discord_scanner;
mod gmessages_scanner;
mod google_meet;
mod imessage_scanner;
#[cfg(target_os = "macos")]
mod mascot_native_window;
Expand Down Expand Up @@ -1381,6 +1382,9 @@ pub fn run() {
let builder = builder.manage(discord_scanner::ScannerRegistry::new());
let builder = builder.manage(telegram_scanner::ScannerRegistry::new());
let builder = builder.manage(screen_capture::ScreenShareState::new());
let builder = builder.manage(std::sync::Arc::new(tokio::sync::Mutex::new(
google_meet::MeetingTranscriptStore::default(),
)));
builder
.setup(move |app| {
#[cfg(any(windows, target_os = "linux"))]
Expand Down
Loading