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

⌈⌋ ⎇ branch:  streamtuner2


Check-in [9febd83e03]

Overview
Comment:Readd support for timer record durations 01:00-02:00, streamripper only.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9febd83e03c22f25fba1aa9c3fb0c073b06533c1
User & Date: mario on 2015-11-10 23:25:47
Other Links: manifest | tags
Context
2015-11-10
23:26
Add dependency. check-in: 02558ef729 user: mario tags: trunk
23:25
Readd support for timer record durations 01:00-02:00, streamripper only. check-in: 9febd83e03 user: mario tags: trunk
2015-11-09
21:37
Permit "Any" or "All" in time specifications (for all weekdays). check-in: 6402b2ce1d user: mario tags: trunk
Changes

Modified action.py from [31399c2ae9] to [96185346f2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# encoding: UTF-8
# api: streamtuner2
# type: functions
# category: io
# title: play/record actions
# description: Starts audio applications, guesses MIME types for URLs
# version: 1.1
# priority: core
#
# Multimedia interface for starting audio players, recording app,
# or web browser (listed as "url/http" association in players).
# It maps audio MIME types, and extracts/converts playlist types
# (PLS, M3U, XSPF, SMIL, JSPF, ASX, raw urls).
#






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
# encoding: UTF-8
# api: streamtuner2
# type: functions
# category: io
# title: play/record actions
# description: Starts audio applications, guesses MIME types for URLs
# version: 1.1.1
# priority: core
#
# Multimedia interface for starting audio players, recording app,
# or web browser (listed as "url/http" association in players).
# It maps audio MIME types, and extracts/converts playlist types
# (PLS, M3U, XSPF, SMIL, JSPF, ASX, raw urls).
#
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
159
160
161
162
163
164
165
166
    except: log.ERR("Command not found:", cmd)

# Open help browser, streamtuner2 pages
def help(*args):
    run("yelp /usr/share/doc/streamtuner2/help/")

# Invokes player/recorder for stream url and format
def run_fmt_url(row={}, audioformat="audio/mpeg", source="pls", assoc={}):
    if audioformat in handler:
        handler[audioformat](row, audioformat, source, assoc)
    else:
        cmd = mime_app(audioformat, assoc)
        cmd = interpol(cmd, source, row)


        run(cmd)

# Start web browser
def browser(url):
    run_fmt_url({"url": url, "homepage": url}, "url/http", "srv", conf.play)

# Calls player for stream url and format
def play(row={}, audioformat="audio/mpeg", source="pls"):
    run_fmt_url(row, audioformat, source, conf.play)

# Call streamripper / youtube-dl / wget
def record(row={}, audioformat="audio/mpeg", source="href"):
    run_fmt_url(row, audioformat, source, conf.record)


# OS shell command escaping
#
def quote(ins):
    if type(ins) is list:
        return " ".join(["%r" % str(s) for s in ins])







|





>
>











|
|







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
159
160
161
162
163
164
165
166
167
168
    except: log.ERR("Command not found:", cmd)

# Open help browser, streamtuner2 pages
def help(*args):
    run("yelp /usr/share/doc/streamtuner2/help/")

# Invokes player/recorder for stream url and format
def run_fmt_url(row={}, audioformat="audio/mpeg", source="pls", assoc={}, append=None):
    if audioformat in handler:
        handler[audioformat](row, audioformat, source, assoc)
    else:
        cmd = mime_app(audioformat, assoc)
        cmd = interpol(cmd, source, row)
        if append:
            cmd = re.sub('(["\']?\s*)$', " " + append + "\\1", cmd)
        run(cmd)

# Start web browser
def browser(url):
    run_fmt_url({"url": url, "homepage": url}, "url/http", "srv", conf.play)

# Calls player for stream url and format
def play(row={}, audioformat="audio/mpeg", source="pls"):
    run_fmt_url(row, audioformat, source, conf.play)

# Call streamripper / youtube-dl / wget
def record(row={}, audioformat="audio/mpeg", source="href", append=None):
    run_fmt_url(row, audioformat, source, conf.record, append=append)


# OS shell command escaping
#
def quote(ins):
    if type(ins) is list:
        return " ".join(["%r" % str(s) for s in ins])

Modified channels/timer.py from [42e8a3d71a] to [9fca69ef1b].

1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
#
# 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







|
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#
# api: streamtuner2
# title: Recording timer
# description: Schedules play/record events for bookmarked radio stations.
# type: feature
# category: hook
# depends: kronos
# version: 0.7.2
# config: 
#   { name: timer_duration, type: select, select: "none|streamripper", value: none, description: support for time ranges }
# 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
180
181
182
183
184
185
186

187

188

189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
        )

    # action wrapper
    def record(self, row, *args, **kwargs):
        log.TIMER("TIMED RECORD", *args)
        
        # extra params

        duration = self.duration(row.get(self.timefield))

        if duration:

            append = " -a %S.%d.%q -l "+str(duration*60)   # make streamripper record a whole broadcast
        else:
            append = ""

        # start recording
        action.record(
            row = row,
            audioformat = row.get("format","audio/mpeg"), 
            source = row.get("listformat","href")
            #append = append,
        )
    
    def test(self, row, *args, **kwargs):
        log.TEST("KRONOS", row)









>

>

>
|
<
|





|
|






181
182
183
184
185
186
187
188
189
190
191
192
193

194
195
196
197
198
199
200
201
202
203
204
205
206
207
        )

    # action wrapper
    def record(self, row, *args, **kwargs):
        log.TIMER("TIMED RECORD", *args)
        
        # extra params
        # make streamripper record a timed broadcast
        duration = self.duration(row.get(self.timefield))
        append = None
        if duration:
            _rec = conf.record.get("audio/*", "")
            if re.search("streamripper", _rec):

                append = "-a %S.%d.%q -l " + str(duration*60)

        # start recording
        action.record(
            row = row,
            audioformat = row.get("format","audio/mpeg"), 
            source = row.get("listformat","href"),
            append = append,
        )
    
    def test(self, row, *args, **kwargs):
        log.TEST("KRONOS", row)