HNS endpoints: /clan/{id}/hns-career + /klubovi/pgz-financirani + /dashboard/hns-coverage

Backed by: pgz_sport.hns_player_seasons, hns_klub_roster, v_pgz_financirani_klubovi
Used by: cc-hns subagents for UI integration
This commit is contained in:
2026-05-05 10:22:36 +02:00
parent a20230187f
commit c68fd4471e
5 changed files with 651 additions and 1 deletions
+18 -1
View File
@@ -427,7 +427,24 @@ def _research_links(naziv, kind, grad=None, sport: Optional[str] = None, row: Op
'icon': '🏟', 'url': url.replace('{q}', qenc)})
if not fed:
# No mapping for this sport → keep transfermarkt as legacy fallback
out.append({'label': 'HNS Semafor', 'icon': '', 'url': 'https://semafor.hns.family/?s=' + qenc})
# Prefer direct /igraci/{id}/{slug} when hns_igrac_id exists
hns_id = (clan or {}).get('hns_igrac_id') if 'clan' in dir() else None
if not hns_id:
# Try get from current clan dict
try: hns_id = clan.get('hns_igrac_id') if isinstance(clan, dict) else None
except: pass
if hns_id:
# Slugify ime+prezime: "Franko Andrijašević" → "franko-andrijasevic"
_ime = (clan.get('ime','') if isinstance(clan, dict) else '') or ''
_prez = (clan.get('prezime','') if isinstance(clan, dict) else '') or ''
_full = (_ime + ' ' + _prez).strip().lower()
_slug = _full
for old_c, new_c in [('č','c'),('ć','c'),('ž','z'),('š','s'),('đ','d'),(' ','-')]:
_slug = _slug.replace(old_c, new_c)
_slug = re.sub(r'[^a-z0-9-]', '', _slug)
out.append({'label': 'HNS Semafor (profil)', 'icon': '', 'url': f'https://semafor.hns.family/igraci/{hns_id}/{_slug}/'})
else:
out.append({'label': 'HNS Semafor (pretraga)', 'icon': '', 'url': 'https://semafor.hns.family/?s=' + qenc})
out.append({'label': 'transfermarkt','icon': '', 'url': 'https://www.transfermarkt.com/schnellsuche/ergebnis/schnellsuche?query=' + qenc})
# Local PGŽ media for any sportas
_, _, media = _load_sport_feds()