15 lines
3.1 KiB
JSON
15 lines
3.1 KiB
JSON
[
|
|
{
|
|
"id": "Fetch track names",
|
|
"result": {
|
|
"structured": "TRIGGER: When bathroom media player [media_player.bathroom] attribute queue_position changes OR When bathroom media player [media_player.bathroom] attribute queue_size changes OR When bathroom media player [media_player.bathroom] state changes to playing. CONDITIONS: None. ACTIONS: First, fetch the current music queue from bathroom media player [media_player.bathroom] and store it in a variable. Then, set the value of previous previous track input [input_text.previous_previous_track] to the media_title of the track three positions before the current queue_position (wrapping around the queue), truncated to 14 characters with ellipsis if longer than 16 characters. Then, set the value of previous track input [input_text.previous_track] to the media_title of the track two positions before the current queue_position (wrapping around the queue), truncated to 14 characters with ellipsis if longer than 16 characters. Then, set the value of current track input [input_text.current_track] to the media_title of the track one position before the current queue_position (wrapping around the queue), truncated to 14 characters with ellipsis if longer than 16 characters. Then, set the value of next track input [input_text.next_track] to the media_title of the track at the current queue_position (wrapping around the queue), truncated to 14 characters with ellipsis if longer than 16 characters. Then, set the value of next next track input [input_text.next_next_track] to the media_title of the track one position after the current queue_position (wrapping around the queue), truncated to 14 characters with ellipsis if longer than 16 characters.",
|
|
"natural_language": {
|
|
"trigger": "This automation runs whenever the queue position or queue size attributes of the bathroom media player [media_player.bathroom] change, or when the player's state changes to playing.",
|
|
"conditions": "There are no conditions that must be met.",
|
|
"action": "The automation first retrieves the current music queue from the bathroom media player [media_player.bathroom]. It then calculates and updates five separate text fields with the titles of tracks relative to the current playing position. The previous previous track input [input_text.previous_previous_track] shows the title of the track three positions before the current one. The previous track input [input_text.previous_track] shows the title two positions before. The current track input [input_text.current_track] shows the title one position before. The next track input [input_text.next_track] shows the title of the current queue position. The next next track input [input_text.next_next_track] shows the title one position after. For all these fields, if a track title is longer than 16 characters, it is shortened to 14 characters followed by an ellipsis. The calculations wrap around the queue if the position goes beyond the beginning or end."
|
|
},
|
|
"human_like": "Updates a display of the last, current, and upcoming track names from the bathroom speaker's queue whenever playback changes.",
|
|
"complexity": "medium"
|
|
}
|
|
}
|
|
] |