Embed 6 screenshots into DOCX appendix

This commit is contained in:
2026-08-10 12:22:53 +08:00
parent 75ec8ee9cb
commit f730f9f0d1
3 changed files with 108 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
"""Embed screenshots into the DOCX — no heading styles needed."""
from docx import Document
from docx.shared import Inches, Pt, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
import os
DOCX_PATH = "/tmp/nur-falah-docx/Nur-Falah-App-Store-Submission.docx"
SCREENSHOTS_DIR = "/tmp/nur-falah-docx/appstore-assets/screenshots"
doc = Document(DOCX_PATH)
doc.add_page_break()
# Use formatted paragraph instead of heading (avoids missing style errors)
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.LEFT
run = p.add_run("Appendix: App Store Screenshots")
run.bold = True
run.font.size = Pt(18)
run.font.color.rgb = RGBColor(0xC9, 0xA8, 0x4C)
p_fmt = p.paragraph_format
p_fmt.space_before = Pt(24)
p_fmt.space_after = Pt(12)
p_fmt.keep_with_next = True
screenshots = [
("1-6.7-prayer-times.png", "Screenshot 1: Prayer Times — Accurate prayer schedules with 5 calculation methods"),
("2-6.7-qibla-finder.png", "Screenshot 2: Qibla Finder — Find the Qibla from anywhere in the world"),
("3-6.7-holy-quran.png", "Screenshot 3: Holy Quran — All 114 surahs with Arabic names"),
("4-6.7-99-names.png", "Screenshot 4: 99 Names of Allah — Study Asma-ul-Husna with search"),
("5-6.7-tasbih-counter.png", "Screenshot 5: Tasbih Counter — Digital dhikr counter"),
("6-6.7-hijri-calendar.png", "Screenshot 6: Hijri Calendar — Islamic date with Gregorian conversion"),
]
for filename, caption in screenshots:
img_path = os.path.join(SCREENSHOTS_DIR, filename)
if not os.path.exists(img_path):
print(f" ⚠️ Missing: {filename}")
continue
cap = doc.add_paragraph()
cap.alignment = WD_ALIGN_PARAGRAPH.CENTER
r = cap.add_run(caption)
r.font.size = Pt(10)
r.font.italic = True
r.font.color.rgb = RGBColor(0x66, 0x66, 0x66)
img_par = doc.add_paragraph()
img_par.alignment = WD_ALIGN_PARAGRAPH.CENTER
img_par.add_run().add_picture(img_path, width=Inches(3.5))
doc.add_paragraph()
doc.save(DOCX_PATH)
print(f"✅ Updated: {DOCX_PATH}")
+53
View File
@@ -0,0 +1,53 @@
"""Send Nur Falah App Store DOCX to multiple recipients via email."""
import smtplib, ssl
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email import encoders
import os, sys
DOCX_PATH = "/Users/wanjauhari24/Desktop/Projects/nur-muslim-companion/Nur-Falah-App-Store-Submission.docx"
TO_LIST = ["wanjauhari@gmail.com", "wanjauhari@me.com"]
FROM = "wanjauhari@gmail.com"
SUBJECT = "Nur Falah — App Store Submission DOCX"
BODY = "Here is the complete App Store Connect submission document for Nur Falah Muslim Companion.\n\nIncludes full description, keywords, screenshot plan, privacy policy, and ASO recommendations."
def build_msg(to_addr):
msg = MIMEMultipart()
msg['From'] = FROM
msg['To'] = to_addr
msg['Subject'] = SUBJECT
msg.attach(MIMEText(BODY, 'plain'))
with open(DOCX_PATH, 'rb') as f:
part = MIMEBase('application', 'vnd.openxmlformats-officedocument.wordprocessingml.document')
part.set_payload(f.read())
encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment', filename=os.path.basename(DOCX_PATH))
msg.attach(part)
return msg
# Try sendmail first (local MTA) - send one per recipient
def try_sendmail():
if os.path.exists('/usr/sbin/sendmail'):
import subprocess
for to_addr in TO_LIST:
msg = build_msg(to_addr)
p = subprocess.run(
['/usr/sbin/sendmail', '-t'],
input=msg.as_bytes(),
capture_output=True,
timeout=15
)
if p.returncode == 0:
print(f"✅ Sent via sendmail → {to_addr}")
else:
print(f"⚠️ sendmail failed for {to_addr}: {p.stderr.decode()[:200]}")
return False
return True
return False
if __name__ == '__main__':
if try_sendmail():
sys.exit(0)
print("❌ sendmail not available.")
sys.exit(1)