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
|
#
# api: streamtuner2
# title: Recording timer
# description: Schedules play/record events for bookmarked radio stations.
# type: feature
# category: hook
# depends: kronos
# version: 0.5
# config: -
# priority: optional
# support: unsupported
#
# Okay, while programming this, I missed the broadcast I wanted to hear. Again(!)
# But still this is a useful extension, as it allows recording and playing specific
# stations at a programmed time and interval. It accepts a natural language time
# string when registering a stream. (Via streams 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 the changes to take effect.
#
from config import *
from channels import *
import bundle.kronos as kronos # Doesn't work with Python3
from uikit import uikit
|
|
|
<
|
>
|
|
|
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
|
#
# api: streamtuner2
# title: Recording timer
# description: Schedules play/record events for bookmarked radio stations.
# type: feature
# category: hook
# depends: kronos
# version: 0.6
# 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
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
class timer:
# plugin info
module = "timer"
title = "Timer"
meta = plugin_meta()
# configuration settings
timefield = "playing"
# kronos scheduler list
sched = None
# prepare gui
def __init__(self, parent):
if parent:
|
<
<
<
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
class timer:
# plugin info
module = "timer"
title = "Timer"
meta = plugin_meta()
# configuration settings
timefield = "playing"
# kronos scheduler list
sched = None
# prepare gui
def __init__(self, parent):
if parent:
|
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
|
# target channel
if not self.bookmarks.streams.get("timer"):
self.bookmarks.streams["timer"] = [{"title":"--- timer events ---"}]
self.bookmarks.add_category("timer")
self.streams = self.bookmarks.streams["timer"]
# widgets
parent.add_signals.update({
"timer_ok": self.add_timer,
"timer_cancel": lambda w,*a: self.parent.timer_dialog.hide() or 1,
})
# prepare spool
self.sched = kronos.ThreadedScheduler()
for row in self.streams:
try: self.queue(row)
except Exception as e: __print__(dbg.ERR, "queuing error", e)
self.sched.start()
# display GUI for setting timespec
def edit_timer(self, *w):
self.parent.timer_dialog.show()
self.parent.timer_value.set_text("Fri,Sat 20:00-21:00 play")
# close dialog,get data
def add_timer(self, *w):
self.parent.timer_dialog.hide()
row = self.parent.row()
row = copy.copy(row)
# add data
|
|
|
|
>
>
>
>
>
>
|
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
|
# target channel
if not self.bookmarks.streams.get("timer"):
self.bookmarks.streams["timer"] = [{"title":"--- timer events ---"}]
self.bookmarks.add_category("timer")
self.streams = self.bookmarks.streams["timer"]
# widgets
uikit.add_signals(parent, {
("timer_ok", "clicked"): self.add_timer,
("timer_cancel", "clicked"): self.hide,
("timer_dialog", "close"): self.hide,
("timer_dialog", "delete-event"): self.hide,
})
# prepare spool
self.sched = kronos.ThreadedScheduler()
for row in self.streams:
try: self.queue(row)
except Exception as e: __print__(dbg.ERR, "queuing error", e)
self.sched.start()
# display GUI for setting timespec
def edit_timer(self, *w):
self.parent.timer_dialog.show()
self.parent.timer_value.set_text("Fri,Sat 20:00-21:00 play")
# done
def hide(self, *w):
return self.parent.timer_dialog.hide()
# close dialog,get data
def add_timer(self, *w):
self.parent.timer_dialog.hide()
row = self.parent.row()
row = copy.copy(row)
# add data
|