CineMax commited on
Commit
f79dd6b
Β·
verified Β·
1 Parent(s): 37643a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +123 -68
app.py CHANGED
@@ -131,6 +131,25 @@ def get_filename_from_url(url):
131
  pass
132
  return "video"
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  def log_generator(message, log_list):
135
  log_list.append(message)
136
  return "\n".join(log_list), log_list
@@ -210,17 +229,10 @@ def create_master_m3u8(output_dir, video_streams, audio_playlists):
210
  with open(output_dir / "master.m3u8", "w") as f:
211
  f.write(master_content)
212
 
213
-
214
  def clone_m3u8_with_same_segments(source_m3u8: Path, dest_m3u8: Path):
215
- """
216
- Crea un nuevo .m3u8 que apunta exactamente a los mismos segmentos .ts
217
- que el m3u8 original, sin copiar ni mover ningΓΊn archivo .ts.
218
- Solo se reescribe el manifiesto con el nuevo nombre de archivo de destino.
219
- """
220
  content = source_m3u8.read_text()
221
  dest_m3u8.write_text(content)
222
 
223
-
224
  def process_audio_track_parallel(args):
225
  track, i, total, source_val, output_dir, is_copy_mode, ffmpeg_input_args = args
226
  try:
@@ -287,6 +299,7 @@ def process_audio_track_parallel(args):
287
 
288
  def process_bulk(
289
  token, input_file, input_urls, conversion_option, stream_format, batch_size_vid, delete_local, max_workers,
 
290
  progress=gr.Progress()
291
  ):
292
  logs = [f"πŸš€ Iniciando EXTREME v4.4-FIX (CPU: {OPTIMAL_THREADS} threads, RAM Disk: {RAMDISK_PATH})"]
