Files
NSPanel_HA_Blueprint/nspanel_us_code/media_player.txt
2023-10-02 14:45:34 +02:00

630 lines
16 KiB
Plaintext

Page media_player
Attributes
ID : 0
Scope : local
Dragging : 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID: disabled
Events
Preinitialize Event
if(api==0)
{
page home
}else
{
printh 92
prints "currentpage",0
printh 00
prints "media_player",0
printh 00
printh FF FF FF
}
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Variable (string) back_page
Attributes
ID : 3
Scope : local
Text : home
Max. Text Size: 15
Variable (string) lastclick
Attributes
ID : 19
Scope : local
Text :
Max. Text Size: 255
Variable (string) va0
Attributes
ID : 22
Scope : local
Text :
Max. Text Size: 10
Variable (int32) is_muted
Attributes
ID : 23
Scope: local
Value: 0
Variable (int32) prg_current
Attributes
ID : 25
Scope: local
Value: 0
Variable (int32) prg_total
Attributes
ID : 26
Scope: local
Value: 0
Text page_label
Attributes
ID : 1
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text : Media Player
Max. Text Size : 25
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Text icon_state
Attributes
ID : 2
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text : 
Max. Text Size : 10
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Text vol_text
Attributes
ID : 6
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 5
Text bt_vol_down
Attributes
ID : 7
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 3
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
if(vol_slider.val>0)
{
vol_slider.val--
covx vol_slider.val,va0.txt,0,0
vol_text.txt=va0.txt+"%"
timer0.en=1
}
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Text bt_vol_up
Attributes
ID : 8
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 3
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
if(vol_slider.val<100)
{
vol_slider.val++
covx vol_slider.val,va0.txt,0,0
vol_text.txt=va0.txt+"%"
timer0.en=1
}
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Text bt_mute
Attributes
ID : 9
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 3
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
if(is_muted.val==0)
{
va0.txt="true"
}else
{
va0.txt="false"
}
lastclick.txt="{\"page\": \"media_player\", \"key\": \"volume_mute\", \"value\": \""+va0.txt+"\"}"
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Text time_current
Attributes
ID : 11
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Text time_total
Attributes
ID : 12
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Text track
Attributes
ID : 13
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 50
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Text artist
Attributes
ID : 14
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 50
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Text bt_prev
Attributes
ID : 15
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 92
prints "localevent",0
printh 00
prints "{\"page\": \"media_player\", \"key\": \"media_previous_track\"}",0
printh 00
printh FF FF FF
Text bt_play_pause
Attributes
ID : 16
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 92
prints "localevent",0
printh 00
prints "{\"page\": \"media_player\", \"key\": \"media_play_pause\"}",0
printh 00
printh FF FF FF
Text bt_next
Attributes
ID : 17
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 92
prints "localevent",0
printh 00
prints "{\"page\": \"media_player\", \"key\": \"media_next_track\"}",0
printh 00
printh FF FF FF
Text bt_on_off
Attributes
ID : 18
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 92
prints "localevent",0
printh 00
prints "{\"page\": \"media_player\", \"key\": \"toggle\"}",0
printh 00
printh FF FF FF
Progress Bar time_progress
Attributes
ID : 10
Scope : local
Dragging : 0
Send Component ID: disabled
Value : 0
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Slider vol_slider
Attributes
ID : 5
Scope : local
Dragging : 0
Send Component ID: disabled
Position : 0
Upper range limit: 100
Lower range limit: 0
Events
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
covx vol_slider.val,va0.txt,0,0
vol_text.txt=va0.txt+"%"
timer0.en=1
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Button button_back
Attributes
ID : 4
Scope : local
Dragging : 0
Send Component ID: disabled
State : unpressed
Text : 
Max. Text Size : 3
Events
Touch Press Event
if(back_page.txt=="buttonpage01")
{
page buttonpage01
}else if(back_page.txt=="buttonpage02")
{
page buttonpage02
}else if(back_page.txt=="buttonpage03")
{
page buttonpage03
}else if(back_page.txt=="buttonpage04")
{
page buttonpage04
}else
{
page home
}
Timer wakeup_timer
Attributes
ID : 20
Scope : local
Period (ms): 100
Enabled : yes
Events
Timer Event
if(dim<brightness)
{
dimdelta=brightness-dim
dimdelta/=10
if(dimdelta<1)
{
dimdelta=1
}
dim+=dimdelta
}else
{
wakeup_timer.en=0
}
Timer timer0
Attributes
ID : 21
Scope : local
Period (ms): 1000
Enabled : no
Events
Timer Event
timer0.en=0
covx vol_slider.val,va0.txt,0,0
vol_text.txt=va0.txt+"%"
lastclick.txt="{\"page\": \"media_player\", \"key\": \"volume_set\", \"value\": "+va0.txt+"}"
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Timer prg_timer
Attributes
ID : 24
Scope : local
Period (ms): 1000
Enabled : no
Events
Timer Event
if(prg_current.val<prg_total.val&&prg_total.val>0)
{
prg_current.val++
time_progress.val=100*prg_current.val/prg_total.val
covx prg_current.val,time_current.txt,0,0
}
// Progress - Total
sys0=prg_total.val/3600 //hours
sys2=prg_total.val%3600 //remainder
sys1=sys2/60 //minutes
sys2%=60 //seconds
time_total.txt=""
if(sys0>0)
{
covx sys0,time_total.txt,0,0
time_total.txt+=":"
if(sys1<10)
{
time_total.txt+="0"
}
}
covx sys1,va0.txt,0,0
time_total.txt+=va0.txt+":"
if(sys2<10)
{
time_total.txt+="0"
}
covx sys2,va0.txt,0,0
time_total.txt+=va0.txt
// Progress - Current
sys0=prg_current.val/3600 //hours
sys2=prg_current.val%3600 //remainder
sys1=sys2/60 //minutes
sys2%=60 //seconds
time_current.txt=""
if(sys0>0)
{
covx sys0,time_current.txt,0,0
time_current.txt+=":"
if(sys1<10)
{
time_current.txt+="0"
}
}
covx sys1,va0.txt,0,0
time_current.txt+=va0.txt+":"
if(sys2<10)
{
time_current.txt+="0"
}
covx sys2,va0.txt,0,0
time_current.txt+=va0.txt