Skip to content

Commit 1ce5837

Browse files
committed
fix: prevent duplicate dirs for suffix variants, clean up artifact upload
- _resolve_target_dir now checks 'Geyser' suffix variants and scans existing directories by core name (fixes Old Faithful/Vixen split) - Remove stale change_log.txt reference from artifact upload step
1 parent 143404b commit 1ce5837

4 files changed

Lines changed: 20 additions & 11 deletions

File tree

.github/workflows/spider_action.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
uses: actions/upload-artifact@v4
6666
if: always()
6767
with:
68-
name: logs
69-
path: change_log.txt
68+
name: spider-logs
69+
path: |
70+
CHANGELOG.md
7071
retention-days: 14

Old Faithful/Sound Library - Old Faithful_NPS_Neal Herbert.jpg renamed to Old Faithful Geyser/Sound Library - Old Faithful_NPS_Neal Herbert.jpg

File renamed without changes.

Vixen/Sound Library - Vixen Geyser_NPS_Neal Herbert.jpg renamed to Vixen Geyser/Sound Library - Vixen Geyser_NPS_Neal Herbert.jpg

File renamed without changes.

spider.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,28 @@ def _core_name(self, name: str) -> str:
7979
def _resolve_target_dir(self, animal_name: str) -> str:
8080
"""Pick a local directory name for *animal_name*.
8181
82-
If a directory already exists — either the exact name or the
83-
short/core variant — we reuse it. Otherwise we prefer the short
84-
(prefix-free) name for new downloads.
82+
If a directory already exists — either the exact name, the
83+
short/core variant, or a known suffix variant — we reuse it.
84+
Otherwise we prefer the short (prefix-free) name for new downloads.
8585
"""
8686
exact = animal_name.strip()
8787
core = self._core_name(exact)
8888

89-
# Exact match exists and has content → use it.
90-
if os.path.isdir(exact) and os.listdir(exact):
91-
return exact
89+
candidates = [exact, core]
9290

93-
# Core (short) match exists and has content → use it.
94-
if os.path.isdir(core) and os.listdir(core):
95-
return core
91+
# Known suffix variations (e.g. "Old Faithful" vs "Old Faithful Geyser")
92+
for suffix in (" Geyser",):
93+
candidates.append(core + suffix)
94+
95+
# Also scan existing directories for any whose core name matches.
96+
for d in os.listdir("."):
97+
if os.path.isdir(d) and os.listdir(d) and not d.startswith("."):
98+
if self._core_name(d).lower() == core.lower():
99+
candidates.append(d)
100+
101+
for cand in candidates:
102+
if os.path.isdir(cand) and os.listdir(cand):
103+
return cand
96104

97105
# Nothing exists yet → prefer short name for new folders.
98106
return core

0 commit comments

Comments
 (0)