teams-transcripts 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. legacy/__init__.py +0 -0
  2. legacy/transcript_download.py +3969 -0
  3. teams_transcripts/__init__.py +1 -0
  4. teams_transcripts/__main__.py +288 -0
  5. teams_transcripts/adapters/__init__.py +1 -0
  6. teams_transcripts/adapters/cdp/__init__.py +1 -0
  7. teams_transcripts/adapters/cdp/browser.py +196 -0
  8. teams_transcripts/adapters/cdp/connection.py +168 -0
  9. teams_transcripts/adapters/cdp/helpers.py +449 -0
  10. teams_transcripts/adapters/cdp/teams.py +463 -0
  11. teams_transcripts/adapters/vertex.py +274 -0
  12. teams_transcripts/domain/__init__.py +1 -0
  13. teams_transcripts/domain/chat.py +115 -0
  14. teams_transcripts/domain/html.py +126 -0
  15. teams_transcripts/domain/mcps.py +343 -0
  16. teams_transcripts/domain/models.py +531 -0
  17. teams_transcripts/domain/participants.py +292 -0
  18. teams_transcripts/domain/scoring.py +106 -0
  19. teams_transcripts/domain/speakers.py +130 -0
  20. teams_transcripts/domain/summary.py +266 -0
  21. teams_transcripts/domain/timestamps.py +350 -0
  22. teams_transcripts/domain/vtt.py +444 -0
  23. teams_transcripts/infrastructure/__init__.py +1 -0
  24. teams_transcripts/infrastructure/config.py +987 -0
  25. teams_transcripts/infrastructure/errors.py +120 -0
  26. teams_transcripts/infrastructure/logging.py +69 -0
  27. teams_transcripts/infrastructure/signals.py +143 -0
  28. teams_transcripts/mcp_server.py +818 -0
  29. teams_transcripts/ports/__init__.py +1 -0
  30. teams_transcripts/ports/agent.py +58 -0
  31. teams_transcripts/ports/browser.py +126 -0
  32. teams_transcripts/services/__init__.py +1 -0
  33. teams_transcripts/services/downloader.py +1283 -0
  34. teams_transcripts/services/extraction.py +1603 -0
  35. teams_transcripts/services/listing.py +826 -0
  36. teams_transcripts/services/navigation.py +1721 -0
  37. teams_transcripts/services/output.py +84 -0
  38. teams_transcripts/services/tenant.py +684 -0
  39. teams_transcripts-0.5.0.dist-info/METADATA +1438 -0
  40. teams_transcripts-0.5.0.dist-info/RECORD +42 -0
  41. teams_transcripts-0.5.0.dist-info/WHEEL +4 -0
  42. teams_transcripts-0.5.0.dist-info/entry_points.txt +4 -0
@@ -0,0 +1,84 @@
1
+ """Final output construction and emission for transcript downloads."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import contextlib
6
+ import json
7
+ import os
8
+ import sys
9
+ import typing
10
+
11
+ from teams_transcripts.domain.summary import build_result_summary
12
+ from teams_transcripts.domain.vtt import parse_cues
13
+
14
+ if typing.TYPE_CHECKING:
15
+ from teams_transcripts.domain.models import ChatMessage, MeetingConfig, MeetingParticipants
16
+
17
+
18
+ def _build_config_dict(
19
+ config: MeetingConfig,
20
+ speaker_map: dict[str, str],
21
+ roster_members_raw: list[dict],
22
+ meeting_time_text: str,
23
+ *,
24
+ tenant_domain: str | None = None,
25
+ ) -> dict:
26
+ """Adapt ``MeetingConfig`` to the plain mapping used by domain functions."""
27
+ result: dict[str, object] = {
28
+ "meeting": config.meeting,
29
+ "date": config.date,
30
+ "time": config.time,
31
+ "output": config.output,
32
+ "output_to_stdout": config.output_to_stdout,
33
+ "speaker_map": speaker_map,
34
+ "roster_members": roster_members_raw,
35
+ "meeting_time_text": meeting_time_text,
36
+ }
37
+ if tenant_domain is not None:
38
+ result["tenant"] = tenant_domain
39
+ return result
40
+
41
+
42
+ def _emit_output(
43
+ config: MeetingConfig,
44
+ config_dict: dict,
45
+ content: str,
46
+ num_parts: int,
47
+ verification: dict,
48
+ chat_count: int,
49
+ participants: MeetingParticipants | None = None,
50
+ *,
51
+ chat_messages: list[ChatMessage] | None = None,
52
+ ) -> None:
53
+ """Emit the final VTT or structured JSON to stdout or the output file."""
54
+ output_to_stdout = config.output_to_stdout
55
+
56
+ if config.format_json:
57
+ transcript_cues = parse_cues(content) if config.include_transcript else None
58
+ summary = build_result_summary(
59
+ config_dict,
60
+ num_parts=num_parts,
61
+ verification=verification,
62
+ chat_count=chat_count,
63
+ participants=participants,
64
+ chat_messages=chat_messages,
65
+ transcript_cues=transcript_cues,
66
+ include_transcript=config.include_transcript,
67
+ include_chat=config.include_chat,
68
+ include_metadata=config.include_metadata,
69
+ )
70
+
71
+ if output_to_stdout:
72
+ print(json.dumps(summary, ensure_ascii=False, indent=2), flush=True)
73
+ else:
74
+ assert config.output is not None
75
+ with open(config.output, "w") as output_file:
76
+ json.dump(summary, output_file, ensure_ascii=False, indent=2)
77
+ output_file.write("\n")
78
+ elif output_to_stdout:
79
+ sys.stdout.write(content)
80
+ sys.stdout.flush()
81
+
82
+ if output_to_stdout and config.output:
83
+ with contextlib.suppress(OSError):
84
+ os.remove(config.output)