AstraOS commited on
Commit
580f77e
Β·
verified Β·
1 Parent(s): d7b0da7

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +13 -14
main.py CHANGED
@@ -205,7 +205,7 @@ DEFAULT_DVD_SETTINGS = {
205
  "eq_saturation": 1.08,
206
  "eq_gamma": 0.95,
207
  # Background fill
208
- "bg_fill_mode": "blur", # blur | black | color
209
  "blur_radius": 15,
210
  "bg_brightness": -0.2,
211
  "bg_saturation": 0.6,
@@ -365,7 +365,7 @@ def settings_summary(s: dict) -> str:
365
  profile_label = PROFILES.get(s["profile"], {}).get("label", s["profile"])
366
  fps_display = "29.97" if "30000" in str(s["fps"]) else (
367
  "25" if s["fps"] == "25/1" else str(s["fps"]))
368
- fill_icons = {"blur": "🌫", "black": "⬛", "color": "🎨"}
369
  fill_icon = fill_icons.get(s["bg_fill_mode"], "🌫")
370
  return (
371
  f"πŸ“€ **DVD Converter Settings**\n"
@@ -451,7 +451,7 @@ def settings_keyboard(s: dict) -> dict:
451
  [("πŸ“ Resolution", "set:res_menu"), ("🎞 FPS", "set:fps_menu")],
452
  [("πŸ“‘ Bitrate: " + str(s["max_kbps"]) + "k", "set:bitrate_menu")],
453
  [("πŸ”Š Audio", "set:audio_menu")],
454
- [("πŸŽ› BG Fill: " + fill_label, "set:bg_menu")],
455
  [("🎚 Denoise: " + ("OFF" if s["no_denoise"] else "ON"), "set:toggle_denoise"),
456
  ("✨ Deflicker: " + ("OFF" if s["no_deflicker"] else "ON"), "set:toggle_deflicker")],
457
  [("πŸ”† Sharpen: " + ("OFF" if s["no_sharpen"] else "ON"), "set:toggle_sharpen")],
@@ -512,10 +512,12 @@ def audio_keyboard(s: dict) -> dict:
512
  [("↩️ Back", "dvd:settings")],
513
  ])
514
 
515
- def bg_fill_keyboard() -> dict:
 
 
516
  return ikb([
517
- [("🌫 Blur (default)", "set:bg:blur")],
518
- [("⬛ Black bars", "set:bg:black")],
519
  [("↩️ Back", "dvd:settings")],
520
  ])
521
 
@@ -789,13 +791,10 @@ def build_cfg_from_settings(s: dict, input_path: str, work_dir: str, out_dir: st
789
  cfg.eq_gamma_g = 1.0
790
  cfg.eq_gamma_b = 1.0
791
 
792
- # Background fill
793
- if s["bg_fill_mode"] == "black":
794
- cfg.bg_brightness = -1.0
795
- cfg.bg_saturation = 0.0
796
- else: # blur
797
- cfg.bg_brightness = s["bg_brightness"]
798
- cfg.bg_saturation = s["bg_saturation"]
799
  cfg.bg_contrast = 1.0
800
  cfg.bg_gamma = 1.0
801
  cfg.blur_radius = s["blur_radius"]
@@ -1315,7 +1314,7 @@ async def handle_callback(query: dict) -> dict:
1315
  "πŸŽ› **Background Fill Mode**\n\n"
1316
  "When video doesn't match target resolution,\n"
1317
  "the background is filled with:",
1318
- bg_fill_keyboard()
1319
  )
1320
 
1321
  if data.startswith("set:bg:"):
 
205
  "eq_saturation": 1.08,
206
  "eq_gamma": 0.95,
207
  # Background fill
208
+ "bg_fill_mode": "letterbox", # letterbox | blur
209
  "blur_radius": 15,
210
  "bg_brightness": -0.2,
211
  "bg_saturation": 0.6,
 
365
  profile_label = PROFILES.get(s["profile"], {}).get("label", s["profile"])
366
  fps_display = "29.97" if "30000" in str(s["fps"]) else (
367
  "25" if s["fps"] == "25/1" else str(s["fps"]))
368
+ fill_icons = {"letterbox": "⬛", "blur": "🌫"}
369
  fill_icon = fill_icons.get(s["bg_fill_mode"], "🌫")
370
  return (
371
  f"πŸ“€ **DVD Converter Settings**\n"
 
451
  [("πŸ“ Resolution", "set:res_menu"), ("🎞 FPS", "set:fps_menu")],
452
  [("πŸ“‘ Bitrate: " + str(s["max_kbps"]) + "k", "set:bitrate_menu")],
453
  [("πŸ”Š Audio", "set:audio_menu")],
454
+ [("πŸŽ› BG Fill: " + ("Letterbox" if s["bg_fill_mode"] != "blur" else "Blur"), "set:bg_menu")],
455
  [("🎚 Denoise: " + ("OFF" if s["no_denoise"] else "ON"), "set:toggle_denoise"),
456
  ("✨ Deflicker: " + ("OFF" if s["no_deflicker"] else "ON"), "set:toggle_deflicker")],
457
  [("πŸ”† Sharpen: " + ("OFF" if s["no_sharpen"] else "ON"), "set:toggle_sharpen")],
 
512
  [("↩️ Back", "dvd:settings")],
513
  ])
514
 
515
+ def bg_fill_keyboard(s: dict) -> dict:
516
+ blur_tick = " βœ…" if s.get("bg_fill_mode") == "blur" else ""
517
+ lbox_tick = " βœ…" if s.get("bg_fill_mode", "letterbox") != "blur" else ""
518
  return ikb([
519
+ [(f"⬛ Letterbox β€” black bars{lbox_tick}", "set:bg:letterbox")],
520
+ [(f"🌫 Blur background{blur_tick}", "set:bg:blur")],
521
  [("↩️ Back", "dvd:settings")],
522
  ])
523
 
 
791
  cfg.eq_gamma_g = 1.0
792
  cfg.eq_gamma_b = 1.0
793
 
794
+ # Background fill β€” pass mode + blur params through; dvd_converter branches on bg_fill_mode
795
+ cfg.bg_fill_mode = s.get("bg_fill_mode", "letterbox")
796
+ cfg.bg_brightness = s["bg_brightness"]
797
+ cfg.bg_saturation = s["bg_saturation"]
 
 
 
798
  cfg.bg_contrast = 1.0
799
  cfg.bg_gamma = 1.0
800
  cfg.blur_radius = s["blur_radius"]
 
1314
  "πŸŽ› **Background Fill Mode**\n\n"
1315
  "When video doesn't match target resolution,\n"
1316
  "the background is filled with:",
1317
+ bg_fill_keyboard(s)
1318
  )
1319
 
1320
  if data.startswith("set:bg:"):