from celery_app import celery_app from ripping import rip_dvd, rip_bluray, rip_cd, 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 rip_cd(device_path, disc_id) 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 }