BlueGit

ict rusty-teams

fix(meetings): recap tells audio-only recordings and transcript-only sessions apart

Transcript-only: driveItem media source Transcript, no recording card.
Audio-only: chat event item videoContent=CurtainOnly, size check as fallback.
meet_now gets --audio-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-10-13 · 6 weeks ago

Hash
db258c6ce0c4aa875aca377eec4abf438ce870dc
Parent
92c23844
9 files changed +162 −8
ROADMAP.md +1 −1
@@ -178,7 +178,7 @@ Feature parity with the Microsoft Teams desktop client.
178 178 | Camera effects | Partial | Camera menu "Effects" and Settings > Devices: Mirror my video (self view and camera test only, default on), Auto framing, Adjust brightness, Soft focus (Low / Medium / High in Settings). Framing, brightness and soft focus run on the send path, so others see them; one segmentation mask per frame is shared with the background. Crop planner, gamma and blend are unit tested; not yet checked on a real camera |
179 179 | Video calls (1:1 and incoming) | Partial | Camera button in 1:1 calls renegotiates a video line on the same peer connection (modalities Audio and Video), incoming video ring toast with Decline / Audio / Video, accept with video answers the video line sending, accept with audio receive-only. Offer and answer built from the Teams code and unit tested at SDP level; needs a second person |
180 180 | Recording | Done | Organizer "..." > Record and transcribe: Start recording, Record audio only, Start transcription only; Stop recording / Stop transcription / Stop both (confirm) through the recorder bot; header chip red "Recording" / "Recording audio" or blue "Transcribing" for everyone from the meeting state, consent notice that keeps mic and camera off until OK. Bodies unit tested; video, audio only, transcription only and every stop variant run live; a stop sent while the recorder still settles is retried. Consent needs a tenant with the policy on |
181 | Meeting recap tab | Partial | Recap in meeting chats with a recording: occurrence picker, recording card (duration, Audio only, expiry amber under 7 days), Play in the browser, Download with save dialog and percent, organizer Delete with confirm, searchable read-only transcript with .vtt and .docx download, attendance (muted note when the tenant has reports off), files shared in the chat. Parsing and expiry unit tested, demo checked; occurrences, details and delete run live against real recordings. Gaps: an audio-only file carries a 1920x1080 slate, so "Audio only" never shows; a transcription-only file is listed as a recording |
181 | Meeting recap tab | Partial | Recap in meeting chats with a recording: occurrence picker, recording card (duration, Audio only, expiry amber under 7 days), Play in the browser, Download with save dialog and percent, organizer Delete with confirm, searchable read-only transcript with .vtt and .docx download, attendance (muted note when the tenant has reports off), files shared in the chat. Parsing and expiry unit tested, demo checked; occurrences, details and delete run live against real recordings. Transcription-only sessions (item media source `Transcript`) show the transcript without a recording card. "Audio only" comes from the chat event (`videoContent="CurtainOnly"`), with the video size check as fallback. Both signals read live on real recordings, fixtures unit tested; the transcript-only path was not run live |
182 182 | Hold, resume, transfer | Partial | 1:1 "..." > Hold renegotiates every line inactive, "On hold" view with Resume, "You're on hold" when the other side holds, Transfer... person picker with Transfer now (blind) and Consult first (second call, first held, Transfer now). Needs a second person; redirect and park not built |
183 183 | Noise suppression, music mode | Partial | Mic menu and Settings > Devices: Auto (device track with WebRTC echo cancellation, AGC, NS) or Off, Music mode keeps echo cancellation only. No Low/High, the APM has on/off flags only. Off and Music mode run a cpal mic through our own APM; checked with synthetic sources only, not with a real mic in a call |
184 184 | Push to talk | Partial | Hold Ctrl+Space while muted to talk, release to mute; main window focused, not inside text fields; hint chip on the stage. Unit tested, not tried on the Windows build |
@@ -178,7 +178,7 @@ Feature parity with the Microsoft Teams desktop client.
178| Camera effects | Partial | Camera menu "Effects" and Settings > Devices: Mirror my video (self view and camera test only, default on), Auto framing, Adjust brightness, Soft focus (Low / Medium / High in Settings). Framing, brightness and soft focus run on the send path, so others see them; one segmentation mask per frame is shared with the background. Crop planner, gamma and blend are unit tested; not yet checked on a real camera |
178| Camera effects | Partial | Camera menu "Effects" and Settings > Devices: Mirror my video (self view and camera test only, default on), Auto framing, Adjust brightness, Soft focus (Low / Medium / High in Settings). Framing, brightness and soft focus run on the send path, so others see them; one segmentation mask per frame is shared with the background. Crop planner, gamma and blend are unit tested; not yet checked on a real camera |
179| Video calls (1:1 and incoming) | Partial | Camera button in 1:1 calls renegotiates a video line on the same peer connection (modalities Audio and Video), incoming video ring toast with Decline / Audio / Video, accept with video answers the video line sending, accept with audio receive-only. Offer and answer built from the Teams code and unit tested at SDP level; needs a second person |
179| Video calls (1:1 and incoming) | Partial | Camera button in 1:1 calls renegotiates a video line on the same peer connection (modalities Audio and Video), incoming video ring toast with Decline / Audio / Video, accept with video answers the video line sending, accept with audio receive-only. Offer and answer built from the Teams code and unit tested at SDP level; needs a second person |
180| Recording | Done | Organizer "..." > Record and transcribe: Start recording, Record audio only, Start transcription only; Stop recording / Stop transcription / Stop both (confirm) through the recorder bot; header chip red "Recording" / "Recording audio" or blue "Transcribing" for everyone from the meeting state, consent notice that keeps mic and camera off until OK. Bodies unit tested; video, audio only, transcription only and every stop variant run live; a stop sent while the recorder still settles is retried. Consent needs a tenant with the policy on |
180| Recording | Done | Organizer "..." > Record and transcribe: Start recording, Record audio only, Start transcription only; Stop recording / Stop transcription / Stop both (confirm) through the recorder bot; header chip red "Recording" / "Recording audio" or blue "Transcribing" for everyone from the meeting state, consent notice that keeps mic and camera off until OK. Bodies unit tested; video, audio only, transcription only and every stop variant run live; a stop sent while the recorder still settles is retried. Consent needs a tenant with the policy on |
181| Meeting recap tab | Partial | Recap in meeting chats with a recording: occurrence picker, recording card (duration, Audio only, expiry amber under 7 days), Play in the browser, Download with save dialog and percent, organizer Delete with confirm, searchable read-only transcript with .vtt and .docx download, attendance (muted note when the tenant has reports off), files shared in the chat. Parsing and expiry unit tested, demo checked; occurrences, details and delete run live against real recordings. Gaps: an audio-only file carries a 1920x1080 slate, so "Audio only" never shows; a transcription-only file is listed as a recording |
181| Meeting recap tab | Partial | Recap in meeting chats with a recording: occurrence picker, recording card (duration, Audio only, expiry amber under 7 days), Play in the browser, Download with save dialog and percent, organizer Delete with confirm, searchable read-only transcript with .vtt and .docx download, attendance (muted note when the tenant has reports off), files shared in the chat. Parsing and expiry unit tested, demo checked; occurrences, details and delete run live against real recordings. Transcription-only sessions (item media source `Transcript`) show the transcript without a recording card. "Audio only" comes from the chat event (`videoContent="CurtainOnly"`), with the video size check as fallback. Both signals read live on real recordings, fixtures unit tested; the transcript-only path was not run live |
182| Hold, resume, transfer | Partial | 1:1 "..." > Hold renegotiates every line inactive, "On hold" view with Resume, "You're on hold" when the other side holds, Transfer... person picker with Transfer now (blind) and Consult first (second call, first held, Transfer now). Needs a second person; redirect and park not built |
182| Hold, resume, transfer | Partial | 1:1 "..." > Hold renegotiates every line inactive, "On hold" view with Resume, "You're on hold" when the other side holds, Transfer... person picker with Transfer now (blind) and Consult first (second call, first held, Transfer now). Needs a second person; redirect and park not built |
183| Noise suppression, music mode | Partial | Mic menu and Settings > Devices: Auto (device track with WebRTC echo cancellation, AGC, NS) or Off, Music mode keeps echo cancellation only. No Low/High, the APM has on/off flags only. Off and Music mode run a cpal mic through our own APM; checked with synthetic sources only, not with a real mic in a call |
183| Noise suppression, music mode | Partial | Mic menu and Settings > Devices: Auto (device track with WebRTC echo cancellation, AGC, NS) or Off, Music mode keeps echo cancellation only. No Low/High, the APM has on/off flags only. Off and Music mode run a cpal mic through our own APM; checked with synthetic sources only, not with a real mic in a call |
184| Push to talk | Partial | Hold Ctrl+Space while muted to talk, release to mute; main window focused, not inside text fields; hint chip on the stage. Unit tested, not tried on the Windows build |
184| Push to talk | Partial | Hold Ctrl+Space while muted to talk, release to mute; main window focused, not inside text fields; hint chip on the stage. Unit tested, not tried on the Windows build |
crates/app/src/demo_recap.rs +2 −0
@@ -33,6 +33,7 @@ pub fn occurrences(conversation_id: &str, now: DateTime<Utc>) -> Vec<Occurrence>
33 33 )),
34 34 duration_seconds: Some(920 + days_ago as u64 * 65),
35 35 organizer_id: Some(ORGANIZER_ID.to_owned()),
36 audio_only: false,
36 37 })
37 38 .collect()
38 39 }
@@ -42,6 +43,7 @@ pub fn details(occurrence: &Occurrence, now: DateTime<Utc>) -> RecordingDetails
42 43 RecordingDetails {
43 44 item_url: occurrence.recording_url.clone(),
44 45 audio_only: occurrence.message_id.ends_with('2'),
46 transcript_only: false,
45 47 duration_seconds: occurrence.duration_seconds,
46 48 expires_at: Some(
47 49 now + Duration::days(if latest {
@@ -33,6 +33,7 @@ pub fn occurrences(conversation_id: &str, now: DateTime<Utc>) -> Vec<Occurrence>
33 )),
33 )),
34 duration_seconds: Some(920 + days_ago as u64 * 65),
34 duration_seconds: Some(920 + days_ago as u64 * 65),
35 organizer_id: Some(ORGANIZER_ID.to_owned()),
35 organizer_id: Some(ORGANIZER_ID.to_owned()),
36 audio_only: false,
36 })
37 })
37 .collect()
38 .collect()
38}
39}
@@ -42,6 +43,7 @@ pub fn details(occurrence: &Occurrence, now: DateTime<Utc>) -> RecordingDetails
42 RecordingDetails {
43 RecordingDetails {
43 item_url: occurrence.recording_url.clone(),
44 item_url: occurrence.recording_url.clone(),
44 audio_only: occurrence.message_id.ends_with('2'),
45 audio_only: occurrence.message_id.ends_with('2'),
46 transcript_only: false,
45 duration_seconds: occurrence.duration_seconds,
47 duration_seconds: occurrence.duration_seconds,
46 expires_at: Some(
48 expires_at: Some(
47 now + Duration::days(if latest {
49 now + Duration::days(if latest {
crates/app/src/recap.rs +21 −1
@@ -1,4 +1,4 @@
1 use chatsvc::{Occurrence, TranscriptTurn};
1 use chatsvc::{Occurrence, RecordingDetails, TranscriptTurn};
2 2 use chrono::{DateTime, FixedOffset, NaiveDate, Utc};
3 3
4 4 use crate::format;
@@ -28,6 +28,10 @@ impl<T> Load<T> {
28 28 }
29 29 }
30 30
31 pub fn shows_recording(details: &Load<RecordingDetails>) -> bool {
32 !details.ready().is_some_and(|details| details.transcript_only)
33 }
34
31 35 pub fn expiry_label(days: i64) -> String {
32 36 match days {
33 37 0 => "Expires today".to_owned(),
@@ -179,9 +183,25 @@ mod tests {
179 183 recording_name: name.map(str::to_owned),
180 184 duration_seconds: None,
181 185 organizer_id: None,
186 audio_only: false,
182 187 }
183 188 }
184 189
190 #[test]
191 fn transcript_only_sessions_show_no_recording_card() {
192 let details = |transcript_only| RecordingDetails {
193 item_url: String::new(),
194 audio_only: false,
195 transcript_only,
196 duration_seconds: None,
197 expires_at: None,
198 transcript_id: None,
199 };
200 assert!(!shows_recording(&Load::Ready(details(true))));
201 assert!(shows_recording(&Load::Ready(details(false))));
202 assert!(shows_recording(&Load::Loading));
203 }
204
185 205 #[test]
186 206 fn expiry_wording_and_urgency() {
187 207 assert_eq!(expiry_label(0), "Expires today");
@@ -1,4 +1,4 @@
1use chatsvc::{Occurrence, TranscriptTurn};
1use chatsvc::{Occurrence, RecordingDetails, TranscriptTurn};
2use chrono::{DateTime, FixedOffset, NaiveDate, Utc};
2use chrono::{DateTime, FixedOffset, NaiveDate, Utc};
3
3
4use crate::format;
4use crate::format;
@@ -28,6 +28,10 @@ impl<T> Load<T> {
28 }
28 }
29}
29}
30
30
31pub fn shows_recording(details: &Load<RecordingDetails>) -> bool {
32 !details.ready().is_some_and(|details| details.transcript_only)
33}
34
31pub fn expiry_label(days: i64) -> String {
35pub fn expiry_label(days: i64) -> String {
32 match days {
36 match days {
33 0 => "Expires today".to_owned(),
37 0 => "Expires today".to_owned(),
@@ -179,9 +183,25 @@ mod tests {
179 recording_name: name.map(str::to_owned),
183 recording_name: name.map(str::to_owned),
180 duration_seconds: None,
184 duration_seconds: None,
181 organizer_id: None,
185 organizer_id: None,
186 audio_only: false,
182 }
187 }
183 }
188 }
184
189
190 #[test]
191 fn transcript_only_sessions_show_no_recording_card() {
192 let details = |transcript_only| RecordingDetails {
193 item_url: String::new(),
194 audio_only: false,
195 transcript_only,
196 duration_seconds: None,
197 expires_at: None,
198 transcript_id: None,
199 };
200 assert!(!shows_recording(&Load::Ready(details(true))));
201 assert!(shows_recording(&Load::Ready(details(false))));
202 assert!(shows_recording(&Load::Loading));
203 }
204
185 #[test]
205 #[test]
186 fn expiry_wording_and_urgency() {
206 fn expiry_wording_and_urgency() {
187 assert_eq!(expiry_label(0), "Expires today");
207 assert_eq!(expiry_label(0), "Expires today");
crates/app/src/views/recap_tab.rs +4 −2
@@ -22,7 +22,7 @@ use crate::downloads::DownloadState;
22 22 use crate::recap::{
23 23 ATTENDANCE_FAILED, ATTENDANCE_OFF, EMPTY_RECAP, Load, NO_TRANSCRIPT, clock_label,
24 24 expiry_is_urgent, expiry_label, highlight_segments, matching_turns, occurrence_label,
25 span_label, time_label,
25 shows_recording, span_label, time_label,
26 26 };
27 27 use crate::theme;
28 28
@@ -504,7 +504,9 @@ pub fn render_recap(view: RecapView, run: &RecapRun) -> AnyElement {
504 504 .px(px(SIDE_PADDING))
505 505 .gap(px(SECTION_GAP))
506 506 .child(picker(&view, offset, today, run))
507 .child(recording_section(&view, run))
507 .when(shows_recording(view.details), |column| {
508 column.child(recording_section(&view, run))
509 })
508 510 .child(transcript_section(&view, run))
509 511 .child(attendance_section(&view, offset)),
510 512 )
@@ -22,7 +22,7 @@ use crate::downloads::DownloadState;
22use crate::recap::{
22use crate::recap::{
23 ATTENDANCE_FAILED, ATTENDANCE_OFF, EMPTY_RECAP, Load, NO_TRANSCRIPT, clock_label,
23 ATTENDANCE_FAILED, ATTENDANCE_OFF, EMPTY_RECAP, Load, NO_TRANSCRIPT, clock_label,
24 expiry_is_urgent, expiry_label, highlight_segments, matching_turns, occurrence_label,
24 expiry_is_urgent, expiry_label, highlight_segments, matching_turns, occurrence_label,
25 span_label, time_label,
25 shows_recording, span_label, time_label,
26};
26};
27use crate::theme;
27use crate::theme;
28
28
@@ -504,7 +504,9 @@ pub fn render_recap(view: RecapView, run: &RecapRun) -> AnyElement {
504 .px(px(SIDE_PADDING))
504 .px(px(SIDE_PADDING))
505 .gap(px(SECTION_GAP))
505 .gap(px(SECTION_GAP))
506 .child(picker(&view, offset, today, run))
506 .child(picker(&view, offset, today, run))
507 .child(recording_section(&view, run))
507 .when(shows_recording(view.details), |column| {
508 column.child(recording_section(&view, run))
509 })
508 .child(transcript_section(&view, run))
510 .child(transcript_section(&view, run))
509 .child(attendance_section(&view, offset)),
511 .child(attendance_section(&view, offset)),
510 )
512 )
crates/calling/examples/meet_now.rs +4 −1
@@ -40,6 +40,7 @@ struct Arguments {
40 40 mute_all: bool,
41 41 blur: bool,
42 42 record: bool,
43 audio_only: bool,
43 44 record_for: Duration,
44 45 unmute: bool,
45 46 whiteboard_state: bool,
@@ -61,6 +62,7 @@ fn arguments() -> Arguments {
61 62 mute_all: false,
62 63 blur: false,
63 64 record: false,
65 audio_only: false,
64 66 record_for: RECORD_HOLD,
65 67 unmute: false,
66 68 whiteboard_state: false,
@@ -84,6 +86,7 @@ fn arguments() -> Arguments {
84 86 parsed.camera = true;
85 87 }
86 88 "--record" => parsed.record = true,
89 "--audio-only" => parsed.audio_only = true,
87 90 "--record-for" => parsed.record_for = input.next().and_then(|value| value.parse().ok()).map_or(RECORD_HOLD, Duration::from_secs),
88 91 "--unmute" => parsed.unmute = true,
89 92 "--whiteboard-state" => parsed.whiteboard_state = true,
@@ -432,7 +435,7 @@ async fn run() {
432 435 let _ = handle.commands.send(CallCommand::SetBackground(BackgroundChoice::Blur));
433 436 }
434 437 if arguments.record {
435 let _ = handle.commands.send(CallCommand::StartRecording { kind: RecordingKind::Video, title: SUBJECT.to_owned() });
438 let _ = handle.commands.send(CallCommand::StartRecording { kind: if arguments.audio_only { RecordingKind::AudioOnly } else { RecordingKind::Video }, title: SUBJECT.to_owned() });
436 439 }
437 440 if arguments.whiteboard_state {
438 441 features.whiteboard_wait_until = Some(Instant::now() + WHITEBOARD_WAIT);
@@ -40,6 +40,7 @@ struct Arguments {
40 mute_all: bool,
40 mute_all: bool,
41 blur: bool,
41 blur: bool,
42 record: bool,
42 record: bool,
43 audio_only: bool,
43 record_for: Duration,
44 record_for: Duration,
44 unmute: bool,
45 unmute: bool,
45 whiteboard_state: bool,
46 whiteboard_state: bool,
@@ -61,6 +62,7 @@ fn arguments() -> Arguments {
61 mute_all: false,
62 mute_all: false,
62 blur: false,
63 blur: false,
63 record: false,
64 record: false,
65 audio_only: false,
64 record_for: RECORD_HOLD,
66 record_for: RECORD_HOLD,
65 unmute: false,
67 unmute: false,
66 whiteboard_state: false,
68 whiteboard_state: false,
@@ -84,6 +86,7 @@ fn arguments() -> Arguments {
84 parsed.camera = true;
86 parsed.camera = true;
85 }
87 }
86 "--record" => parsed.record = true,
88 "--record" => parsed.record = true,
89 "--audio-only" => parsed.audio_only = true,
87 "--record-for" => parsed.record_for = input.next().and_then(|value| value.parse().ok()).map_or(RECORD_HOLD, Duration::from_secs),
90 "--record-for" => parsed.record_for = input.next().and_then(|value| value.parse().ok()).map_or(RECORD_HOLD, Duration::from_secs),
88 "--unmute" => parsed.unmute = true,
91 "--unmute" => parsed.unmute = true,
89 "--whiteboard-state" => parsed.whiteboard_state = true,
92 "--whiteboard-state" => parsed.whiteboard_state = true,
@@ -432,7 +435,7 @@ async fn run() {
432 let _ = handle.commands.send(CallCommand::SetBackground(BackgroundChoice::Blur));
435 let _ = handle.commands.send(CallCommand::SetBackground(BackgroundChoice::Blur));
433 }
436 }
434 if arguments.record {
437 if arguments.record {
435 let _ = handle.commands.send(CallCommand::StartRecording { kind: RecordingKind::Video, title: SUBJECT.to_owned() });
438 let _ = handle.commands.send(CallCommand::StartRecording { kind: if arguments.audio_only { RecordingKind::AudioOnly } else { RecordingKind::Video }, title: SUBJECT.to_owned() });
436 }
439 }
437 if arguments.whiteboard_state {
440 if arguments.whiteboard_state {
438 features.whiteboard_wait_until = Some(Instant::now() + WHITEBOARD_WAIT);
441 features.whiteboard_wait_until = Some(Instant::now() + WHITEBOARD_WAIT);
crates/chatsvc/src/recap.rs +103 −3
@@ -7,6 +7,7 @@ use serde_json::Value;
7 7 use session::{Method, Request, Scope, Session};
8 8
9 9 use crate::messages::encode;
10 use crate::pins::DEFAULT_REGION;
10 11 use crate::transcripts::{
11 12 TranscriptError, TranscriptTurn, Transcripts, newest_transcript, parse_transcript_list,
12 13 parse_turns, share_id, site_origin,
@@ -18,6 +19,8 @@ const MESSAGES_SCOPE: &str = "Chat.Read";
18 19 const SITE_SCOPE: &str = ".default";
19 20 const ATTENDANCE_SCOPE: &str = "OnlineMeetingArtifact.Read.All";
20 21 const MAX_MESSAGE_PAGES: usize = 40;
22 const AUDIO_ONLY_MARKER: &str = "videoContent=\"CurtainOnly\"";
23 const ORIGINAL_NAME_OPEN: &str = "<OriginalName v=\"";
21 24
22 25 #[derive(Debug, Clone, PartialEq, Eq)]
23 26 pub struct Occurrence {
@@ -27,12 +30,14 @@ pub struct Occurrence {
27 30 pub recording_name: Option<String>,
28 31 pub duration_seconds: Option<u64>,
29 32 pub organizer_id: Option<String>,
33 pub audio_only: bool,
30 34 }
31 35
32 36 #[derive(Debug, Clone, PartialEq, Eq)]
33 37 pub struct RecordingDetails {
34 38 pub item_url: String,
35 39 pub audio_only: bool,
40 pub transcript_only: bool,
36 41 pub duration_seconds: Option<u64>,
37 42 pub expires_at: Option<DateTime<Utc>>,
38 43 pub transcript_id: Option<String>,
@@ -99,11 +104,40 @@ impl<'a> Recap<'a> {
99 104 None => break,
100 105 }
101 106 }
102 let occurrences = sorted_occurrences(found);
107 let audio_only_names = self.audio_only_names(thread_id).await;
108 let occurrences = sorted_occurrences(with_audio_only(found, &audio_only_names));
103 109 let deleted = self.deleted_recordings(&occurrences).await;
104 110 Ok(without_deleted(occurrences, &deleted))
105 111 }
106 112
113 async fn audio_only_names(&self, thread_id: &str) -> HashSet<String> {
114 let scope = Scope::new(session::IC3, "Teams.AccessAsUser.All");
115 let mut url = format!(
116 "https://teams.cloud.microsoft/api/chatsvc/{DEFAULT_REGION}/v1/users/ME/conversations/{}/messages?view=msnp24Equivalent&pageSize=200",
117 encode(thread_id)
118 );
119 let mut names = HashSet::new();
120 for _ in 0..MAX_MESSAGE_PAGES {
121 let Ok(page) = self
122 .transcripts
123 .get(&url, &scope, TranscriptError::NoRecording)
124 .await
125 else {
126 break;
127 };
128 names.extend(parse_audio_only_names(&page));
129 match page
130 .pointer("/_metadata/backwardLink")
131 .and_then(Value::as_str)
132 .filter(|link| !link.is_empty() && *link != url)
133 {
134 Some(next) => url = next.to_owned(),
135 None => break,
136 }
137 }
138 names
139 }
140
107 141 async fn deleted_recordings(&self, occurrences: &[Occurrence]) -> HashSet<String> {
108 142 let mut deleted = HashSet::new();
109 143 let sites: BTreeSet<String> = occurrences
@@ -152,7 +186,7 @@ impl<'a> Recap<'a> {
152 186 .transcripts
153 187 .get(
154 188 &format!(
155 "{site}/_api/v2.1/shares/{}/driveItem?$select=id,parentReference,video,file",
189 "{site}/_api/v2.1/shares/{}/driveItem?$select=id,parentReference,video,file,media",
156 190 share_id(&occurrence.recording_url)
157 191 ),
158 192 &site_scope,
@@ -179,7 +213,8 @@ impl<'a> Recap<'a> {
179 213 .await
180 214 .ok();
181 215 Ok(RecordingDetails {
182 audio_only: is_audio_only(&item),
216 audio_only: occurrence.audio_only || is_audio_only(&item),
217 transcript_only: is_transcript_only(&item),
183 218 duration_seconds: item_duration_seconds(&item).or(occurrence.duration_seconds),
184 219 expires_at: expiration.as_ref().and_then(parse_expiration),
185 220 transcript_id: listing
@@ -395,11 +430,47 @@ pub fn parse_occurrences(messages_json: &Value) -> Vec<Occurrence> {
395 430 .pointer("/meetingOrganizer/user/id")
396 431 .and_then(Value::as_str)
397 432 .map(str::to_owned),
433 audio_only: false,
398 434 })
399 435 })
400 436 .collect()
401 437 }
402 438
439 pub fn parse_audio_only_names(chatsvc_messages_json: &Value) -> HashSet<String> {
440 chatsvc_messages_json
441 .get("messages")
442 .and_then(Value::as_array)
443 .into_iter()
444 .flatten()
445 .filter(|message| {
446 message.get("messagetype").and_then(Value::as_str) == Some("RichText/Media_CallRecording")
447 })
448 .filter_map(|message| message.get("content").and_then(Value::as_str))
449 .filter(|content| content.contains(AUDIO_ONLY_MARKER))
450 .filter_map(|content| {
451 let start = content.find(ORIGINAL_NAME_OPEN)? + ORIGINAL_NAME_OPEN.len();
452 let length = content[start..].find('"')?;
453 Some(content[start..start + length].to_owned())
454 })
455 .collect()
456 }
457
458 pub fn with_audio_only(
459 occurrences: Vec<Occurrence>,
460 audio_only_names: &HashSet<String>,
461 ) -> Vec<Occurrence> {
462 occurrences
463 .into_iter()
464 .map(|occurrence| Occurrence {
465 audio_only: occurrence
466 .recording_name
467 .as_ref()
468 .is_some_and(|name| audio_only_names.contains(name)),
469 ..occurrence
470 })
471 .collect()
472 }
473
403 474 pub fn sorted_occurrences(mut occurrences: Vec<Occurrence>) -> Vec<Occurrence> {
404 475 occurrences.sort_by_key(|occurrence| std::cmp::Reverse(occurrence.started_at));
405 476 occurrences.dedup_by(|left, right| left.recording_url == right.recording_url);
@@ -450,6 +521,13 @@ pub fn is_audio_only(item_json: &Value) -> bool {
450 521 .is_none_or(|width| width == 0)
451 522 }
452 523
524 pub fn is_transcript_only(item_json: &Value) -> bool {
525 item_json
526 .pointer("/media/mediaSource/contentType")
527 .and_then(Value::as_str)
528 == Some("Transcript")
529 }
530
453 531 pub fn item_duration_seconds(item_json: &Value) -> Option<u64> {
454 532 item_json
455 533 .pointer("/video/duration")
@@ -577,6 +655,28 @@ mod tests {
577 655 );
578 656 }
579 657
658 #[test]
659 fn audio_only_recordings_are_found_by_the_curtain_marker_in_the_chat_event() {
660 let names = parse_audio_only_names(&fixture("chatsvc_messages.json"));
661 assert_eq!(
662 names,
663 HashSet::from(["Weekly sync-20260309_100000-Meeting Recording.mp4".to_owned()])
664 );
665 let occurrences = with_audio_only(
666 sorted_occurrences(parse_occurrences(&fixture("messages.json"))),
667 &names,
668 );
669 assert!(occurrences[0].audio_only);
670 assert!(!occurrences[1].audio_only);
671 }
672
673 #[test]
674 fn transcript_only_items_are_told_apart_by_their_media_source() {
675 assert!(is_transcript_only(&fixture("drive_item_transcript.json")));
676 assert!(!is_transcript_only(&fixture("drive_item.json")));
677 assert!(!is_transcript_only(&fixture("drive_item_recording.json")));
678 }
679
580 680 #[test]
581 681 fn recording_item_gives_url_duration_and_video() {
582 682 let item = fixture("drive_item.json");
@@ -7,6 +7,7 @@ use serde_json::Value;
7use session::{Method, Request, Scope, Session};
7use session::{Method, Request, Scope, Session};
8
8
9use crate::messages::encode;
9use crate::messages::encode;
10use crate::pins::DEFAULT_REGION;
10use crate::transcripts::{
11use crate::transcripts::{
11 TranscriptError, TranscriptTurn, Transcripts, newest_transcript, parse_transcript_list,
12 TranscriptError, TranscriptTurn, Transcripts, newest_transcript, parse_transcript_list,
12 parse_turns, share_id, site_origin,
13 parse_turns, share_id, site_origin,
@@ -18,6 +19,8 @@ const MESSAGES_SCOPE: &str = "Chat.Read";
18const SITE_SCOPE: &str = ".default";
19const SITE_SCOPE: &str = ".default";
19const ATTENDANCE_SCOPE: &str = "OnlineMeetingArtifact.Read.All";
20const ATTENDANCE_SCOPE: &str = "OnlineMeetingArtifact.Read.All";
20const MAX_MESSAGE_PAGES: usize = 40;
21const MAX_MESSAGE_PAGES: usize = 40;
22const AUDIO_ONLY_MARKER: &str = "videoContent=\"CurtainOnly\"";
23const ORIGINAL_NAME_OPEN: &str = "<OriginalName v=\"";
21
24
22#[derive(Debug, Clone, PartialEq, Eq)]
25#[derive(Debug, Clone, PartialEq, Eq)]
23pub struct Occurrence {
26pub struct Occurrence {
@@ -27,12 +30,14 @@ pub struct Occurrence {
27 pub recording_name: Option<String>,
30 pub recording_name: Option<String>,
28 pub duration_seconds: Option<u64>,
31 pub duration_seconds: Option<u64>,
29 pub organizer_id: Option<String>,
32 pub organizer_id: Option<String>,
33 pub audio_only: bool,
30}
34}
31
35
32#[derive(Debug, Clone, PartialEq, Eq)]
36#[derive(Debug, Clone, PartialEq, Eq)]
33pub struct RecordingDetails {
37pub struct RecordingDetails {
34 pub item_url: String,
38 pub item_url: String,
35 pub audio_only: bool,
39 pub audio_only: bool,
40 pub transcript_only: bool,
36 pub duration_seconds: Option<u64>,
41 pub duration_seconds: Option<u64>,
37 pub expires_at: Option<DateTime<Utc>>,
42 pub expires_at: Option<DateTime<Utc>>,
38 pub transcript_id: Option<String>,
43 pub transcript_id: Option<String>,
@@ -99,11 +104,40 @@ impl<'a> Recap<'a> {
99 None => break,
104 None => break,
100 }
105 }
101 }
106 }
102 let occurrences = sorted_occurrences(found);
107 let audio_only_names = self.audio_only_names(thread_id).await;
108 let occurrences = sorted_occurrences(with_audio_only(found, &audio_only_names));
103 let deleted = self.deleted_recordings(&occurrences).await;
109 let deleted = self.deleted_recordings(&occurrences).await;
104 Ok(without_deleted(occurrences, &deleted))
110 Ok(without_deleted(occurrences, &deleted))
105 }
111 }
106
112
113 async fn audio_only_names(&self, thread_id: &str) -> HashSet<String> {
114 let scope = Scope::new(session::IC3, "Teams.AccessAsUser.All");
115 let mut url = format!(
116 "https://teams.cloud.microsoft/api/chatsvc/{DEFAULT_REGION}/v1/users/ME/conversations/{}/messages?view=msnp24Equivalent&pageSize=200",
117 encode(thread_id)
118 );
119 let mut names = HashSet::new();
120 for _ in 0..MAX_MESSAGE_PAGES {
121 let Ok(page) = self
122 .transcripts
123 .get(&url, &scope, TranscriptError::NoRecording)
124 .await
125 else {
126 break;
127 };
128 names.extend(parse_audio_only_names(&page));
129 match page
130 .pointer("/_metadata/backwardLink")
131 .and_then(Value::as_str)
132 .filter(|link| !link.is_empty() && *link != url)
133 {
134 Some(next) => url = next.to_owned(),
135 None => break,
136 }
137 }
138 names
139 }
140
107 async fn deleted_recordings(&self, occurrences: &[Occurrence]) -> HashSet<String> {
141 async fn deleted_recordings(&self, occurrences: &[Occurrence]) -> HashSet<String> {
108 let mut deleted = HashSet::new();
142 let mut deleted = HashSet::new();
109 let sites: BTreeSet<String> = occurrences
143 let sites: BTreeSet<String> = occurrences
@@ -152,7 +186,7 @@ impl<'a> Recap<'a> {
152 .transcripts
186 .transcripts
153 .get(
187 .get(
154 &format!(
188 &format!(
155 "{site}/_api/v2.1/shares/{}/driveItem?$select=id,parentReference,video,file",
189 "{site}/_api/v2.1/shares/{}/driveItem?$select=id,parentReference,video,file,media",
156 share_id(&occurrence.recording_url)
190 share_id(&occurrence.recording_url)
157 ),
191 ),
158 &site_scope,
192 &site_scope,
@@ -179,7 +213,8 @@ impl<'a> Recap<'a> {
179 .await
213 .await
180 .ok();
214 .ok();
181 Ok(RecordingDetails {
215 Ok(RecordingDetails {
182 audio_only: is_audio_only(&item),
216 audio_only: occurrence.audio_only || is_audio_only(&item),
217 transcript_only: is_transcript_only(&item),
183 duration_seconds: item_duration_seconds(&item).or(occurrence.duration_seconds),
218 duration_seconds: item_duration_seconds(&item).or(occurrence.duration_seconds),
184 expires_at: expiration.as_ref().and_then(parse_expiration),
219 expires_at: expiration.as_ref().and_then(parse_expiration),
185 transcript_id: listing
220 transcript_id: listing
@@ -395,11 +430,47 @@ pub fn parse_occurrences(messages_json: &Value) -> Vec<Occurrence> {
395 .pointer("/meetingOrganizer/user/id")
430 .pointer("/meetingOrganizer/user/id")
396 .and_then(Value::as_str)
431 .and_then(Value::as_str)
397 .map(str::to_owned),
432 .map(str::to_owned),
433 audio_only: false,
398 })
434 })
399 })
435 })
400 .collect()
436 .collect()
401}
437}
402
438
439pub fn parse_audio_only_names(chatsvc_messages_json: &Value) -> HashSet<String> {
440 chatsvc_messages_json
441 .get("messages")
442 .and_then(Value::as_array)
443 .into_iter()
444 .flatten()
445 .filter(|message| {
446 message.get("messagetype").and_then(Value::as_str) == Some("RichText/Media_CallRecording")
447 })
448 .filter_map(|message| message.get("content").and_then(Value::as_str))
449 .filter(|content| content.contains(AUDIO_ONLY_MARKER))
450 .filter_map(|content| {
451 let start = content.find(ORIGINAL_NAME_OPEN)? + ORIGINAL_NAME_OPEN.len();
452 let length = content[start..].find('"')?;
453 Some(content[start..start + length].to_owned())
454 })
455 .collect()
456}
457
458pub fn with_audio_only(
459 occurrences: Vec<Occurrence>,
460 audio_only_names: &HashSet<String>,
461) -> Vec<Occurrence> {
462 occurrences
463 .into_iter()
464 .map(|occurrence| Occurrence {
465 audio_only: occurrence
466 .recording_name
467 .as_ref()
468 .is_some_and(|name| audio_only_names.contains(name)),
469 ..occurrence
470 })
471 .collect()
472}
473
403pub fn sorted_occurrences(mut occurrences: Vec<Occurrence>) -> Vec<Occurrence> {
474pub fn sorted_occurrences(mut occurrences: Vec<Occurrence>) -> Vec<Occurrence> {
404 occurrences.sort_by_key(|occurrence| std::cmp::Reverse(occurrence.started_at));
475 occurrences.sort_by_key(|occurrence| std::cmp::Reverse(occurrence.started_at));
405 occurrences.dedup_by(|left, right| left.recording_url == right.recording_url);
476 occurrences.dedup_by(|left, right| left.recording_url == right.recording_url);
@@ -450,6 +521,13 @@ pub fn is_audio_only(item_json: &Value) -> bool {
450 .is_none_or(|width| width == 0)
521 .is_none_or(|width| width == 0)
451}
522}
452
523
524pub fn is_transcript_only(item_json: &Value) -> bool {
525 item_json
526 .pointer("/media/mediaSource/contentType")
527 .and_then(Value::as_str)
528 == Some("Transcript")
529}
530
453pub fn item_duration_seconds(item_json: &Value) -> Option<u64> {
531pub fn item_duration_seconds(item_json: &Value) -> Option<u64> {
454 item_json
532 item_json
455 .pointer("/video/duration")
533 .pointer("/video/duration")
@@ -577,6 +655,28 @@ mod tests {
577 );
655 );
578 }
656 }
579
657
658 #[test]
659 fn audio_only_recordings_are_found_by_the_curtain_marker_in_the_chat_event() {
660 let names = parse_audio_only_names(&fixture("chatsvc_messages.json"));
661 assert_eq!(
662 names,
663 HashSet::from(["Weekly sync-20260309_100000-Meeting Recording.mp4".to_owned()])
664 );
665 let occurrences = with_audio_only(
666 sorted_occurrences(parse_occurrences(&fixture("messages.json"))),
667 &names,
668 );
669 assert!(occurrences[0].audio_only);
670 assert!(!occurrences[1].audio_only);
671 }
672
673 #[test]
674 fn transcript_only_items_are_told_apart_by_their_media_source() {
675 assert!(is_transcript_only(&fixture("drive_item_transcript.json")));
676 assert!(!is_transcript_only(&fixture("drive_item.json")));
677 assert!(!is_transcript_only(&fixture("drive_item_recording.json")));
678 }
679
580 #[test]
680 #[test]
581 fn recording_item_gives_url_duration_and_video() {
681 fn recording_item_gives_url_duration_and_video() {
582 let item = fixture("drive_item.json");
682 let item = fixture("drive_item.json");
crates/chatsvc/tests/fixtures/recap/chatsvc_messages.json added +13 −0
@@ -0,0 +1,13 @@
1 {
2 "messages": [
3 {
4 "messagetype": "RichText/Media_CallRecording",
5 "content": "<URIObject type=\"Video.2/CallRecording.1\"><RecordingStatus status=\"Success\" code=\"200\"></RecordingStatus><OriginalName v=\"Weekly sync-20260309_100000-Meeting Recording.mp4\" /><RecordingContent contentTypes=\"Recording+Transcript\" duration=\"0:30:32.00\"><item type=\"video\" uri=\"\" videoContent=\"CurtainOnly\" /><item type=\"onedriveForBusinessVideo\" uri=\"https://contoso-my.sharepoint.com/second.mp4\" driveId=\"drive-1\" driveItemId=\"item-2\" /></RecordingContent></URIObject>"
6 },
7 {
8 "messagetype": "RichText/Media_CallRecording",
9 "content": "<URIObject type=\"Video.2/CallRecording.1\"><RecordingStatus status=\"Success\" code=\"200\"></RecordingStatus><OriginalName v=\"first.mp4\" /><RecordingContent contentTypes=\"Recording+Transcript\"><item type=\"video\" uri=\"\" /></RecordingContent></URIObject>"
10 },
11 {"messagetype": "Text", "content": "hello"}
12 ]
13 }
@@ -0,0 +1,13 @@
1{
2 "messages": [
3 {
4 "messagetype": "RichText/Media_CallRecording",
5 "content": "<URIObject type=\"Video.2/CallRecording.1\"><RecordingStatus status=\"Success\" code=\"200\"></RecordingStatus><OriginalName v=\"Weekly sync-20260309_100000-Meeting Recording.mp4\" /><RecordingContent contentTypes=\"Recording+Transcript\" duration=\"0:30:32.00\"><item type=\"video\" uri=\"\" videoContent=\"CurtainOnly\" /><item type=\"onedriveForBusinessVideo\" uri=\"https://contoso-my.sharepoint.com/second.mp4\" driveId=\"drive-1\" driveItemId=\"item-2\" /></RecordingContent></URIObject>"
6 },
7 {
8 "messagetype": "RichText/Media_CallRecording",
9 "content": "<URIObject type=\"Video.2/CallRecording.1\"><RecordingStatus status=\"Success\" code=\"200\"></RecordingStatus><OriginalName v=\"first.mp4\" /><RecordingContent contentTypes=\"Recording+Transcript\"><item type=\"video\" uri=\"\" /></RecordingContent></URIObject>"
10 },
11 {"messagetype": "Text", "content": "hello"}
12 ]
13}
crates/chatsvc/tests/fixtures/recap/drive_item_recording.json added +7 −0
@@ -0,0 +1,7 @@
1 {
2 "id": "item-3",
3 "parentReference": {"driveId": "drive-1"},
4 "video": {"duration": 53120, "width": 1920, "height": 1080},
5 "file": {"mimeType": "video/mp4"},
6 "media": {"mediaSource": {"contentCategory": "Meeting", "contentType": "Recording"}}
7 }
@@ -0,0 +1,7 @@
1{
2 "id": "item-3",
3 "parentReference": {"driveId": "drive-1"},
4 "video": {"duration": 53120, "width": 1920, "height": 1080},
5 "file": {"mimeType": "video/mp4"},
6 "media": {"mediaSource": {"contentCategory": "Meeting", "contentType": "Recording"}}
7}
crates/chatsvc/tests/fixtures/recap/drive_item_transcript.json added +7 −0
@@ -0,0 +1,7 @@
1 {
2 "id": "item-2",
3 "parentReference": {"driveId": "drive-1"},
4 "video": {"duration": 61000, "width": 1920, "height": 1080},
5 "file": {"mimeType": "video/mp4"},
6 "media": {"mediaSource": {"contentCategory": "Meeting", "contentType": "Transcript"}}
7 }
@@ -0,0 +1,7 @@
1{
2 "id": "item-2",
3 "parentReference": {"driveId": "drive-1"},
4 "video": {"duration": 61000, "width": 1920, "height": 1080},
5 "file": {"mimeType": "video/mp4"},
6 "media": {"mediaSource": {"contentCategory": "Meeting", "contentType": "Transcript"}}
7}