From 6beeb2e33ce13d66bed12c76c2ff49e30f29924a Mon Sep 17 00:00:00 2001 From: heinezen Date: Fri, 23 Feb 2024 00:17:17 +0100 Subject: [PATCH 1/2] convert: Log file info after multi-threaded conversion has finished. --- .../convert/processor/export/media_exporter.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/openage/convert/processor/export/media_exporter.py b/openage/convert/processor/export/media_exporter.py index a9ffd84092..61e48b9e36 100644 --- a/openage/convert/processor/export/media_exporter.py +++ b/openage/convert/processor/export/media_exporter.py @@ -305,13 +305,6 @@ def error_callback(exception: Exception): error_callback=error_callback ) - # Log file information - if get_loglevel() <= logging.DEBUG: - MediaExporter.log_fileinfo( - sourcedir[request.get_type().value, request.source_filename], - exportdir[request.targetdir, request.target_filename] - ) - # Show progress MediaExporter._show_progress(outqueue.qsize(), expected_size) @@ -328,6 +321,14 @@ def error_callback(exception: Exception): if handle_outqueue_func: handle_outqueue_func(outqueue, requests) + # Log file information + if get_loglevel() <= logging.DEBUG: + for request in requests: + MediaExporter.log_fileinfo( + sourcedir[request.get_type().value, request.source_filename], + exportdir[request.targetdir, request.target_filename] + ) + @staticmethod def _get_blend_data( request: MediaExportRequest, From 4704ec34e1280a78b872f7185357ab8ecff8d04a Mon Sep 17 00:00:00 2001 From: heinezen Date: Fri, 23 Feb 2024 00:18:17 +0100 Subject: [PATCH 2/2] convert: Fix file size fetch when logging asset file info. --- openage/convert/processor/export/media_exporter.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/openage/convert/processor/export/media_exporter.py b/openage/convert/processor/export/media_exporter.py index 61e48b9e36..966ebe8da6 100644 --- a/openage/convert/processor/export/media_exporter.py +++ b/openage/convert/processor/export/media_exporter.py @@ -608,17 +608,8 @@ def log_fileinfo( source_format = source_file.suffix[1:].upper() target_format = target_file.suffix[1:].upper() - source_path = source_file.resolve_native_path() - if source_path: - source_size = os.path.getsize(source_path) - - else: - with source_file.open('r') as src: - src.seek(0, os.SEEK_END) - source_size = src.tell() - - target_path = target_file.resolve_native_path() - target_size = os.path.getsize(target_path) + source_size = source_file.filesize + target_size = target_file.filesize log = ("Converted: " f"{source_file.name} "