2023-11-22 06:14:03 +01:00
(deflisten radio :initial '{"is_paused":1,"song":{"artist":"","song":"","image600":"https://www.radiorecord.ru/upload/stations_images/record_image600_white_fill.png"},"stations":[]}' "scripts/radio")
(defvar radio_rev false)
(defwindow radio
:monitor 0
:geometry (geometry
:x "0%"
:y "0%"
:anchor "bottom right"
2023-11-23 12:55:23 +01:00
:width "0px"
:height "0px")
2023-11-23 20:46:43 +01:00
(window (radio-win)))
2023-11-22 06:14:03 +01:00
2023-11-23 20:46:43 +01:00
(defwidget radio-win []
2023-11-22 06:14:03 +01:00
(box
:space-evenly false
:orientation "h"
(revealer
:visible radio_rev
:reveal radio_rev
:transition "slideleft"
(radio-selector))
(box
:space-evenly false
:orientation "v"
(box
:class "album_art"
2023-11-23 12:55:23 +01:00
:style "background-size:cover; background-image: url('${radio.song.image600?:'https://www.radiorecord.ru/upload/stations_images/record_image600_white_fill.png'}');")
2023-11-22 06:14:03 +01:00
(box
:space-evenly false
:orientation "v"
(label
:halign "center"
:class "song"
:wrap "true"
2023-11-23 12:55:23 +01:00
:limit-width 18
:text "${radio.song.song?:'...'}")
2023-11-22 06:14:03 +01:00
(label
:halign "center"
:class "artist"
:wrap "true"
:limit-width 22
2023-11-23 12:55:23 +01:00
:text "${radio.song.artist?:'...'}")
2023-11-22 06:14:03 +01:00
(box
:space-evenly true
:orientation "h"
:halign "center"
:class "btn_bar"
(button
:class "btn_left"
:onclick "${EWW_CMD} update radio_rev=${!radio_rev}"
(box ""))
2023-11-23 12:55:23 +01:00
(button
2023-11-22 06:14:03 +01:00
:class "btn_play"
2023-11-23 12:55:23 +01:00
:timeout "2s"
2023-11-22 06:14:03 +01:00
:onclick "scripts/radio toggle"
"${radio.is_paused==1 ? "" : ""}")
(button
:class "btn_right"
:onclick ""
(box :visible false ""))
)
)
)
)
)
(defwidget radio-selector []
(scroll
:active true
:vscroll true
:hscroll false
(box
:class "station_list"
:space-evenly false
:orientation "v"
(for station in {radio.stations}
(button
2023-11-23 12:55:23 +01:00
:class "station_art ${(radio.radio == station.id)?'station_sel':''}"
:timeout "2s"
2023-11-22 06:14:03 +01:00
:onclick "scripts/radio start ${station.id}"
:tooltip "${station.title}"
:style "background-size:cover; background-image: url('${station.icon_fill_white}');"
)
)
)
)
)
2023-11-23 20:46:43 +01:00
(defwidget radio-mod []
(module
(box
2023-11-22 06:14:03 +01:00
:orientation "v"
2023-11-23 20:46:43 +01:00
(button
2024-05-18 16:52:08 +02:00
:onclick "(sleep 0.1 && ${EWW_CMD} open --toggle --no-daemonize radio)"
2024-05-18 07:55:03 +02:00
(label
:show-truncated false
:class "icon-text"
:text "")
2023-11-23 20:46:43 +01:00
)
)
)
2023-11-23 20:55:42 +01:00
)