| | """ |
| | Read and analyze SPARKNET presentation |
| | """ |
| | import sys |
| | from pptx import Presentation |
| |
|
| | def read_presentation(pptx_path): |
| | """Read PowerPoint presentation and extract content""" |
| | try: |
| | prs = Presentation(pptx_path) |
| |
|
| | print(f"Total Slides: {len(prs.slides)}\n") |
| | print("=" * 80) |
| |
|
| | for idx, slide in enumerate(prs.slides, 1): |
| | print(f"\n{'='*80}") |
| | print(f"SLIDE {idx}") |
| | print('='*80) |
| |
|
| | |
| | title = "" |
| | for shape in slide.shapes: |
| | if shape.has_text_frame: |
| | if shape.is_placeholder: |
| | phf = shape.placeholder_format |
| | if phf.type == 1: |
| | title = shape.text |
| | break |
| |
|
| | print(f"Title: {title if title else '(No title)'}") |
| | print("-" * 80) |
| |
|
| | |
| | print("Content:") |
| | for shape in slide.shapes: |
| | if shape.has_text_frame: |
| | for paragraph in shape.text_frame.paragraphs: |
| | text = paragraph.text.strip() |
| | if text: |
| | level = paragraph.level |
| | indent = " " * level |
| | print(f"{indent}- {text}") |
| |
|
| | |
| | if slide.has_notes_slide: |
| | notes_slide = slide.notes_slide |
| | if notes_slide.notes_text_frame: |
| | notes = notes_slide.notes_text_frame.text.strip() |
| | if notes: |
| | print("\nSpeaker Notes:") |
| | print(notes) |
| |
|
| | print("\n" + "="*80) |
| |
|
| | except Exception as e: |
| | print(f"Error reading presentation: {e}", file=sys.stderr) |
| | import traceback |
| | traceback.print_exc() |
| | return False |
| |
|
| | return True |
| |
|
| | if __name__ == "__main__": |
| | pptx_path = "/home/mhamdan/SPARKNET/presentation/SPARKNET_Academic_Presentation.pptx" |
| | read_presentation(pptx_path) |
| |
|