Check-in [d253deb912]
Overview
| Comment: | More specific command argument quoting for Windows. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
d253deb912b7986f14da3de01e7eb3bf |
| User & Date: | mario on 2016-11-06 01:56:48 |
| Other Links: | manifest | tags |
Context
|
2016-11-06
| ||
| 01:57 | Keep some notes about how to specify application paths on Windows. check-in: 2fb9158589 user: mario tags: trunk | |
| 01:56 | More specific command argument quoting for Windows. check-in: d253deb912 user: mario tags: trunk | |
|
2016-11-05
| ||
| 23:55 | Reciva: add search function check-in: 30cdbc9ba4 user: mario tags: trunk | |
Changes
Modified action.py from [114f820dd5] to [8f35066d04].
| ︙ | ︙ | |||
160 161 162 163 164 165 166 167 |
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:
| > > > > | | | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
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 conf.windows:
Q = '"%s%"'
else:
Q = "%r"
if type(ins) is list:
return " ".join([Q % str(s) for s in ins])
else:
return Q % str(ins)
# Convert e.g. "text/x-scpls" MIME types to just "pls" monikers
#
def listfmt(t = "pls"):
return listfmt_t.get(t, t) # e.g. "pls" or still "text/x-unknown"
|
| ︙ | ︙ | |||
194 195 196 197 198 199 200 |
# ยท Replace .pls URL with local .m3u file depending on map.
#
def interpol(cmd, source="pls", row={}, add_default=True):
row = copy.copy(row)
# Inject other meta fields (%title, %genre, %playing, %format, etc.)
rx_keys = "[\$\%](" + "|".join(row.keys()) + ")\\b"
| | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# ยท Replace .pls URL with local .m3u file depending on map.
#
def interpol(cmd, source="pls", row={}, add_default=True):
row = copy.copy(row)
# Inject other meta fields (%title, %genre, %playing, %format, etc.)
rx_keys = "[\$\%](" + "|".join(row.keys()) + ")\\b"
cmd = re.sub(rx_keys, lambda m: quote(str(row.get(m.group(1)))), cmd)
# Add default %pls if cmd has no %url placeholder
if add_default and cmd.find("%") < 0:
cmd = cmd + " %pls"
# "pls" as default requires no conversion for most channels, and seems broadly supported by players
# Playlist type placeholders (%pls, %m3u, %xspf, etc.)
|
| ︙ | ︙ |