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

⌈⌋ branch:  streamtuner2


Diff

Differences From Artifact [114f820dd5]:

To Artifact [8f35066d04]:


162
163
164
165
166




167
168

169
170

171
172
173
174
175
162
163
164
165
166
167
168
169
170
171

172
173

174
175
176
177
178
179





+
+
+
+

-
+

-
+






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


# Convert e.g. "text/x-scpls" MIME types to just "pls" monikers
#
def listfmt(t = "pls"):
196
197
198
199
200
201

202
203
204
205
206
200
201
202
203
204

205
206
207
208
209
210





-
+




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: "%r" % str(row.get(m.group(1))), cmd)
    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