Index: action.py ================================================================== --- action.py +++ action.py @@ -2,11 +2,11 @@ # api: streamtuner2 # type: functions # category: io # title: play/record actions # description: Starts audio applications, guesses MIME types for URLs -# version: 1.1 +# 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 @@ -136,16 +136,18 @@ # 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={}): +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) @@ -153,12 +155,12 @@ # 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) +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): Index: channels/timer.py ================================================================== --- channels/timer.py +++ channels/timer.py @@ -3,12 +3,13 @@ # title: Recording timer # description: Schedules play/record events for bookmarked radio stations. # type: feature # category: hook # depends: kronos -# version: 0.7.1 -# config: - +# 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. @@ -182,23 +183,25 @@ # 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: - append = " -a %S.%d.%q -l "+str(duration*60) # make streamripper record a whole broadcast - else: - append = "" + _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, + source = row.get("listformat","href"), + append = append, ) def test(self, row, *args, **kwargs): log.TEST("KRONOS", row)