@@ -319,16 +332,23 @@ def process_bulk(
319
  for idx, source in enumerate(sources):
320
  is_file = source['type'] == 'file'
321
  source_val = source['value']
 
 
 
 
322
 
323
- msg, logs = log_generator(f"πŸ“¦ Procesando {idx+1}/{total_sources}: {os.path.basename(source_val) if is_file else source_val}", logs)
324
  yield msg, logs, ""
325
 
326
  if is_file:
327
  msg, logs = log_generator(" πŸ“ Tipo: Archivo local", logs)
 
328
  elif is_live_stream(source_val):
329
  msg, logs = log_generator(" πŸ“‘ Tipo: Stream en vivo detectado", logs)
 
330
  else:
331
  msg, logs = log_generator(" 🌐 Tipo: Archivo estΓ‘tico vΓ­a HTTP (procesando COMPLETO)", logs)
 
332
  yield msg, logs, ""
333
 
334
  ffmpeg_input_args = get_input_args(source_val)
@@ -341,20 +361,11 @@ def process_bulk(
341
  hours = int(duration // 3600)
342
  minutes = int((duration % 3600) // 60)
343
  seconds = int(duration % 60)
344
- msg, logs = log_generator(f" βœ… DuraciΓ³n TOTAL detectada: {hours:02d}:{minutes:02d}:{seconds:02d}", logs)
345
  else:
346
- msg, logs = log_generator(" ⚠️ No se pudo detectar duración (puede ser stream en vivo)", logs)
347
  yield msg, logs, ""
348
 
349
- if is_file:
350
- base_name = Path(source_val).stem
351
- base_dir = Path(source_val).parent
352
- else:
353
- base_name = get_filename_from_url(source_val)
354
- base_dir = Path.cwd()
355
-
356
- folder_name = clean_for_folder(base_name) + f"_{stream_format.lower()}"
357
- repo_name = clean_for_repo(base_name)
358
  output_dir = base_dir / folder_name
359
  output_dir.mkdir(exist_ok=True)
360
 
@@ -405,7 +416,6 @@ def process_bulk(
405
 
406
  video_streams = []
407
 
408
- # ── COPY MODE ────────────────────────────────────────────────
409
  if conversion_option in ["OpciΓ³n 1: Copy Video + Copy Audio", "OpciΓ³n 2: Copy Video + MP3 Audio"]:
410
  msg, logs = log_generator("⚑ COPY Video COMPLETO en RAM (ULTRA RÁPIDO)...", logs)
411
  yield msg, logs, ""
@@ -415,7 +425,6 @@ def process_bulk(
415
 
416
  video_file_1080 = temp_video_dir / "video_1080p.m3u8"
417
  seg_video_1080 = temp_video_dir / "video_1080p_%03d.ts"
418
-
419
  copy_args = get_copy_optimization_args()
420
 
421
  cmd_video = [
@@ -444,26 +453,21 @@ def process_bulk(
444
  shutil.rmtree(temp_video_dir, ignore_errors=True)
445
  raise Exception(f"FFmpeg copy fallΓ³: {result.stderr[-500:]}")
446
 
447
- # Mover 1080p de RAM a output_dir
448
  final_1080 = output_dir / "video_1080p.m3u8"
449
  shutil.move(str(video_file_1080), str(final_1080))
450
  for ts_file in temp_video_dir.glob("video_1080p_*.ts"):
451
  shutil.move(str(ts_file), str(output_dir / ts_file.name))
452
  shutil.rmtree(temp_video_dir, ignore_errors=True)
453
 
454
- # ── 720p: mismo .m3u8, mismos segmentos, cero bytes extra ──
455
- # Solo copiamos el manifiesto apuntando a los mismos .ts del 1080p.
456
- # No se duplica ningΓΊn segmento de video.
457
  video_file_720 = output_dir / "video_720p.m3u8"
458
  clone_m3u8_with_same_segments(final_1080, video_file_720)
459
 
460
- msg, logs = log_generator("βœ… Video COPY COMPLETO β€” 720p reutiliza segmentos del 1080p (sin duplicar)", logs)
461
  yield msg, logs, ""
462
 
463
  video_streams.append({'file': 'video_1080p.m3u8', 'resolution': '1920x1080', 'bandwidth': 5000000, 'codecs': 'avc1.640028'})
464
  video_streams.append({'file': 'video_720p.m3u8', 'resolution': '1280x720', 'bandwidth': 3000000, 'codecs': 'avc1.640028'})
465
 
466
- # ── RENDER MODE ──────────────────────────────────────────────
467
  elif conversion_option in ["OpciΓ³n 3: Multi-Res (1080p + 720p) H.264", "OpciΓ³n 4: Multi-Res (4K + 1080p + 720p) H.264"]:
468
  if conversion_option == "OpciΓ³n 3: Multi-Res (1080p + 720p) H.264":
469
  resolutions = [
@@ -477,7 +481,7 @@ def process_bulk(
477
  {'label': '720p', 'scale': 'scale=-2:720', 'bitrate': '2800k', 'bufsize': '5600k', 'res': '1280x720'}
478
  ]
479
 
480
- msg, logs = log_generator(f"🎬 Renderizando {len(resolutions)} resoluciones COMPLETAS EN PARALELO (RAM)...", logs)
481
  yield msg, logs, ""
482
 
483
  for res_config in resolutions:
@@ -536,7 +540,7 @@ def process_bulk(
536
  'bandwidth': int(res_config['bitrate'].replace('k', '000')) + 192000,
537
  'codecs': 'avc1.640028'
538
  })
539
- msg, logs = log_generator(f" βœ… {res_config['label']} COMPLETO OK", logs)
540
  yield msg, logs, ""
541
 
542
  if not video_streams:
@@ -618,7 +622,7 @@ def process_bulk(
618
  manifest_file = "manifest.mpd"
619
 
620
  # ── SUBIR A GITHUB ───────────────────────────────────────────────
621
- msg, logs = log_generator("☁️ Subiendo a GitHub...", logs)
622
  yield msg, logs, ""
623
 
624
  url_api = "https://api.github.com/user/repos"
@@ -652,10 +656,7 @@ def process_bulk(
652
  manifest_files = [f for f in files if f.endswith('.m3u8')]
653
 
654
  subprocess.run(['git', 'add'] + manifest_files, cwd=git_dir, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
655
- subprocess.run(['git', 'commit', '-m', 'Add manifests'], cwd=git_dir, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
656
-
657
- msg, logs = log_generator(" πŸ“€ Push inicial...", logs)
658
- yield msg, logs, ""
659
 
660
  retry_count = 0
661
  while retry_count < 3:
@@ -702,9 +703,9 @@ def process_bulk(
702
 
703
  gooplay_link = f'https://gooplay.xyz/gp/stream.php?repo={repo_name}&branch=main&file={manifest_file}'
704
  github_link = f'{html_url}/blob/main/{manifest_file}'
705
- final_links.append(f"**{base_name}**\nπŸ”— Gooplay: {gooplay_link}\nπŸ“‚ GitHub: {github_link}")
706
 
707
- msg, logs = log_generator(f"βœ… Completado: {base_name}", logs)
708
  yield msg, logs, ""
709
 
710
  if delete_local:
@@ -722,18 +723,21 @@ def process_bulk(
722
  yield "\n".join(error_log), error_log, ""
723
 
724
 
725
- # --- Interfaz Gradio ---
 
 
726
 
727
- with gr.Blocks() as demo:
728
- gr.Markdown("# ⚑ HLS/DASH Converter EXTREME v4.4-FIX")
729
  gr.Markdown(f"**CPU: {OPTIMAL_THREADS} threads | RAM Disk: {RAMDISK_PATH}**")
730
 
731
  with gr.Row():
 
732
  with gr.Column(scale=1):
733
  gr.Markdown("### βš™οΈ ConfiguraciΓ³n")
734
  token = gr.Textbox(label="GitHub Token", type="password", placeholder="ghp_...")
735
  input_file = gr.File(label="Archivos", file_count="multiple")
736
- input_urls = gr.Textbox(label="URLs (lΓ­nea por lΓ­nea)", lines=3)
737
  conversion_option = gr.Dropdown(
738
  [
739
  "OpciΓ³n 1: Copy Video + Copy Audio",
@@ -742,45 +746,96 @@ with gr.Blocks() as demo:
742
  "OpciΓ³n 4: Multi-Res (4K + 1080p + 720p) H.264"
743
  ],
744
  value="OpciΓ³n 1: Copy Video + Copy Audio",
745
- label="Modo"
 
 
 
 
 
746
  )
747
- stream_format = gr.Dropdown(["HLS (M3U8)", "DASH (MPD)"], value="HLS (M3U8)", label="Formato")
748
  with gr.Row():
749
  batch_vid = gr.Number(value=30, label="Batch Git", precision=0)
750
  max_workers = gr.Slider(1, 8, 4, step=1, label="Workers Audio")
751
- delete_local = gr.Checkbox(value=True, label="Borrar local")
752
- btn = gr.Button("πŸš€ PROCESAR (99% CPU+RAM)", variant="primary", size="lg")
753
-
754
- with gr.Column(scale=2):
755
- log_output = gr.Textbox(label="Logs", lines=25, interactive=False)
756
- final_links = gr.Textbox(label="Links", lines=8, interactive=False)
757
-
758
- gr.Markdown(f"""
759
- ---
760
- ### πŸ”₯ v4.4-FIX - PROCESAMIENTO COMPLETO GARANTIZADO
761
 
762
- **720p en Copy Mode:** reutiliza exactamente los mismos segmentos `.ts` del 1080p.
763
- Solo se genera un `video_720p.m3u8` adicional (texto, ~1 KB) sin duplicar datos.
 
764
 
765
- **PROBLEMA RESUELTO:**
766
- ❌ Videos HTTP truncados (solo 30min de 1h, etc.)
 
 
 
767
 
768
- **SOLUCIONES v4.4:**
769
- βœ… ELIMINADO `-ss 0` de TODOS los comandos FFmpeg
770
- βœ… ELIMINADO `-seekable 0`
771
- βœ… Aumentado `-analyzeduration` a 200M (HTTP estΓ‘ticos)
772
- βœ… Aumentado timeouts: 7200s video, 14400s render
773
- βœ… Probe sin -ss para detectar duraciΓ³n real
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
 
775
- ### ⚑ OPTIMIZACIONES
776
- - **RAM Disk:** /dev/shm (tmpfs) - 100-1000x mΓ‘s rΓ‘pido
777
- - **CPU:** {OPTIMAL_THREADS} threads simultΓ‘neos
778
- - **COPY 720p:** solo un `.m3u8` extra, cero bytes de segmentos duplicados
 
 
 
 
 
 
 
 
 
 
 
 
779
  """)
780
-
781
  btn.click(
782
  fn=process_bulk,
783
- inputs=[token, input_file, input_urls, conversion_option, stream_format, batch_vid, delete_local, max_workers],
 
 
 
 
 
784
  outputs=[log_output, gr.State(), final_links]
785
  )
786
 
 
131
  pass
132
  return "video"
133
 
134
+ def build_name(content_type, movie_name, serie_name, season, ep_start, ep_index):
135
+ """Construye el nombre del repo/folder segΓΊn el tipo de contenido."""
136
+ if content_type == "🎬 Película":
137
+ base = movie_name.strip() if movie_name.strip() else "Pelicula"
138
+ return clean_for_folder(base), clean_for_repo(base)
139
+ else:
140
+ # Serie
141
+ name = serie_name.strip() if serie_name.strip() else "Serie"
142
+ try:
143
+ temp = int(season)
144
+ except:
145
+ temp = 1
146
+ try:
147
+ ep_num = int(ep_start) + ep_index
148
+ except:
149
+ ep_num = ep_index + 1
150
+ label = f"{name}_Temporada{temp}_Ep{ep_num}"
151
+ return clean_for_folder(label), clean_for_repo(label)
152
+
153
  def log_generator(message, log_list):
154
  log_list.append(message)
155
  return "\n".join(log_list), log_list
 
229
  with open(output_dir / "master.m3u8", "w") as f:
230
  f.write(master_content)
231
 
 
232
  def clone_m3u8_with_same_segments(source_m3u8: Path, dest_m3u8: Path):
 
 
 
 
 
233
  content = source_m3u8.read_text()
234
  dest_m3u8.write_text(content)
235
 
 
236
  def process_audio_track_parallel(args):
237
  track, i, total, source_val, output_dir, is_copy_mode, ffmpeg_input_args = args
238
  try:
 
299
 
300
  def process_bulk(
301
  token, input_file, input_urls, conversion_option, stream_format, batch_size_vid, delete_local, max_workers,
302
+ content_type, movie_name, serie_name, season, ep_start,
303
  progress=gr.Progress()
304
  ):
305
  logs = [f"πŸš€ Iniciando EXTREME v4.4-FIX (CPU: {OPTIMAL_THREADS} threads, RAM Disk: {RAMDISK_PATH})"]
 
332
  for idx, source in enumerate(sources):
333
  is_file = source['type'] == 'file'
334
  source_val = source['value']
335
+
336
+ # ── Nombre personalizado ──────────────────────────────────────────
337
+ folder_name, repo_name = build_name(content_type, movie_name, serie_name, season, ep_start, idx)
338
+ display_name = folder_name
339
 
340
+ msg, logs = log_generator(f"πŸ“¦ [{idx+1}/{total_sources}] {display_name}", logs)
341
  yield msg, logs, ""
342
 
343
  if is_file:
344
  msg, logs = log_generator(" πŸ“ Tipo: Archivo local", logs)
345
+ base_dir = Path(source_val).parent
346
  elif is_live_stream(source_val):
347
  msg, logs = log_generator(" πŸ“‘ Tipo: Stream en vivo detectado", logs)
348
+ base_dir = Path.cwd()
349
  else:
350
  msg, logs = log_generator(" 🌐 Tipo: Archivo estΓ‘tico vΓ­a HTTP (procesando COMPLETO)", logs)
351
+ base_dir = Path.cwd()
352
  yield msg, logs, ""
353
 
354
  ffmpeg_input_args = get_input_args(source_val)
 
361
  hours = int(duration // 3600)
362
  minutes = int((duration % 3600) // 60)
363
  seconds = int(duration % 60)
364
+ msg, logs = log_generator(f" βœ… DuraciΓ³n TOTAL: {hours:02d}:{minutes:02d}:{seconds:02d}", logs)
365
  else:
366
+ msg, logs = log_generator(" ⚠️ No se pudo detectar duración", logs)
367
  yield msg, logs, ""
368
 
 
 
 
 
 
 
 
 
 
369
  output_dir = base_dir / folder_name
370
  output_dir.mkdir(exist_ok=True)
371
 
 
416
 
417
  video_streams = []
418
 
 
419
  if conversion_option in ["OpciΓ³n 1: Copy Video + Copy Audio", "OpciΓ³n 2: Copy Video + MP3 Audio"]:
420
  msg, logs = log_generator("⚑ COPY Video COMPLETO en RAM (ULTRA RÁPIDO)...", logs)
421
  yield msg, logs, ""
 
425
 
426
  video_file_1080 = temp_video_dir / "video_1080p.m3u8"
427
  seg_video_1080 = temp_video_dir / "video_1080p_%03d.ts"
 
428
  copy_args = get_copy_optimization_args()
429
 
430
  cmd_video = [
 
453
  shutil.rmtree(temp_video_dir, ignore_errors=True)
454
  raise Exception(f"FFmpeg copy fallΓ³: {result.stderr[-500:]}")
455
 
 
456
  final_1080 = output_dir / "video_1080p.m3u8"
457
  shutil.move(str(video_file_1080), str(final_1080))
458
  for ts_file in temp_video_dir.glob("video_1080p_*.ts"):
459
  shutil.move(str(ts_file), str(output_dir / ts_file.name))
460
  shutil.rmtree(temp_video_dir, ignore_errors=True)
461
 
 
 
 
462
  video_file_720 = output_dir / "video_720p.m3u8"
463
  clone_m3u8_with_same_segments(final_1080, video_file_720)
464
 
465
+ msg, logs = log_generator("βœ… Video COPY COMPLETO β€” 720p reutiliza segmentos del 1080p", logs)
466
  yield msg, logs, ""
467
 
468
  video_streams.append({'file': 'video_1080p.m3u8', 'resolution': '1920x1080', 'bandwidth': 5000000, 'codecs': 'avc1.640028'})
469
  video_streams.append({'file': 'video_720p.m3u8', 'resolution': '1280x720', 'bandwidth': 3000000, 'codecs': 'avc1.640028'})
470
 
 
471
  elif conversion_option in ["OpciΓ³n 3: Multi-Res (1080p + 720p) H.264", "OpciΓ³n 4: Multi-Res (4K + 1080p + 720p) H.264"]:
472
  if conversion_option == "OpciΓ³n 3: Multi-Res (1080p + 720p) H.264":
473
  resolutions = [
 
481
  {'label': '720p', 'scale': 'scale=-2:720', 'bitrate': '2800k', 'bufsize': '5600k', 'res': '1280x720'}
482
  ]
483
 
484
+ msg, logs = log_generator(f"🎬 Renderizando {len(resolutions)} resoluciones...", logs)
485
  yield msg, logs, ""
486
 
487
  for res_config in resolutions:
 
540
  'bandwidth': int(res_config['bitrate'].replace('k', '000')) + 192000,
541
  'codecs': 'avc1.640028'
542
  })
543
+ msg, logs = log_generator(f" βœ… {res_config['label']} OK", logs)
544
  yield msg, logs, ""
545
 
546
  if not video_streams:
 
622
  manifest_file = "manifest.mpd"
623
 
624
  # ── SUBIR A GITHUB ───────────────────────────────────────────────
625
+ msg, logs = log_generator(f"☁️ Subiendo a GitHub como: {repo_name}", logs)
626
  yield msg, logs, ""
627
 
628
  url_api = "https://api.github.com/user/repos"
 
656
  manifest_files = [f for f in files if f.endswith('.m3u8')]
657
 
658
  subprocess.run(['git', 'add'] + manifest_files, cwd=git_dir, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
659
+ subprocess.run(['git', 'commit', '-m', f'Add {display_name}'], cwd=git_dir, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
 
 
 
660
 
661
  retry_count = 0
662
  while retry_count < 3:
 
703
 
704
  gooplay_link = f'https://gooplay.xyz/gp/stream.php?repo={repo_name}&branch=main&file={manifest_file}'
705
  github_link = f'{html_url}/blob/main/{manifest_file}'
706
+ final_links.append(f"**{display_name}**\nπŸ”— Gooplay: {gooplay_link}\nπŸ“‚ GitHub: {github_link}")
707
 
708
+ msg, logs = log_generator(f"βœ… Completado: {display_name}", logs)
709
  yield msg, logs, ""
710
 
711
  if delete_local:
 
723
  yield "\n".join(error_log), error_log, ""
724
 
725
 
726
+ # ─────────────────────────────────────────────────────────────────────────────
727
+ # INTERFAZ GRADIO
728
+ # ─────────────────────────────────────────────────────────────────────────────
729
 
730
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
731
+ gr.Markdown("# ⚑ HLS/DASH Converter EXTREME v4.5")
732
  gr.Markdown(f"**CPU: {OPTIMAL_THREADS} threads | RAM Disk: {RAMDISK_PATH}**")
733
 
734
  with gr.Row():
735
+ # ── Columna izquierda: configuraciΓ³n ─────────────────────────────────
736
  with gr.Column(scale=1):
737
  gr.Markdown("### βš™οΈ ConfiguraciΓ³n")
738
  token = gr.Textbox(label="GitHub Token", type="password", placeholder="ghp_...")
739
  input_file = gr.File(label="Archivos", file_count="multiple")
740
+ input_urls = gr.Textbox(label="URLs (una por lΓ­nea)", lines=4)
741
  conversion_option = gr.Dropdown(
742
  [
743
  "OpciΓ³n 1: Copy Video + Copy Audio",
 
746
  "OpciΓ³n 4: Multi-Res (4K + 1080p + 720p) H.264"
747
  ],
748
  value="OpciΓ³n 1: Copy Video + Copy Audio",
749
+ label="Modo de conversiΓ³n"
750
+ )
751
+ stream_format = gr.Dropdown(
752
+ ["HLS (M3U8)", "DASH (MPD)"],
753
+ value="HLS (M3U8)",
754
+ label="Formato de salida"
755
  )
 
756
  with gr.Row():
757
  batch_vid = gr.Number(value=30, label="Batch Git", precision=0)
758
  max_workers = gr.Slider(1, 8, 4, step=1, label="Workers Audio")
759
+ delete_local = gr.Checkbox(value=True, label="Borrar archivos locales al terminar")
 
 
 
 
 
 
 
 
 
760
 
761
+ # ── SecciΓ³n de nombre ─────────────────────────────────────────────
762
+ gr.Markdown("---")
763
+ gr.Markdown("### 🎬 Nombre del contenido")
764
 
765
+ content_type = gr.Radio(
766
+ choices=["🎬 PelΓ­cula", "πŸ“Ί Serie"],
767
+ value="🎬 Película",
768
+ label="Tipo de contenido"
769
+ )
770
 
771
+ # PelΓ­cula
772
+ with gr.Group(visible=True) as movie_group:
773
+ movie_name = gr.Textbox(
774
+ label="Nombre de la pelΓ­cula",
775
+ placeholder="Ej: El Padrino"
776
+ )
777
+
778
+ # Serie
779
+ with gr.Group(visible=False) as serie_group:
780
+ serie_name = gr.Textbox(
781
+ label="Nombre de la serie",
782
+ placeholder="Ej: Breaking Bad"
783
+ )
784
+ with gr.Row():
785
+ season = gr.Number(
786
+ label="Temporada",
787
+ value=1,
788
+ precision=0,
789
+ minimum=1
790
+ )
791
+ ep_start = gr.Number(
792
+ label="Episodio inicial (1ra URL = este nΓΊmero)",
793
+ value=1,
794
+ precision=0,
795
+ minimum=1
796
+ )
797
+ gr.Markdown(
798
+ "πŸ’‘ *Si pones episodio inicial = 3 y tienes 4 URLs, "
799
+ "se nombrarΓ‘n Ep3, Ep4, Ep5, Ep6 automΓ‘ticamente.*"
800
+ )
801
+
802
+ # Mostrar/ocultar grupos segΓΊn selecciΓ³n
803
+ def toggle_content_type(choice):
804
+ is_serie = choice == "πŸ“Ί Serie"
805
+ return gr.update(visible=not is_serie), gr.update(visible=is_serie)
806
+
807
+ content_type.change(
808
+ fn=toggle_content_type,
809
+ inputs=content_type,
810
+ outputs=[movie_group, serie_group]
811
+ )
812
 
813
+ btn = gr.Button("πŸš€ PROCESAR", variant="primary", size="lg")
814
+
815
+ # ── Columna derecha: logs y resultado ─────────────────────────────────
816
+ with gr.Column(scale=2):
817
+ log_output = gr.Textbox(label="Logs en tiempo real", lines=28, interactive=False)
818
+ final_links = gr.Textbox(label="πŸ”— Links generados", lines=10, interactive=False)
819
+
820
+ gr.Markdown(f"""
821
+ ---
822
+ ### πŸ“‹ Ejemplos de nombres generados
823
+ | Tipo | Config | Resultado |
824
+ |------|--------|-----------|
825
+ | PelΓ­cula | "El Padrino" | `El-Padrino` |
826
+ | Serie | "Breaking Bad", T2, Ep inicio 5, URL1 | `Breaking-Bad_Temporada2_Ep5` |
827
+ | Serie | "Breaking Bad", T2, Ep inicio 5, URL2 | `Breaking-Bad_Temporada2_Ep6` |
828
+ | Serie | "Breaking Bad", T2, Ep inicio 5, URL3 | `Breaking-Bad_Temporada2_Ep7` |
829
  """)
830
+
831
  btn.click(
832
  fn=process_bulk,
833
+ inputs=[
834
+ token, input_file, input_urls,
835
+ conversion_option, stream_format,
836
+ batch_vid, delete_local, max_workers,
837
+ content_type, movie_name, serie_name, season, ep_start
838
+ ],
839
  outputs=[log_output, gr.State(), final_links]
840
  )
841