Check-in [0a425cfb5d]
Overview
| Comment: | Adapt urn_resolve() invocation. Most handlers update the dict in place. A few will return a new row however. (This can be utilized to return a copy, instead of changing station entries → menat for user "script stations" plugin.) |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
0a425cfb5d3e7f9d0974686e2a8c7b55 |
| User & Date: | mario on 2016-12-17 11:01:22 |
| Other Links: | manifest | tags |
Context
|
2016-12-17
| ||
| 11:14 | new plugin: script stations, for single-station extractiong/user scripts check-in: 8a77525fb0 user: mario tags: trunk | |
| 11:01 | Adapt urn_resolve() invocation. Most handlers update the dict in place. A few will return a new row however. (This can be utilized to return a copy, instead of changing station entries → menat for user "script stations" plugin.) check-in: 0a425cfb5d user: mario tags: trunk | |
| 10:52 | streema: fix search using right parameter (search= instead of cat=) check-in: 35e6840757 user: mario tags: trunk | |
Changes
Modified action.py from [476ab89429] to [078f11948a].
| ︙ | ︙ | |||
155 156 157 158 159 160 161 |
return run(("%s/help.chm" % path).replace("/", '\\'))
else:
return run("yelp %s" % path)
return browser("http://fossil.include-once.org/streamtuner2/doc/tip/help/html/index.html")
# Invokes player/recorder for stream url and format
def run_fmt_url(row={}, audioformat="audio/mpeg", source="pls", assoc={}, append=None, cmd=None, add_default=True):
| | | > | < | | | | | | | | | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
return run(("%s/help.chm" % path).replace("/", '\\'))
else:
return run("yelp %s" % path)
return browser("http://fossil.include-once.org/streamtuner2/doc/tip/help/html/index.html")
# Invokes player/recorder for stream url and format
def run_fmt_url(row={}, audioformat="audio/mpeg", source="pls", assoc={}, append=None, cmd=None, add_default=True):
# look for specific "audio/type"
if audioformat in handler:
return handler[audioformat](row, audioformat, source, assoc)
# or "urn:service:…" resolvers (though this is usally done by genericchannel.row() already)
elif row.get("url", "").startswith("urn:"):
row = resolve_urn(row) or row
# use default handler for mime type
if not cmd:
cmd = mime_app(audioformat, assoc)
# replace %u, %url or $title placeholders
cmd = interpol(cmd, source, row, add_default=add_default)
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"):
|
| ︙ | ︙ |
Modified channels/__init__.py from [55add89636] to [96d271c529].
| ︙ | ︙ | |||
260 261 262 263 264 265 266 |
# Currently selected entry in stations list, return complete data dict
def row(self):
row = self.stations() [ self.rowno() ]
# resolve stream url for some plugins
if row.get("url", "urn:x-streamtuner2:no").startswith("urn:"):
self.status("Resolving actual stream URL for `%s`" % row["url"], timeout=2)
| > | | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# Currently selected entry in stations list, return complete data dict
def row(self):
row = self.stations() [ self.rowno() ]
# resolve stream url for some plugins
if row.get("url", "urn:x-streamtuner2:no").startswith("urn:"):
self.status("Resolving actual stream URL for `%s`" % row["url"], timeout=2)
# most urn: handlers update `row` - some return a new value - which is handled in action.run_fmt_url() however
action.resolve_urn(row) # row = ..() or row
return row
# Fetches a single varname from currently selected station entry
def selected(self, name="url"):
return self.row().get(name)
# Inject status icon into currently selected row (used by main.bookmark() call)
|
| ︙ | ︙ |