diff --git a/.github/workflows/ComfyUIdownloads.yml b/.github/workflows/ComfyUIdownloads.yml index 1229174..1e87c28 100644 --- a/.github/workflows/ComfyUIdownloads.yml +++ b/.github/workflows/ComfyUIdownloads.yml @@ -25,17 +25,17 @@ jobs: node_id="comfyui-model-resolver" for i in {1..3}; do - echo "Pobieranie danych z próby $i..." + echo "Fetching data for attempt $i..." curl -s "https://api.comfy.org/nodes/${node_id}" > tmp_$i.json if [ ! -s tmp_$i.json ] || ! jq empty tmp_$i.json 2>/dev/null; then - echo "Błąd: Nieprawidłowy JSON dla próby $i" + echo "Error: invalid JSON for attempt $i" continue fi if jq -e 'type == "array"' tmp_$i.json >/dev/null; then node_count=$(jq 'length' tmp_$i.json) - echo "Znaleziono $node_count węzłów w próbie $i" + echo "Found $node_count nodes in attempt $i" for j in $(seq 0 $((node_count - 1))); do downloads=$(jq -r ".[$j].downloads // 0" tmp_$i.json) @@ -44,7 +44,7 @@ jobs: if [ "$downloads" -gt "$max_downloads" ]; then max_downloads=$downloads top_node_json=$(jq ".[$j]" tmp_$i.json) - echo "Nowe maksimum znalezione: $downloads (węzeł: $name)" + echo "New maximum found: $downloads (node: $name)" fi done else @@ -54,7 +54,7 @@ jobs: if [ "$downloads" -gt "$max_downloads" ]; then max_downloads=$downloads top_node_json=$(cat tmp_$i.json) - echo "Nowe maksimum znalezione: $downloads (węzeł: $name)" + echo "New maximum found: $downloads (node: $name)" fi fi @@ -63,11 +63,11 @@ jobs: if [ "$max_downloads" -gt 0 ]; then echo "$top_node_json" > top_modelresolver.json - echo "Najwyższa liczba pobrań: $max_downloads" - echo "Szczegóły węzła:" + echo "Highest download count: $max_downloads" + echo "Node details:" jq . top_modelresolver.json else - echo "Błąd: Nie znaleziono żadnych prawidłowych danych" + echo "Error: no valid data found" echo '{"name": "ComfyUI Model Resolver", "downloads": 0}' > top_modelresolver.json fi @@ -82,16 +82,16 @@ jobs: echo "GIST=${{ secrets.MODELRESOLVER_GIST_ID }}" >> $GITHUB_OUTPUT if gh gist view ${{ secrets.MODELRESOLVER_GIST_ID }} &>/dev/null; then - echo "Gist istnieje, będzie zaktualizowany" + echo "Gist exists and will be updated" else - echo "Gist nie istnieje, tworzenie nowego" + echo "Gist does not exist, creating a new one" gist_id=$(gh gist create top_modelresolver.json | awk -F / '{print $NF}') echo $gist_id | gh secret set MODELRESOLVER_GIST_ID echo "GIST=$gist_id" >> $GITHUB_OUTPUT git rm --ignore-unmatch "$BADGE_DOC" MODELRESOLVER.md fi else - echo "Tworzenie nowego gist" + echo "Creating a new gist" gist_id=$(gh gist create top_modelresolver.json | awk -F / '{print $NF}') echo $gist_id | gh secret set MODELRESOLVER_GIST_ID echo "GIST=$gist_id" >> $GITHUB_OUTPUT @@ -168,7 +168,7 @@ jobs: -H "Content-Type: application/json" \ -d @patch.json https://api.github.com/gists/${{ steps.set_id.outputs.GIST }} else - echo "Błąd: Nieprawidłowy JSON w top_modelresolver.json" + echo "Error: invalid JSON in top_modelresolver.json" exit 1 fi diff --git a/core/path_utils.py b/core/path_utils.py index 9ab0255..71f290e 100644 --- a/core/path_utils.py +++ b/core/path_utils.py @@ -266,8 +266,9 @@ def get_comfy_root_path(folder_paths_module: Optional[Any] = None) -> str: def find_metadata_sidecar_path(model_path: str) -> str: """ - Znajduje istniejący plik metadanych (np. .metadata.json, .civitai.info, .json) - powiązany z plikiem modelu i zwraca jego pełną ścieżkę. Zwraca pusty ciąg, jeśli brak. + Find an existing metadata sidecar file (for example .metadata.json, + .civitai.info, or .json) associated with a model file and return its + absolute path. Returns an empty string when no sidecar exists. """ if not model_path: return "" @@ -279,7 +280,7 @@ def find_metadata_sidecar_path(model_path: str) -> str: # Base name without extension base_name = filename.rsplit(".", 1)[0] if "." in filename else filename - # Wzorce nazw na podstawie civitai.py i resolver.py + # Name patterns based on civitai.py and resolver.py. possible_names = [ base_name + ".metadata.json", filename + ".metadata.json", diff --git a/core/type_utils.py b/core/type_utils.py index 3d006e1..7a23e91 100644 --- a/core/type_utils.py +++ b/core/type_utils.py @@ -557,7 +557,7 @@ def fetch_remote_file_size( timeout: int = 15, ) -> Optional[int]: """ - Sprawdza rozmiar zdalnego pliku wykonując zapytanie HEAD i opcjonalnie GET Range=bytes=0-0. + Check a remote file size using HEAD and, when needed, GET Range=bytes=0-0. """ import requests request_headers = {**(headers or {}), "Accept-Encoding": "identity"} @@ -600,7 +600,7 @@ def fetch_remote_file_size( def looks_like_model_file(url: str, expected_filename: str = "") -> bool: """ - Walidacja, czy dany link URL wygląda na poprawny plik modelu. + Validate whether the URL looks like a valid model file. """ import os from urllib.parse import unquote, urlparse @@ -638,7 +638,7 @@ def looks_like_model_file(url: str, expected_filename: str = "") -> bool: def normalize_model_image(image_data: Dict[str, Any], default_civitai_url: str = "") -> Dict[str, Any]: """ - Normalizuje metadane obrazu pochodzące z różnych API do jednolitego słownika. + Normalize image metadata from different APIs into one dictionary shape. """ if not isinstance(image_data, dict): return {} @@ -709,7 +709,7 @@ def normalize_sha256(value: Any) -> str: def unique_ordered_strings(values: List[Any]) -> List[str]: - """Zwraca unikalne, niepuste ciągi znaków z zachowaniem oryginalnej kolejności.""" + """Return unique, non-empty strings while preserving their original order.""" seen = set() unique = [] for value in values: @@ -723,7 +723,7 @@ def unique_ordered_strings(values: List[Any]) -> List[str]: def extract_sha256_from_metadata(metadata: Any) -> str: """ - Wyciąga i zwraca pierwszy poprawny znormalizowany hash SHA256 z metadanych. + Extract and return the first valid normalized SHA256 hash from metadata. """ if not isinstance(metadata, dict): return "" @@ -744,7 +744,7 @@ def extract_sha256_from_metadata(metadata: Any) -> str: if normalized: return normalized - # Obsługa słownika file_info (np. z popular/model_list) + # Support the file_info dictionary shape, for example from popular/model_list. file_info = metadata.get("file_info") if isinstance(file_info, dict): for key in ("sha256", "hash", "SHA256", "Sha256"): @@ -762,7 +762,7 @@ def extract_sha256_from_metadata(metadata: Any) -> str: if normalized: return normalized - # Obsługa zagnieżdżonej listy plików w metadanych Civitai + # Support Civitai metadata with a nested files list. files = metadata.get("files") if isinstance(files, list): for file_info_item in files: @@ -781,8 +781,8 @@ def extract_sha256_from_metadata(metadata: Any) -> str: def extract_trained_words(*values: Any) -> List[str]: """ - Parsuje i zwraca znormalizowaną listę unikalnych słów kluczowych - i tagów z przekazanych wartości (słowników wersji, list lub ciągów znaków). + Parse and return a normalized list of unique keywords and tags from the + provided values, such as version dictionaries, lists, or strings. """ words: List[str] = [] seen = set() @@ -834,7 +834,7 @@ def fetch_remote_file_size_cached( timeout: int = 15, ) -> Optional[int]: """ - Sprawdza rozmiar zdalnego pliku, korzystając ze wspólnej pamięci podręcznej. + Check a remote file size using the shared cache. """ auth = headers.get("Authorization") if headers else None cache_key = (url, auth) @@ -847,7 +847,7 @@ def fetch_remote_file_size_cached( def clear_remote_size_cache() -> None: - """Czyści cache rozmiarów plików zdalnych.""" + """Clear the remote file size cache.""" _remote_size_cache.clear() @@ -899,7 +899,8 @@ def extract_file_size(file_info: Dict[str, Any]) -> Optional[int]: def normalize_category_to_model_type(category: str) -> str: """ - Mapuje nazwę kategorii pobierania/ComfyUI (np. 'checkpoints') na znormalizowany typ modelu (np. 'checkpoint'). + Map a download or ComfyUI category name, such as "checkpoints", to a + normalized model type, such as "checkpoint". """ if not category: return "" @@ -921,8 +922,9 @@ def normalize_category_to_model_type(category: str) -> str: def check_credential_preconditions(value: Optional[str], token_name: str) -> Optional[Dict[str, Any]]: """ - Sprawdza, czy poświadczenie (np. token, klucz) nie jest puste. - Zwraca standardowy słownik błędu, jeśli poświadczenie jest puste, w przeciwnym razie None. + Check whether a credential, such as a token or key, is not empty. + Return a standard error dictionary when the credential is empty; + otherwise return None. """ clean_val = (value or "").strip() if not clean_val: