Add audio parameter to player playlist and auto-mark deployment status

- api.py: include 'audio' (on/off) field in playlist JSON served to players,
  derived from the muted toggle in the manage playlist page
- players.py: include 'audio' field in legacy player playlist builder
- api.py: auto-flip deployment_status pending/deploying -> deployed when a
  player sends feedback (player is confirmed running)
- players_list.html: poll deployment status for pending/failed badges so the
  players list live-updates once a player starts sending feedback
- .dockerignore: exclude runtime data/ volume dir from build context
This commit is contained in:
2026-08-05 11:43:02 +03:00
parent 052751b599
commit 046f5e5efd
4 changed files with 40 additions and 9 deletions
+18 -1
View File
@@ -413,7 +413,12 @@ def get_cached_playlist(player_id: int) -> List[Dict]:
'position': content._playlist_position or idx,
'url': item_url, # Web page URL for weblinks, file download URL otherwise
'description': content.description,
'edit_on_player': getattr(content, '_playlist_edit_on_player_enabled', False)
'edit_on_player': getattr(content, '_playlist_edit_on_player_enabled', False),
'muted': getattr(content, '_playlist_muted', True),
# Player expects 'audio' = "on"/"off" to set playback sound.
# The playlist_content.muted column stores True when audio is muted,
# so audio is "on" exactly when muted is False.
'audio': 'off' if getattr(content, '_playlist_muted', True) else 'on'
})
return playlist_data
@@ -502,6 +507,18 @@ def receive_player_feedback():
player.last_seen = datetime.utcnow()
player.status = status
# A player that is sending feedback is running, so its deployment
# finished successfully. Auto-mark it as deployed so the players list
# doesn't stay stuck on "pending"/"deploying" after deployment is done.
if player.deployment_status in ('pending', 'deploying'):
player.deployment_status = 'deployed'
player.last_deployment_status = 'success'
player.last_deployment_message = (
'Player is running and sending feedback'
)
if not player.last_deployment_at:
player.last_deployment_at = datetime.utcnow()
db.session.commit()
log_action('info', f'Feedback received from {player.name} ({player.hostname}): {status} - {message}')
+1
View File
@@ -578,6 +578,7 @@ def get_player_playlist(player_id: int) -> List[dict]:
'duration': getattr(content, '_playlist_duration', content.duration or 10),
'position': getattr(content, '_playlist_position', 0),
'muted': getattr(content, '_playlist_muted', True),
'audio': 'off' if getattr(content, '_playlist_muted', True) else 'on',
'filename': content.filename
})