Files
rippy/docker/worker/tasks.py
T
2026-07-21 16:49:01 +02:00

30 lines
915 B
Python

import os
from celery_app import celery_app
from ripping import rip_dvd, rip_bluray, detect_disc_type
@celery_app.task(bind=True, name="worker.tasks.rip_disc")
def rip_disc(self, device_path: str, disc_id: str = None):
"""Rippt eine Disc basierend auf ihrem Typ."""
disc_type = detect_disc_type(device_path)
if not disc_id:
disc_id = device_path.replace("/", "_")
if disc_type == "cd":
return {
"status": "not_implemented",
"message": "CD-Ripping mit abcde noch nicht implementiert",
"disc_type": disc_type
}
elif disc_type == "dvd":
return rip_dvd(device_path, disc_id)
elif disc_type == "bluray":
return rip_bluray(device_path, disc_id)
else:
return {
"status": "error",
"message": f"Unbekannter Disc-Typ: {disc_type}",
"disc_type": disc_type
}