Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/autotag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
echo "EOF" >> $GITHUB_OUTPUT

- name: Create GitHub Release
if: steps.check_tag.outputs.exists == 'false'
if: steps.check_tag.outputs.skip != 'true'
run: |
gh release create "v${{ steps.get_version.outputs.version }}" \
--title "Release v${{ steps.get_version.outputs.version }}" \
Expand Down
40 changes: 16 additions & 24 deletions usr/lib/enigma2/python/Plugins/Extensions/Foreca1/city_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ def search_online(self, search_term):
# Build new list with online results
new_entries = []
new_city_list = []
offline_entries = []
for res in results:
city_id = res.get("id")
name = res.get("name", "")
Expand All @@ -330,8 +329,6 @@ def search_online(self, search_term):
display_name, city_id=city_id, is_header=False)
new_entries.append(entry)
new_city_list.append((display_name, city_id))
if city_id and name:
offline_entries.append((city_id, name))

# Replace the filtered list with the online one
self.filtered_list = new_entries
Expand All @@ -343,50 +340,41 @@ def search_online(self, search_term):
self["description"].setText(
_("Found %d cities online for '%s'") %
(count, search_term))

self._append_to_offline_city_list(offline_entries)
return True

def _append_to_offline_city_list(self, entries):
"""Append newly found cities to new_city.cfg so the offline list
builds up automatically over time (README-documented behavior).
Skips ids already present in the file.
def _remember_city_offline(self, formatted_entry):
"""Append a single "id/Name_With_Underscores" entry (the same
format get_selected_city() returns, matching the offline file's
own format) to new_city.cfg, so the offline list builds up over
time with only the cities the user actually picks - not every
search result. Skips it if that id is already present.
"""
if not entries:
if not formatted_entry or "/" not in formatted_entry:
return
city_id = formatted_entry.split("/", 1)[0]

city_cfg_path = join(SYSTEM_DIR, "new_city.cfg")
existing_ids = set()
if exists(city_cfg_path):
try:
with open(city_cfg_path, "r", encoding="utf-8") as f:
for line in f:
line = line.strip()
if not line or line.startswith("#") or "/" not in line:
continue
existing_ids.add(line.split("/", 1)[0])
if line.split("/", 1)[0] == city_id:
return # already known
except Exception as e:
print(
f"[CityPanel4] Error reading offline list for dedup: {e}")
return

new_lines = [
f"{city_id}/{name.replace(' ', '_')}"
for city_id, name in entries
if str(city_id) not in existing_ids
]
if not new_lines:
return

try:
if not exists(SYSTEM_DIR):
makedirs(SYSTEM_DIR, exist_ok=True)
with open(city_cfg_path, "a", encoding="utf-8") as f:
for line in new_lines:
f.write(line + "\n")
f.write(formatted_entry + "\n")
if DEBUG:
print(
f"[CityPanel4] Appended {len(new_lines)} cities to offline list")
print(f"[CityPanel4] Remembered city offline: {formatted_entry}")
except Exception as e:
print(f"[CityPanel4] Error appending to offline list: {e}")

Expand Down Expand Up @@ -500,27 +488,31 @@ def _get_favorite_name(self, fav_type):
def save_favorite1(self):
selected = self.get_selected_city()
if selected:
self._remember_city_offline(selected)
self.save_favorite("fav1", selected)
self._update_fav_buttons()
self.close((selected, 'assign', 1))

def save_favorite2(self):
selected = self.get_selected_city()
if selected:
self._remember_city_offline(selected)
self.save_favorite("fav2", selected)
self._update_fav_buttons()
self.close((selected, 'assign', 1))

def save_home(self):
selected = self.get_selected_city()
if selected:
self._remember_city_offline(selected)
self.save_favorite("home", selected)
self._update_fav_buttons()
self.close((selected, 'assign', 1))

def ok(self):
selected = self.get_selected_city()
if selected:
self._remember_city_offline(selected)
if '/' in selected:
city_id, display_name = selected.split('/', 1)
display_name = display_name.replace('_', ' ')
Expand Down
Loading