feat: pass image paths to cover generator in publish route
Made-with: Cursor
This commit is contained in:
@@ -4,7 +4,7 @@ from calendar import monthrange
|
||||
from flask import Blueprint, render_template, request, redirect, url_for, flash, jsonify
|
||||
|
||||
from app import db
|
||||
from src.models import Article, Issue
|
||||
from src.models import Article, Issue, Image
|
||||
from src.cover import generate_cover
|
||||
from src.epub_builder import build_epub
|
||||
import config
|
||||
@@ -168,14 +168,17 @@ def create_issue():
|
||||
a.title for a in articles_for_issue
|
||||
if "Obituaries" not in json.loads(a.categories)
|
||||
]
|
||||
categories_list = []
|
||||
|
||||
image_paths = []
|
||||
for a in articles_for_issue:
|
||||
categories_list.extend(json.loads(a.categories))
|
||||
first_image = Image.query.filter_by(article_id=a.id).first()
|
||||
if first_image:
|
||||
image_paths.append(first_image.local_path)
|
||||
|
||||
try:
|
||||
cover_path = generate_cover(
|
||||
cover_method, config.ISSUES_DIR, week_start, week_end,
|
||||
headlines, categories_list
|
||||
headlines, image_paths
|
||||
)
|
||||
epub_path = build_epub(
|
||||
week_start, week_end, included_ids, cover_path,
|
||||
|
||||
Reference in New Issue
Block a user