File size: 2,109 Bytes
a9dc537 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
"""
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)
# Get slide title
title = ""
for shape in slide.shapes:
if shape.has_text_frame:
if shape.is_placeholder:
phf = shape.placeholder_format
if phf.type == 1: # Title placeholder
title = shape.text
break
print(f"Title: {title if title else '(No title)'}")
print("-" * 80)
# Get all text content
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}")
# Check for speaker notes
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)
|