🚀 Major Release: DigiServer v1.1.0 Production Deployment ## 📁 Project Restructure - Moved all application code to app/ directory for Docker containerization - Centralized persistent data in data/ directory with volume mounting - Removed development artifacts and cleaned up project structure ## 🐳 Docker Integration - Added production-ready Dockerfile with LibreOffice and poppler-utils - Updated docker-compose.yml for production deployment - Added .dockerignore for optimized build context - Created automated deployment script (deploy-docker.sh) - Added cleanup script (cleanup-docker.sh) ## 📄 Document Processing Enhancements - Integrated LibreOffice for professional PPTX to PDF conversion - Implemented PPTX → PDF → 4K JPG workflow for optimal quality - Added poppler-utils for enhanced PDF processing - Simplified PDF conversion to 300 DPI for reliability ## 🔧 File Management Improvements - Fixed absolute path resolution for containerized deployment - Updated all file deletion functions with proper path handling - Enhanced bulk delete functions for players and groups - Improved file upload workflow with consistent path management ## 🛠️ Code Quality & Stability - Cleaned up pptx_converter.py from 442 to 86 lines - Removed all Python cache files (__pycache__/, *.pyc) - Updated file operations for production reliability - Enhanced error handling and logging ## 📚 Documentation Updates - Updated README.md with Docker deployment instructions - Added comprehensive DEPLOYMENT.md guide - Included production deployment best practices - Added automated deployment workflow documentation ## 🔐 Security & Production Features - Environment-based configuration - Health checks and container monitoring - Automated admin user creation - Volume-mounted persistent data - Production logging and error handling ## ✅ Ready for Production - Clean project structure optimized for Docker - Automated deployment with ./deploy-docker.sh - Professional document processing pipeline - Reliable file management system - Complete documentation and deployment guides Access: http://localhost:8880 | Admin: admin/Initial01!
87 lines
2.8 KiB
Python
87 lines
2.8 KiB
Python
"""
|
|
PPTX to PDF converter using LibreOffice for high-quality conversion
|
|
This module provides the essential function to convert PowerPoint presentations to PDF
|
|
using LibreOffice headless mode for professional-grade quality.
|
|
|
|
The converted PDF is then processed by the main upload workflow for 4K image generation.
|
|
"""
|
|
|
|
import os
|
|
import subprocess
|
|
import logging
|
|
|
|
# Set up logging
|
|
logging.basicConfig(level=logging.INFO)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def pptx_to_pdf_libreoffice(pptx_path, output_dir):
|
|
"""
|
|
Convert PPTX to PDF using LibreOffice for highest quality.
|
|
|
|
This function is the core component of the PPTX processing workflow:
|
|
PPTX → PDF (this function) → 4K JPG images (handled in uploads.py)
|
|
|
|
Args:
|
|
pptx_path (str): Path to the PPTX file
|
|
output_dir (str): Directory to save the PDF
|
|
|
|
Returns:
|
|
str: Path to the generated PDF file, or None if conversion failed
|
|
"""
|
|
try:
|
|
# Ensure output directory exists
|
|
os.makedirs(output_dir, exist_ok=True)
|
|
|
|
# Use LibreOffice to convert PPTX to PDF
|
|
cmd = [
|
|
'libreoffice',
|
|
'--headless',
|
|
'--convert-to', 'pdf',
|
|
'--outdir', output_dir,
|
|
pptx_path
|
|
]
|
|
|
|
logger.info(f"Converting PPTX to PDF using LibreOffice: {pptx_path}")
|
|
result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
|
|
|
|
if result.returncode != 0:
|
|
logger.error(f"LibreOffice conversion failed: {result.stderr}")
|
|
return None
|
|
|
|
# Find the generated PDF file
|
|
base_name = os.path.splitext(os.path.basename(pptx_path))[0]
|
|
pdf_path = os.path.join(output_dir, f"{base_name}.pdf")
|
|
|
|
if os.path.exists(pdf_path):
|
|
logger.info(f"PDF conversion successful: {pdf_path}")
|
|
return pdf_path
|
|
else:
|
|
logger.error(f"PDF file not found after conversion: {pdf_path}")
|
|
return None
|
|
|
|
except subprocess.TimeoutExpired:
|
|
logger.error("LibreOffice conversion timed out (120s)")
|
|
return None
|
|
except Exception as e:
|
|
logger.error(f"Error in PPTX to PDF conversion: {e}")
|
|
return None
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# Test the converter
|
|
import sys
|
|
if len(sys.argv) > 1:
|
|
test_pptx = sys.argv[1]
|
|
if os.path.exists(test_pptx):
|
|
output_dir = "test_output"
|
|
pdf_result = pptx_to_pdf_libreoffice(test_pptx, output_dir)
|
|
if pdf_result:
|
|
print(f"Successfully converted PPTX to PDF: {pdf_result}")
|
|
else:
|
|
print("PPTX to PDF conversion failed")
|
|
else:
|
|
print(f"File not found: {test_pptx}")
|
|
else:
|
|
print("Usage: python pptx_converter.py <pptx_file>")
|