-
Notifications
You must be signed in to change notification settings - Fork 36
/
pages_weh_80x16.py
executable file
·145 lines (136 loc) · 8.59 KB
/
pages_weh_80x16.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/usr/bin/python.pydPiper
# coding: UTF-8
from __future__ import unicode_literals
# Page Definitions
# See Page Format.txt for instructions and examples on how to modify your display settings
# Load the fonts needed for this system
FONTS = {
'small': { 'default':True, 'file':'latin1_5x8_fixed.fnt','size':(5,8) },
# 'large': { 'file':'BigFont_10x16_fixed.fnt', 'size':(10,16) },
'large': { 'file':'Vintl01_10x16_fixed.fnt', 'size':(10,16) },
'tiny': { 'file':'upperasciiwide_3x5_fixed.fnt', 'size':(5,5) },
}
IMAGES = {
'progbar': {'file':'progressbar_80x8.png' },
'splash': {'file':'pydPiper_fixed_splash.png' }
}
# Load the Widgets that will be used to produce the display pages
WIDGETS = {
'splash': { 'type':'image', 'image':'splash' },
'nowplaying': { 'type':'text', 'format':'{0}', 'variables':['actPlayer|upper'], 'font':'tiny', 'varwidth':True},
'nowplayingdata': { 'type':'text', 'format':'{0} OF {1}', 'variables':['playlist_position', 'playlist_length'], 'font':'tiny', 'just':'right','size':(40,5),'varwidth':True},
'title': { 'type':'text', 'format':'{0}', 'variables':['title'], 'font':'small','varwidth':True,'effect':('scroll','left',5,5,20,'onloop',3,80) },
'artist': { 'type':'text', 'format':'{0}', 'variables':['artist'], 'font':'small','varwidth':True,'effect':('scroll','left',5,5,20,'onloop',3,80)},
'album': { 'type':'text', 'format':'{0}', 'variables':['album'], 'font':'small','varwidth':True,'effect':('scroll','left',5,5,20,'onloop',3,80)},
'playlist_display': { 'type':'text', 'format':'{0}', 'variables':['playlist_display'], 'font':'small', 'varwidth':True },
'elapsed': { 'type':'text', 'format':'{0}', 'variables':['elapsed_formatted'], 'font':'small', 'just':'right', 'size':(50,8), 'varwidth':True },
'time': { 'type':'text', 'format':'{0}', 'variables':['localtime|strftime+%-I:%M'], 'font':'large', 'just':'right', 'varwidth':True, 'size':(50,16) },
'ampm': { 'type':'text', 'format':'{0}', 'variables':['localtime|strftime+%p'], 'font':'tiny', 'varwidth':True },
'tempsmall': { 'type':'text', 'format':'\n{0}', 'variables':['outside_temp_formatted'], 'font':'small', 'just':'right', 'size':(20,16) },
'temphilow': { 'type':'text', 'format':'H {0}\nL {1}', 'variables':['outside_temp_max|int', 'outside_temp_min|int'], 'font':'small', 'just':'right', 'size':(25,16) },
'temp': { 'type':'text', 'format':'{0}', 'variables':['outside_temp_formatted'], 'font':'large', 'just':'center', 'size':(80,16) },
'weather': { 'type':'text', 'format':'{0}', 'variables':['outside_conditions|capitalize'], 'font':'large','varwidth':True, 'size':(55,16), 'effect':('scroll','left',5,5,20,'onloop',3,80)},
'radio': { 'type':'text', 'format':"RADIO", 'font':'tiny', 'varwidth':True, 'size':(40,5), 'just':'right' },
'volume': { 'type':'text', 'format':'VOLUME ({0})', 'variables':['volume'], 'font':'tiny', 'varwidth':True, 'just':'left', 'size':(60,8)},
'volumebar': { 'type':'progressimagebar', 'image':'progbar','value':'volume', 'rangeval':(0,100) },
'songprogress': { 'type':'progressbar', 'value':'elapsed', 'rangeval':(0,'length'), 'size':(80,1) },
'showplay': { 'type':'text', 'format':'\ue000 PLAY', 'font':'large', 'varwidth':True, 'just':'center', 'size':(80,16) },
'showstop': { 'type':'text', 'format':'\ue001 STOP', 'font':'large', 'varwidth':True, 'just':'center', 'size':(80,16) },
'randomsymbol': { 'type':'text', 'format':'\ue002 ', 'font':'large', 'varwidth':True, 'size':(10,16) },
'random': { 'type':'text', 'format':'Random\n{0}', 'variables':['random|onoff|Capitalize'], 'font':'small', 'varwidth':True, 'size':(65,16) },
'repeatoncesymbol': { 'type':'text', 'format':'\ue003 ', 'font':'large', 'varwidth':True, 'size':(10,16) },
'repeatonce': { 'type':'text', 'format':'Repeat Once\n{0}', 'variables':['single|onoff|Capitalize'], 'font':'small', 'varwidth':True, 'just':'center', 'size':(65,16) },
'repeatallsymbol': { 'type':'text', 'format':'\ue004 ', 'font':'large', 'varwidth':True, 'size':(10,16) },
'repeatall': { 'type':'text', 'format':'Repeat All\n{0}', 'variables':['repeat|onoff|Capitalize'], 'font':'small', 'varwidth':True, 'size':(65,16) },
'temptoohigh': { 'type':'text', 'format':'\ue005 Warning System Too Hot ({0})', 'variables':['system_temp_formatted'], 'font':'large', 'varwidth':True, 'effect':('scroll','left',5,5,20,'onstart',3,80) }
}
# Assemble the widgets into canvases. Only needed if you need to combine multiple widgets together so you can produce effects on them as a group.
CANVASES = {
'playartist': { 'widgets': [ ('artist',0,7), ('nowplaying',0,0), ('nowplayingdata',40,0), ('songprogress',0,15) ], 'size':(80,16) },
'playalbum': { 'widgets': [ ('album',0,7), ('nowplaying',0,0), ('nowplayingdata',40,0), ('songprogress',0,15) ], 'size':(80,16) },
'playtitle': { 'widgets': [ ('title',0,7), ('nowplaying',0,0), ('nowplayingdata',40,0), ('songprogress',0,15) ], 'size':(80,16) },
'playartist_radio': { 'widgets': [ ('artist',0,7), ('nowplaying',0,0), ('radio',40,0), ('songprogress', 0,15) ], 'size':(80,16) },
'playalbum_radio': { 'widgets': [ ('album',0,7), ('nowplaying',0,0), ('radio',40,0), ('songprogress', 0,15) ], 'size':(80,16) },
'playtitle_radio': { 'widgets': [ ('title',0,7), ('nowplaying',0,0), ('radio',40,0), ('songprogress',0,15) ], 'size':(80,16) },
'showrandom': { 'widgets': [ ('randomsymbol',0,0), ('random', 15,0) ], 'size':(80,16) },
'showrepeatonce': { 'widgets': [ ('repeatoncesymbol',0,0), ('repeatonce', 15,0) ], 'size':(80,16) },
'showrepeatall': { 'widgets': [ ('repeatallsymbol',0,0), ('repeatall', 15,0) ], 'size':(80,16) },
'blank': { 'widgets': [], 'size':(100,16) },
'stoptime': { 'widgets': [ ('time',10,2), ('ampm',60,2) ], 'size':(80,16) },
'stoptimetemp_popup': { 'widgets': [ ('time',0,2), ('ampm',50,2), ('tempsmall',60,0), ('weather',0,17), ('temphilow',55,16) ], 'size':(80,32), 'effect': ('popup',16,15,10 ) },
'volume_changed': { 'widgets': [ ('volume',5,0), ('volumebar',0,8) ], 'size':(80,16) },
}
# Place the canvases into sequences to display when their condition is met
# More than one sequence can be active at the same time to allow for alert messages
# You are allowed to include a widget in the sequence without placing it on a canvas
# Note about Conditionals
# Conditionals must evaluate to a True or False resulting
# To access system variables, refer to them within the db dictionary (e.g. db['title'])
# To access the most recent previous state of a variable, refer to them within the dbp dictionary (e.g. dbp['title'])
SEQUENCES = [
{ 'name': 'seqSplash', 'canvases': [ { 'name':'splash', 'duration':4 } ], 'conditional': "db['state']=='starting'" },
{
'name': 'seqPlay',
'canvases': [
{ 'name':'playartist', 'duration':15, 'conditional':"not db['stream']=='webradio'" },
{ 'name':'playartist_radio', 'duration':15, 'conditional':"db['stream']=='webradio'" },
{ 'name':'playalbum', 'duration':30, 'conditional':"not db['stream']=='webradio'" },
{ 'name':'playalbum_radio', 'duration':15, 'conditional':"db['stream']=='webradio' and db['album']" },
{ 'name':'playtitle', 'duration':30, 'conditional':"not db['stream']=='webradio'" },
{ 'name':'playtitle_radio', 'duration':15, 'conditional':"db['stream']=='webradio'" },
],
'conditional': "db['state']=='play'"
},
{
'name': 'seqStop',
'canvases': [
{ 'name':'stoptimetemp_popup', 'duration':9999, 'conditional':"not db['outside_conditions']=='No data'" },
{ 'name':'stoptime', 'duration':9999, 'conditional':"db['outside_conditions']=='No data'" }
],
'conditional': "db['state']=='stop' or db['state']=='pause'"
},
{
'name':'seqVolume',
'coordinates':(0,0),
'canvases': [ { 'name':'volume_changed', 'duration':2 } ],
'conditional': "db['volume'] != dbp['volume']",
'minimum':2,
},
{
'name': 'seqAnnouncePlay',
'canvases': [ { 'name':'showplay', 'duration':2 } ],
'conditional': "db['state'] != dbp['state'] and db['state']=='play'",
'minimum':2,
},
{
'name': 'seqAnnounceStop',
'canvases': [ { 'name':'showstop', 'duration':2 } ],
'conditional': "db['state'] != dbp['state'] and db['state']=='stop'",
'minimum':2,
},
{
'name':'seqAnnounceRandom',
'canvases': [ { 'name':'showrandom', 'duration':2 } ],
'conditional': "db['random'] != dbp['random']",
'minimum':2,
},
{
'name':'seqAnnounceSingle',
'canvases': [ { 'name':'showrepeatonce', 'duration':2 } ],
'conditional': "db['single'] != dbp['single']",
'minimum':2,
},
{
'name':'seqAnnounceRepeat',
'canvases': [ { 'name':'showrepeatall', 'duration':2 } ],
'conditional': "db['repeat'] != dbp['repeat']",
'minimum':2,
},
{
'name':'seqAnnounceTooHot',
'canvases': [ { 'name':'temptoohigh', 'duration':5 } ],
'conditional': "db['system_tempc'] > 85",
'minimum':5,
'coolingperiod':30
}
]