111 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			111 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
(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 1
 | 
						|
  :geometry (geometry
 | 
						|
    :x "0%"
 | 
						|
    :y "0%"
 | 
						|
  	:anchor "bottom right"
 | 
						|
    :width "0px"
 | 
						|
    :height "0px")
 | 
						|
  (window (radio-win)))
 | 
						|
 | 
						|
 | 
						|
(defwidget radio-win [] 
 | 
						|
	(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" 
 | 
						|
          :style "background-size:cover; background-image: url('${radio.song.image600?:'https://www.radiorecord.ru/upload/stations_images/record_image600_white_fill.png'}');")
 | 
						|
		(box 
 | 
						|
          :space-evenly false
 | 
						|
          :orientation "v"
 | 
						|
			(label 
 | 
						|
              :halign "center" 
 | 
						|
              :class "song" 
 | 
						|
              :wrap "true" 
 | 
						|
              :limit-width 18
 | 
						|
              :text "${radio.song.song?:'...'}")
 | 
						|
			(label 
 | 
						|
              :halign "center" 
 | 
						|
              :class "artist" 
 | 
						|
              :wrap "true" 
 | 
						|
              :limit-width 22
 | 
						|
              :text "${radio.song.artist?:'...'}")
 | 
						|
			(box 
 | 
						|
              :space-evenly true
 | 
						|
              :orientation "h" 
 | 
						|
              :halign "center" 
 | 
						|
              :class "btn_bar"
 | 
						|
 | 
						|
                (button
 | 
						|
                :class "btn_left" 
 | 
						|
                :onclick "${EWW_CMD} update radio_rev=${!radio_rev}"
 | 
						|
                (box ""))
 | 
						|
 | 
						|
				        (button 
 | 
						|
                :class "btn_play" 
 | 
						|
                :timeout "2s"
 | 
						|
                :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
 | 
						|
                :class "station_art ${(radio.radio == station.id)?'station_sel':''}"
 | 
						|
                :timeout "2s"
 | 
						|
                :onclick "scripts/radio start ${station.id}"
 | 
						|
                :tooltip "${station.title}"
 | 
						|
                :style "background-size:cover; background-image: url('${station.icon_fill_white}');"
 | 
						|
            )
 | 
						|
        )
 | 
						|
    )
 | 
						|
  )
 | 
						|
)
 | 
						|
 | 
						|
(defwidget radio-mod []
 | 
						|
  (module
 | 
						|
    (box
 | 
						|
      :orientation "v"
 | 
						|
      (button
 | 
						|
        :onclick "(sleep 0.1 && ${EWW_CMD} open --toggle --no-daemonize radio)"
 | 
						|
        (label 
 | 
						|
          :show-truncated false
 | 
						|
          :class "icon-text" 
 | 
						|
          :text "")
 | 
						|
      )
 | 
						|
    )
 | 
						|
  )
 | 
						|
) |