Add leftover media management, PDF to PNG conversion, video delete, and playlist duration editing
Features added: - Leftover media management page in admin panel with delete functionality for images and videos - Individual file delete buttons for leftover media - PDF to PNG conversion (each page becomes a separate image at Full HD resolution) - Delete functionality for leftover video files - Enhanced playlist management with duration editing for all content types - Improved dark mode support for playlist management page - Content type badges with color coding - Better styling for duration input fields with save functionality - Fixed URL generation for duration update endpoint
This commit is contained in:
@@ -490,3 +490,29 @@ def delete_leftover_videos():
|
||||
flash(f'Error deleting leftover videos: {str(e)}', 'danger')
|
||||
|
||||
return redirect(url_for('admin.leftover_media'))
|
||||
|
||||
@admin_bp.route('/delete-single-leftover/<int:content_id>', methods=['POST'])
|
||||
@login_required
|
||||
@admin_required
|
||||
def delete_single_leftover(content_id):
|
||||
"""Delete a single leftover content file"""
|
||||
try:
|
||||
content = Content.query.get_or_404(content_id)
|
||||
|
||||
# Delete physical file
|
||||
if content.file_path:
|
||||
file_path = os.path.join(current_app.config['UPLOAD_FOLDER'], content.file_path)
|
||||
if os.path.exists(file_path):
|
||||
os.remove(file_path)
|
||||
|
||||
# Delete database record
|
||||
db.session.delete(content)
|
||||
db.session.commit()
|
||||
|
||||
flash(f'Successfully deleted {content.file_path}', 'success')
|
||||
|
||||
except Exception as e:
|
||||
db.session.rollback()
|
||||
flash(f'Error deleting file: {str(e)}', 'danger')
|
||||
|
||||
return redirect(url_for('admin.leftover_media'))
|
||||
|
||||
Reference in New Issue
Block a user