Remove players deleted from Yodeck instead of showing them as offline

Poll loop now deletes DB rows for players no longer returned by the
Yodeck API, and Zabbix sync deletes the corresponding hosts from the
Yodeck Players group. Both actions are reflected in the activity log.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 18:02:03 +02:00
parent 31e7b93546
commit ecafc5a48a
3 changed files with 34 additions and 2 deletions

View File

@@ -115,6 +115,18 @@ def upsert_player(p):
conn.close()
def delete_players_not_in(ids):
if not ids:
return 0
placeholders = ','.join('?' * len(ids))
conn = _conn()
cur = conn.execute(f'DELETE FROM players WHERE id NOT IN ({placeholders})', ids)
deleted = cur.rowcount
conn.commit()
conn.close()
return deleted
def get_all_players():
conn = _conn()
rows = conn.execute('SELECT * FROM players ORDER BY name').fetchall()