Skip to content

Auto-create new_city.cfg from successful online searches - #6

Merged
pQu4k3r merged 2 commits into
mainfrom
develop
Sep 10, 2026
Merged

Auto-create new_city.cfg from successful online searches#6
pQu4k3r merged 2 commits into
mainfrom
develop

Conversation

@pQu4k3r

@pQu4k3r pQu4k3r commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

README documents that the offline city list "is created automatically during a search" if it doesn't exist, but that mechanism was never actually implemented — new_city.cfg was only ever read anywhere in the codebase, never written. Confirmed by repo-wide search before implementing.

Implements it: after a successful online search (search_online in city_panel.py), any newly found cities are appended to new_city.cfg, deduped by city id against what's already in the file, in the same ID/City_Name format the reader already expects.

  • Creates SYSTEM_DIR if needed, mirroring the pattern already used elsewhere (ForecaSetup.save in plugin.py).
  • Dedup reads existing ids from the file first so repeated searches don't grow the file with duplicates.
  • Verified the write/read round-trip in isolation, including a non-ASCII city name (São Paulo), to confirm the _↔space encoding matches prepare_city_list's reader exactly.

With this, the offline city list now actually builds up over time as users search — so City Selection's offline browsing and search_offline's local fallback (both fixed in #4/#5) have something real to work with after a fresh install.

pQu4k3r and others added 2 commits September 10, 2026 13:05
README documents that the offline city list "is created automatically
during a search" if it doesn't exist, but that mechanism was never
actually implemented anywhere in the codebase - new_city.cfg was only
ever read, never written.

Implemented it: after a successful online search (search_online),
append any newly found cities to new_city.cfg, deduped by city id
against what's already in the file, in the same "ID/City_Name" format
the reader already expects (verified with a write/read round-trip,
including a non-ASCII city name). Creates SYSTEM_DIR if needed,
mirroring the pattern already used elsewhere (e.g. ForecaSetup.save
in plugin.py). The offline list now builds up over time as users
search, so City Selection's offline browsing (and search_offline's
fallback) actually has something to work with after the fix in #4/#5.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UPpumFb2PP21ATpDwJBYBB
@pQu4k3r
pQu4k3r merged commit 0032916 into main Sep 10, 2026
6 checks passed
pQu4k3r added a commit that referenced this pull request Sep 10, 2026
Reported: searching "Lourdes" added all 17 online search results to
new_city.cfg, not just the one city actually chosen.

#6 appended every result from search_online to the offline list as
soon as the search ran, before the user picked anything. Moved the
write to the four places a city is actually selected instead
(ok/save_favorite1/save_favorite2/save_home), keyed off the exact
same get_selected_city() string already used to save favorites -
same format as the offline file, so no extra parsing/round-tripping.
Still deduped by id so repeated selections don't grow the file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UPpumFb2PP21ATpDwJBYBB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants