- streamIngest worker concurrency 3'ten sabit değildi, artık MAX_CONCURRENT_CAPTURES (varsayılan 10) ile ayarlanabiliyor. Eskiden 3'ten fazla kanal aynı anda canlıya geçerse fazlası, ilk 3'ten biri bitene kadar (saatlerce) hiç kayda alınmıyordu. - Python worker'larda (signal-detection, stt-scoring) bullmq varsayılan concurrency'si 1'di — WORKER_CONCURRENCY (varsayılan 5) ile paralelleştirildi, birden fazla kanal aynı anda segment/transkript üretirse sıraya takılmasın diye. - Frontend artık shared-media volume'üne bağlı: /api/segments/[id]/video route'u Range destekli video stream/indirme sağlıyor. Segment ve kanal detay sayfalarına <video> oynatıcı, indirme linki ve onaylı silme (RawSegment + CandidateSegment, dosya dahil) eklendi. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
"use server";
|
||
|
||
import { unlink } from "node:fs/promises";
|
||
import { prisma } from "@streamclipper/db";
|
||
import { revalidatePath } from "next/cache";
|
||
|
||
export async function addChannel(formData: FormData) {
|
||
const name = String(formData.get("name") ?? "").trim();
|
||
const youtubeHandle = String(formData.get("youtubeHandle") ?? "").trim();
|
||
const channelId = String(formData.get("channelId") ?? "").trim();
|
||
|
||
if (!name || !youtubeHandle || !channelId) {
|
||
throw new Error("Kanal adı, handle ve channel_id alanları zorunlu.");
|
||
}
|
||
|
||
await prisma.channel.create({
|
||
data: { name, youtubeHandle, channelId, isActive: true },
|
||
});
|
||
|
||
revalidatePath("/");
|
||
}
|
||
|
||
export async function deleteRawSegment(segmentId: string) {
|
||
const segment = await prisma.rawSegment.findUnique({ where: { id: segmentId } });
|
||
if (!segment) return;
|
||
|
||
await prisma.candidateSegment.deleteMany({ where: { rawSegmentId: segmentId } });
|
||
await prisma.rawSegment.delete({ where: { id: segmentId } });
|
||
await unlink(segment.filePath).catch(() => {});
|
||
|
||
revalidatePath("/segments");
|
||
revalidatePath("/", "layout");
|
||
}
|
||
|
||
export async function deleteCandidateSegment(candidateId: string) {
|
||
await prisma.candidateSegment.delete({ where: { id: candidateId } });
|
||
|
||
revalidatePath("/segments");
|
||
revalidatePath("/", "layout");
|
||
}
|