forked from moppermonster/kiosky
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.py
40 lines (34 loc) · 1.09 KB
/
page.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
'''Kiosk main functions and classes'''
class Channels():
"""
Holds dicts of pages
Pages have a uuid name
Pages have a list of urls, current position and refresh time
"""
def __init__(self):
self.channels = {
'_standby': [10, 0, [
'https://www.dutchsec.com',
'https://opensource-academy.github.io',
]]
}
def position_update(self, name):
"""Position +1 or reset to 0 at end of list"""
channels = self.channels[name][2]
position = self.channels[name][1]
if position < len(channels)-1:
self.channels[name][1] += 1
else:
self.channels[name][1] = 0
def add(self, name, pages, time):
"""
Add a list of urls to pages
pages = list of urls
time = time before refresh in seconds
"""
position = 0
self.channels.update({name: [time, position, pages]})
def remove(self, name):
"""Remove entry name from pages dict"""
if name in self.channels:
del self.channels[name]