Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ ⎇ branch:  streamtuner2


Check-in [5b7a717f18]

Overview
Comment:timer: Test for .queue() result before setting statusbar := "Timer saved"
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5b7a717f18b48cf5f61e22850591554580d09d42
User & Date: mario on 2017-01-08 13:38:29
Other Links: manifest | tags
Context
2017-01-09
16:04
failed attempt to make config tables resizeable check-in: 83f54d5ffd user: mario tags: trunk
2017-01-08
13:38
timer: Test for .queue() result before setting statusbar := "Timer saved" check-in: 5b7a717f18 user: mario tags: trunk
12:46
Check for windows-style paths in specbuttons file lookup check-in: 49f14d5102 user: mario tags: trunk
Changes

Modified channels/timer.py from [54b6176f28] to [cdf566259d].

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
146
147
148
149
150
151

152
153
154
155
156
157
158
        # add data
        row["listformat"] = "href" #self.parent.channel().listformat
        if row.get(self.timefield):
            row["title"] = row["title"] + " -- " + row[self.timefield]
        row[self.timefield] = timespec

        # store
        self.save_timer(row)
        self.parent.status("Timer saved.")
    
    
    # store row in timer database
    def save_timer(self, row):
        self.streams.append(row)
        self.bookmarks.save()
        self.queue(row)
        pass
        
        
    # Add timer/recording events to scheduler (or later crontab)
    def queue(self, row):
    
        # chk
        if not row.get(self.timefield) or not row.get("url"):
            #log.DATA("NO TIME DATA", row)
            return
    
        # extract timing parameters
        _ = row[self.timefield]
        days = self.days(_)
        time = self.time(_)
        duration = self.duration(_)
        
        # which action
        if row[self.timefield].find("rec")>=0:
            activity, action_method = "record", self.record
        else:
            activity, action_method = "play", self.play
        
        # add
        if days and time and activity:
            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) )

        else:
            log.ERR_QUEUE( activity, self.sched, (action_method, activity, days, None, time, kronos.method.threaded, [row], {}) )
    
    
    
    # converts Mon,Tue,... into numeric 1-7
    def days(self, s):







|
|






|
<







|
<

















>







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
146
147
148
149
150
151
152
153
154
155
156
157
        # add data
        row["listformat"] = "href" #self.parent.channel().listformat
        if row.get(self.timefield):
            row["title"] = row["title"] + " -- " + row[self.timefield]
        row[self.timefield] = timespec

        # store
        if self.save_timer(row):
            self.status("Timer saved.")
    
    
    # store row in timer database
    def save_timer(self, row):
        self.streams.append(row)
        self.bookmarks.save()
        return self.queue(row)

        
        
    # Add timer/recording events to scheduler (or later crontab)
    def queue(self, row):
    
        # chk
        if not row.get(self.timefield) or not row.get("url"):
            return log.DATA("NO TIME DATA", row)

    
        # extract timing parameters
        _ = row[self.timefield]
        days = self.days(_)
        time = self.time(_)
        duration = self.duration(_)
        
        # which action
        if row[self.timefield].find("rec")>=0:
            activity, action_method = "record", self.record
        else:
            activity, action_method = "play", self.play
        
        # add
        if days and time and activity:
            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) )
            return True
        else:
            log.ERR_QUEUE( activity, self.sched, (action_method, activity, days, None, time, kronos.method.threaded, [row], {}) )
    
    
    
    # converts Mon,Tue,... into numeric 1-7
    def days(self, s):