Improve sync feedback and dashboard layout

Add request counters to Radio 357 backfill logs, clarify RNŚ warnings, and refine responsive dashboard metrics and configuration layout.
This commit is contained in:
2026-09-03 12:38:56 +02:00
parent 95e2efecdb
commit 45bfb8fa5f
4 changed files with 34 additions and 26 deletions
+5 -5
View File
@@ -240,12 +240,12 @@ class Radio357Scraper:
if self.requests_made >= self.hard_limit or backfill_count >= self.backfill_limit:
break
self.logger(f"R357: Pobieram URL dla {ep.title[:30]}...")
gateway_url = f"https://gateway.r357.eu/api/content/podcast/{ep.ep_id}/url"
self.requests_made += 1
if self.progress_callback: self.progress_callback(self.requests_made, self.hard_limit)
backfill_count += 1
self.logger(f"R357: [{self.requests_made}/{self.hard_limit}] Pobieram URL dla {ep.title[:30]}...")
try:
r = requests.get(gateway_url, headers={
"Authorization": f"Bearer {token}",
@@ -259,22 +259,22 @@ class Radio357Scraper:
ep.url = audio_url
fetched += 1
elif r.status_code == 401 or r.status_code == 403:
self.logger("R357: Token odrzucony przez gateway. Wymagam reloginu.")
self.logger(f"R357: [{self.requests_made}/{self.hard_limit}] Token odrzucony przez gateway. Wymagam reloginu.")
# Usuwamy token, zeby przy nastepnym runie pobral nowy
self.db.query(Config).filter_by(key="r357_token").delete()
self.db.commit()
raise Exception("R357 Token Expired")
else:
self.logger(f"R357 Błąd HTTP {r.status_code} podczas pobierania audio: {r.text[:100]}")
self.logger(f"R357: [{self.requests_made}/{self.hard_limit}] Błąd HTTP {r.status_code} podczas pobierania audio: {r.text[:100]}")
except Exception as e:
self.logger(f"R357: Błąd URL dla odcinka {ep.ep_id}: {e}")
self.logger(f"R357: [{self.requests_made}/{self.hard_limit}] Błąd URL dla odcinka {ep.ep_id}: {e}")
if "Token Expired" in str(e):
raise
time.sleep(0.5)
self.db.commit()
self.logger(f"R357: Pomyślnie pobrano {fetched} nowych linków.")
self.logger(f"R357: [{self.requests_made}/{self.hard_limit}] Pomyślnie pobrano {fetched} nowych linków.")
def run_full_sync(self, specific_program_slug=None):
self.sync_episodes(specific_program_slug)
+7 -1
View File
@@ -253,6 +253,7 @@ class RNScraper:
new_found = 0
missing_player_count = 0
missing_player_titles = []
valid_cards = 0
for card in cards:
@@ -266,6 +267,8 @@ class RNScraper:
if not player_box:
missing_player_count += 1
if title_el := card.find("p", class_="rns-post-title"):
missing_player_titles.append(title_el.get_text(strip=True))
if audio_url and not audio_url.startswith("http"):
audio_url = f"{BASE_URL}/{audio_url.lstrip('/')}"
@@ -315,7 +318,10 @@ class RNScraper:
invalid_response("rns", "HTML_SCHEMA_CHANGED", "Znaleziono karty podcastów bez oczekiwanych identyfikatorów", url, content=html)
if missing_player_count:
warning = f"{missing_player_count} odcinków bez dostępnego playera audio; pomijam ich URL-e."
titles = ", ".join(missing_player_titles[:3])
warning = f"Audycja {program_slug}: {missing_player_count} odcinków bez dostępnego playera audio; pomijam ich URL-e."
if titles:
warning += f" Odcinki: {titles}."
if self.warning_callback:
self.warning_callback(warning)
else: