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 | #
# api: streamtuner2
# title: Recording timer
# description: Schedules play/record events for bookmarked radio stations.
# type: feature
# category: hook
# depends: kronos
# version: 0.7
# config: -
# priority: optional
# support: unsupported
#
# Provides an internal timer, to configure recording and playback times/intervals
# for stations. It accepts a natural language time string when registering a stream.
#
# Context menu > Extension > Add timer
#
# Programmed events are visible in "timer" under the "bookmarks" channel. Times
# are stored in the description field, and can thus be edited. However, after editing
# times manually, streamtuner2 must be restarted for any changes to take effect.
#
from config import *
from channels import *
import bundle.kronos as kronos # Doesn't work with Python3
from uikit import uikit
import action |
|
>
>
>
| 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 | #
# api: streamtuner2
# title: Recording timer
# description: Schedules play/record events for bookmarked radio stations.
# type: feature
# category: hook
# depends: kronos
# version: 0.7.1
# config: -
# priority: optional
# support: unsupported
#
# Provides an internal timer, to configure recording and playback times/intervals
# for stations. It accepts a natural language time string when registering a stream.
#
# Context menu > Extension > Add timer
#
# Programmed events are visible in "timer" under the "bookmarks" channel. Times
# are stored in the description field, and can thus be edited. However, after editing
# times manually, streamtuner2 must be restarted for any changes to take effect.
#
# Allowable time specifications are "Mon,Wed,Fri 18:00-20:00 record"
# or even "Any 7:00-12:00 play". Though the length isn't honored currently.
#
from config import *
from channels import *
import bundle.kronos as kronos # Doesn't work with Python3
from uikit import uikit
import action |
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153 | # add
task = self.sched.add_daytime_task(action_method, activity, days, None, time, kronos.method.threaded, [row], {})
log.QUEUE( activity, self.sched, (action_method, activity, days, None, time, kronos.method.threaded, [row], {}), task.get_schedule_time(True) )
# converts Mon,Tue,... into numberics 1-7
def days(self, s):
weekdays = ["su", "mo", "tu", "we", "th", "fr", "sa", "su"]
r = []
for day in re.findall("\w\w+", s.lower()):
day = day[0:2]
if day in weekdays:
r.append(weekdays.index(day))
return list(set(r))
# get start time 18:00 |
|
>
>
| 139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158 | # add
task = self.sched.add_daytime_task(action_method, activity, days, None, time, kronos.method.threaded, [row], {})
log.QUEUE( activity, self.sched, (action_method, activity, days, None, time, kronos.method.threaded, [row], {}), task.get_schedule_time(True) )
# converts Mon,Tue,... into numeric 1-7
def days(self, s):
weekdays = ["su", "mo", "tu", "we", "th", "fr", "sa", "su"]
r = []
if re.search("any|all|\*", s, re.I):
return range(0,7)
for day in re.findall("\w\w+", s.lower()):
day = day[0:2]
if day in weekdays:
r.append(weekdays.index(day))
return list(set(r))
# get start time 18:00 |