return data
def remove_healthy(self):
"""Remove linked and online source media, i.e. \"healthy\" """
self.batch = [x for x in self.batch if not x.is_linked or x.is_offline]
def handle_existing_unlinked(self):
"""
Prompts to link or re-render existing but unlinked media.
"""
logger.info("[cyan]Checking for existing, unlinked media...")
existing_unlinked, mismatch_fail, link_success = [], [], []
if not self.batch:
raise ValueError("No batch to handle!")
existing_unlinked = [
x for x in self.batch if not x.is_linked and x.newest_linkable_proxy
]
# Exit early if none
if not len(existing_unlinked) > 0:
logger.debug("[magenta]No existing unlinked media detected.")
return
# 'Online' handled media so the offline handler doesn't catch it
for x in self.batch:
if x in existing_unlinked:
x.is_offline = False
# Log with abbreviated file paths
for x in existing_unlinked:
logger.debug(
f"[magenta] * Existing unlinked - '{x.source.file_name}' <-> {(core.shorten_long_path(x.newest_linkable_proxy))}"
)
# Prompt user to relink or rerender
if not Confirm.ask(
f"\n[yellow][bold]{len(existing_unlinked)} source files have existing but unlinked proxy media.\n"
"[/bold]Would you like to link them? If not they will be re-rendered."
):
# Mark all as requeued and carry on
self.existing_link_requeued_count = len(existing_unlinked)
if settings.proxy.overwrite:
logger.debug("[magenta] * Existing proxies set to be overwritten")
# TODO: Implement overwrite logic
# also need to test for oplock issues"
return
# Handle linking
from rich.progress import track
for job in track(
existing_unlinked, description="[cyan]Linking...", transient=True
):
if not job.newest_linkable_proxy:
continue
try:
job.link_proxy(job.newest_linkable_proxy)
except exceptions.ResolveLinkMismatchError:
mismatch_fail.append(job)
logger.error(
f"[red]Failed to link '{os.path.basename(job.newest_linkable_proxy)}' - proxy does not match source!"
)
else:
link_success.append(job)
self.batch.remove(job)
# Mark any successful links
self.existing_link_success_count = len(link_success)
# Prompt to requeue any failed links
if mismatch_fail:
if not Confirm.ask(
f"[yellow]{len(mismatch_fail)} existing proxies failed to link.\n"
"They may be corrupt or incomplete. Re-render them?"
):
# Mark failed links as failed and remove
[self.batch.remove(x) for x in mismatch_fail]
self.existing_link_failed_count = len(mismatch_fail)
return
# Mark failed links as requeued, not offline
self.existing_link_requeued_count += len(mismatch_fail)
def handle_offline_proxies(self):
"""Prompt to rerender proxies that are 'linked' but their media does not exist.
Implement overwrite logic
also need to test for oplock issues"
Mark any successful links
https://github.com/in03/proxima/blob/1651bc295e41b7d7ddd56b244eddb73c4cb74437/src/proxima/types/batch.py#L205
a62a598666183b44c43dde70af653b3136feb2bf