Skip to content

Commit

Permalink
feat: Extend rerender offline prompt (in03#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
in03 authored Oct 14, 2022
1 parent c5e84be commit 0407b58
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 18 deletions.
55 changes: 38 additions & 17 deletions proxima/queuer/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,34 +360,55 @@ def handle_offline_proxies(media_list: list) -> list:

logger.warning(f"[yellow]Offline proxies: {len(offline_proxies)}[/]")

for offline_proxy in offline_proxies:
choices = ["rerender", "skip", "choose"]
choice = Prompt.ask(
f"\n[yellow]{len(offline_proxies)} proxies are offline.[/]\n"
f"You can choose to rerender them all, skip them all, or choose individually.\n"
"[cyan]What would you like to do?",
choices=choices,
default="rerender",
)

answer = Prompt.ask(
f"\n[yellow][bold]'{offline_proxy['file_name']}' is offline.\n"
f"[/yellow][/bold]Last path was '{offline_proxy['proxy_media_path']}'\n"
"[yellow]Would you like to re-render it?[/] [magenta][Y/N or All)]"
)
assert choice in choices
print()

if answer.lower().startswith("y"):
pprint(f"[yellow]Queuing '{offline_proxy['file_name']}' for re-render")
if choice == "Rerender":
return media_list

for x in media_list:
if x["file_path"] == offline_proxy["file_path"]:
x["proxy_status"] = "None"
if choice == "Skip":
return [x for x in media_list if x["proxy_status"] != "Offline"]

elif answer.lower().startswith("a"):
new_list = []
for offline_proxy in offline_proxies:

confirm = Confirm.ask(
f"[yellow bold]Offline media:[/] [green]'{offline_proxy['file_name']}'[/] - "
f"[yellow bold]last path: [/][green]'{offline_proxy['proxy_media_path']}'[/]\n"
f"[cyan]Would you like to rerender it?"
)

pprint(
f"[yellow]Queuing {len(offline_proxies)} offline proxies for re-render"
if confirm:
pprint(f"[green]Queuing '{offline_proxy['file_name']}' for re-render")

new_list.extend(
[
x
for x in media_list
if x["file_path"] == offline_proxy["file_path"]
]
)

for x in media_list:
if x == "Offline":
x["proxy_status"] = "None"
else:
pprint(f"[yellow]Skipping '{offline_proxy['file_name']}'...")

print()

global SOME_ACTION_TAKEN
SOME_ACTION_TAKEN = True

if new_list:
return new_list

return media_list


Expand Down
2 changes: 1 addition & 1 deletion version_constraint_key
Original file line number Diff line number Diff line change
@@ -1 +1 @@
officially-open-owl
reasonably-relaxed-rattler

0 comments on commit 0407b58

Please sign in to comment.