Add new sound files and update dependencies
- Added various sound files to the soundboard, including insults, quotes, and sound effects. - Introduced new dependencies: ffmpeg-python (version 0.2.0) and pydub (version 0.25.1) for audio processing. - Updated the lock file to reflect the new packages and their respective versions. - Added .gitignore files in the sounds/stream and sounds/temp directories to exclude unnecessary files.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Main routes for the application."""
|
||||
|
||||
from flask import Blueprint
|
||||
from flask import Blueprint, request
|
||||
|
||||
from app.services.decorators import (
|
||||
get_current_user,
|
||||
@@ -9,6 +9,8 @@ from app.services.decorators import (
|
||||
require_role,
|
||||
)
|
||||
from app.services.scheduler_service import scheduler_service
|
||||
from app.services.sound_normalizer_service import SoundNormalizerService
|
||||
from app.services.sound_scanner_service import SoundScannerService
|
||||
|
||||
bp = Blueprint("main", __name__)
|
||||
|
||||
@@ -101,3 +103,55 @@ def scheduler_status() -> dict:
|
||||
def manual_credit_refill() -> dict:
|
||||
"""Manually trigger credit refill for all users (admin only)."""
|
||||
return scheduler_service.trigger_credit_refill_now()
|
||||
|
||||
|
||||
@bp.route("/admin/sounds/scan", methods=["POST"])
|
||||
@require_auth
|
||||
@require_role("admin")
|
||||
def manual_sound_scan() -> dict:
|
||||
"""Manually trigger sound directory scan (admin only)."""
|
||||
return scheduler_service.trigger_sound_scan_now()
|
||||
|
||||
|
||||
@bp.route("/admin/sounds/stats")
|
||||
@require_auth
|
||||
@require_role("admin")
|
||||
def sound_statistics() -> dict:
|
||||
"""Get sound database statistics (admin only)."""
|
||||
return SoundScannerService.get_scan_statistics()
|
||||
|
||||
|
||||
@bp.route("/admin/sounds/normalize/<int:sound_id>", methods=["POST"])
|
||||
@require_auth
|
||||
@require_role("admin")
|
||||
def normalize_sound(sound_id: int) -> dict:
|
||||
"""Normalize a specific sound file (admin only)."""
|
||||
overwrite = request.args.get("overwrite", "false").lower() == "true"
|
||||
return SoundNormalizerService.normalize_sound(sound_id, overwrite)
|
||||
|
||||
|
||||
@bp.route("/admin/sounds/normalize-all", methods=["POST"])
|
||||
@require_auth
|
||||
@require_role("admin")
|
||||
def normalize_all_sounds() -> dict:
|
||||
"""Normalize all soundboard files (admin only)."""
|
||||
overwrite = request.args.get("overwrite", "false").lower() == "true"
|
||||
limit_str = request.args.get("limit")
|
||||
limit = int(limit_str) if limit_str else None
|
||||
return SoundNormalizerService.normalize_all_sounds(overwrite, limit)
|
||||
|
||||
|
||||
@bp.route("/admin/sounds/normalization-status")
|
||||
@require_auth
|
||||
@require_role("admin")
|
||||
def normalization_status() -> dict:
|
||||
"""Get normalization status statistics (admin only)."""
|
||||
return SoundNormalizerService.get_normalization_status()
|
||||
|
||||
|
||||
@bp.route("/admin/sounds/ffmpeg-check")
|
||||
@require_auth
|
||||
@require_role("admin")
|
||||
def ffmpeg_check() -> dict:
|
||||
"""Check ffmpeg availability and capabilities (admin only)."""
|
||||
return SoundNormalizerService.check_ffmpeg_availability()
|
||||
|
||||
Reference in New Issue
Block a user