// Video üretimi — app'in GERÇEK kodu → ComfyUI → mp4. import 'dart:convert'; import 'dart:io'; import '../lib/comfy/workflow/video_workflow.dart'; Future main() async { const base = 'http://127.0.0.1:8188'; final http = HttpClient(); final p = VideoParametreleri( prompt: 'a serene tropical beach at sunset, gentle waves, cinematic, smooth camera push in', seed: 7, genislik: 512, yukseklik: 320, uzunluk: 49, fps: 24, steps: 20, ); final wf = videoWorkflowOlustur(p); stdout.writeln('i2v: ${p.i2vMi}, CLIPLoader type: ${wf['11']['inputs']['type']}'); Future> post(String y, Map g) async { final i = await http.postUrl(Uri.parse('$base$y')); i.headers.contentType = ContentType.json; i.write(jsonEncode(g)); final c = await i.close(); return jsonDecode(await c.transform(utf8.decoder).join()) as Map; } Future> get(String y) async { final i = await http.getUrl(Uri.parse('$base$y')); final c = await i.close(); return jsonDecode(await c.transform(utf8.decoder).join()) as Map; } final r = await post('/prompt', {'prompt': wf, 'client_id': 'fikoyt-e2evid'}); if (r['error'] != null) { stdout.writeln('RED: ${jsonEncode(r['error'])}'); exit(1); } final pid = r['prompt_id'] as String; stdout.writeln('prompt_id: $pid'); for (var i = 0; i < 100; i++) { await Future.delayed(const Duration(seconds: 5)); final h = await get('/history/$pid'); final k = h[pid] as Map?; if (k == null) continue; final st = k['status'] as Map?; if (st?['status_str'] == 'error') { stdout.writeln('HATA: ${jsonEncode(st)}'); exit(1); } if (st?['completed'] == true) { stdout.writeln('BASARILI: ${jsonEncode(k['outputs'])}'); exit(0); } } stdout.writeln('ZAMAN ASIMI'); exit(1); }