Spaces:
Sleeping
Sleeping
Update main.py
Browse files
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": "
|
| 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 = {"
|
| 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: " +
|
| 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 |
-
[("
|
| 518 |
-
[("
|
| 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 |
-
|
| 794 |
-
|
| 795 |
-
|
| 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:"):
|