12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- def _archive(self, reverse_order: bool, download_attachments: bool,
- download_avatars: bool, download_workers: int, text_format: bool,
- html_format: bool, json_format: bool, timestamp_format: str) -> None:
- """
- Collects room messages and attachments using Webex Teams
- APIs and writes them to text/html files.
- """
- if reverse_order:
- self.messages_with_threads = list(reversed(list(self.messages_with_threads)))
- else:
- self.messages_with_threads = list(self.messages_with_threads)
- if html_format:
- self._create_html_transcript(self.messages_with_threads, self.attachments, self.people,
- download_avatars, timestamp_format)
- logger.debug("HTML transcript completed.")
- if text_format:
- self._create_text_transcript(
- self.messages_with_threads, self.attachments, self.people, timestamp_format)
- logger.debug("Text transcript completed.")
- if json_format:
- self._create_json_transcript(self.messages)
- logger.debug("JSON transcript completed.")
- if download_attachments:
- self._download_files(
- "attachments", self.attachments, download_workers)
- logger.debug("Attachments download completed.")
- if download_avatars:
- self._download_files("avatars", self.avatars, download_workers)
- logger.debug("Avatars download completed.")
- # Write space information to json file
- with open(os.path.join(os.getcwd(), self.archive_folder_name, f"space_details.json"), "w", encoding="utf-8") as fh:
- space_details = {
- "space": self.room.to_dict(),
- "creator": self.room_creator._asdict() if isinstance(self.room_creator, UserNotFound)
- else self.room_creator.to_dict(),
- }
- json.dump(space_details, fh)
- logger.info("Room %s archived successfully.", self.room.id)
|