v4.3 ui: 3D wooden bookshelf redesign, fix player cover aspect ratio, and smooth subtitle scroll
This commit is contained in:
@@ -6,6 +6,8 @@ from flask import Blueprint, request, jsonify
|
||||
from db import get_db
|
||||
from pdf_processor import process_pdf_to_markdown
|
||||
from ai_processor import process_document_smartly
|
||||
from thumbnail_generator import generate_pdf_thumbnail
|
||||
from media_storage import save_pending_thumbnail
|
||||
from auth import login_required
|
||||
|
||||
pdf_bp = Blueprint('pdf', __name__)
|
||||
@@ -35,6 +37,20 @@ def upload_pdf():
|
||||
# --- AI Powered Smart Reconstruction & Section Tagging ---
|
||||
smart_blocks = process_document_smartly(result['markdown_blocks'], result['metadata'])
|
||||
|
||||
# --- v4.4: প্রথম পেজ থেকে অটো থাম্বনেইল জেনারেট ---
|
||||
pending_thumbnail = None
|
||||
pending_thumbnail_format = None
|
||||
try:
|
||||
thumb_bytes, thumb_fmt = generate_pdf_thumbnail(pdf_bytes)
|
||||
if thumb_bytes:
|
||||
token = save_pending_thumbnail(thumb_bytes, thumb_fmt)
|
||||
if token:
|
||||
pending_thumbnail = token
|
||||
pending_thumbnail_format = thumb_fmt
|
||||
print(f" 🖼️ Auto-thumbnail generated: {token} ({len(thumb_bytes)} bytes)")
|
||||
except Exception as te:
|
||||
print(f" ⚠️ Thumbnail step skipped: {te}")
|
||||
|
||||
# Save PDF document record
|
||||
db = get_db()
|
||||
cursor = db.cursor()
|
||||
@@ -59,7 +75,9 @@ def upload_pdf():
|
||||
'filename': pdf_file.filename,
|
||||
'page_count': result['page_count'],
|
||||
'metadata': result['metadata'],
|
||||
'blocks': smart_blocks
|
||||
'blocks': smart_blocks,
|
||||
'pending_thumbnail': pending_thumbnail,
|
||||
'pending_thumbnail_format': pending_thumbnail_format
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user