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:
DigiServer Developer
2025-11-15 02:20:15 +02:00
parent 930a5bf636
commit 2e3e181bb2
4 changed files with 249 additions and 35 deletions

View File

@@ -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'))