mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
chore: Improve logging by adding SHA256 hash calculation timing and clarifying metadata creation messages.
This commit is contained in:
@@ -949,7 +949,7 @@ class ModelScanner:
|
||||
metadata = self.model_class.from_civitai_info(version_info, file_info, file_path)
|
||||
metadata.preview_url = find_preview_file(file_name, os.path.dirname(file_path))
|
||||
await MetadataManager.save_metadata(file_path, metadata)
|
||||
logger.debug(f"Created metadata from .civitai.info for {file_path}")
|
||||
logger.info(f"Created metadata from .civitai.info for {file_path} (Reason: .civitai.info was found but .metadata.json was missing)")
|
||||
except Exception as e:
|
||||
logger.error(f"Error creating metadata from .civitai.info for {file_path}: {e}")
|
||||
else:
|
||||
|
||||
@@ -2,6 +2,7 @@ from datetime import datetime
|
||||
import os
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
from typing import Any, Dict, Optional, Type, Union
|
||||
|
||||
from .models import BaseModelMetadata, LoraMetadata
|
||||
@@ -203,7 +204,11 @@ class MetadataManager:
|
||||
preview_url = find_preview_file(base_name, dir_path)
|
||||
|
||||
# Calculate file hash
|
||||
start_hash_time = time.perf_counter()
|
||||
logger.debug(f"Calculating SHA256 hash for {real_path}...")
|
||||
sha256 = await calculate_sha256(real_path)
|
||||
hash_duration = time.perf_counter() - start_hash_time
|
||||
logger.info(f"SHA256 hash calculated for {real_path} in {hash_duration:.3f}s")
|
||||
|
||||
# Create instance based on model type
|
||||
if model_class.__name__ == "CheckpointMetadata":
|
||||
@@ -255,6 +260,7 @@ class MetadataManager:
|
||||
# await MetadataManager._enrich_metadata(metadata, real_path)
|
||||
|
||||
# Save the created metadata
|
||||
logger.info(f"Creating new .metadata.json for {file_path} (Reason: No existing metadata found)")
|
||||
await MetadataManager.save_metadata(file_path, metadata)
|
||||
|
||||
return metadata
|
||||
|
||||
Reference in New Issue
Block a user