Skip to content

Commit

Permalink
feat: remove partial unsuccessful results
Browse files Browse the repository at this point in the history
  • Loading branch information
bugale committed Jun 26, 2024
1 parent 57483cd commit 05c2665
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions buganime/buganime.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,18 @@ def process_file(input_path: str) -> None:
logging.info('ffprobe %s wrote %s, %s', str(proc.args), proc.stderr, proc.stdout)
video_info = parse_streams(json.loads(proc.stdout)['streams'])

with lock_mutex(name=UPSCALE_MUTEX_NAME):
logging.info('Running Upscaler')
asyncio.run(transcode.Transcoder(input_path=input_path, output_path=output_path, height_out=2160, width_out=3840, video_info=video_info).run())
logging.info('Upscaler for %s finished', input_path)
try:
with lock_mutex(name=UPSCALE_MUTEX_NAME):
logging.info('Running Upscaler')
asyncio.run(transcode.Transcoder(input_path=input_path, output_path=output_path, height_out=2160, width_out=3840, video_info=video_info).run())
logging.info('Upscaler for %s finished', input_path)
except Exception:
logging.warning('Upscaler for %s failed. Deleting output %s', input_path, output_path)
try:
os.unlink(output_path)
except Exception:
pass
raise


def process_path(input_path: str) -> None:
Expand Down

0 comments on commit 05c2665

Please sign in to comment.