Changed string formatting to %s
This commit is contained in:
18
mumbleBot.py
18
mumbleBot.py
@ -385,7 +385,8 @@ class MumbleBot:
|
|||||||
codec = s['codec']
|
codec = s['codec']
|
||||||
bitrate = s['bitrate']
|
bitrate = s['bitrate']
|
||||||
genre = s['genre']
|
genre = s['genre']
|
||||||
msg += f'<tr><td>{stationid}</td><td>{stationname}</td><td>{genre}</td><td>{codec}/{bitrate}</td><td>{country}</td></tr>'
|
# msg += f'<tr><td>{stationid}</td><td>{stationname}</td><td>{genre}</td><td>{codec}/{bitrate}</td><td>{country}</td></tr>'
|
||||||
|
msg += '<tr><td>%s</td><td>%s</td><td>%s</td><td>%s/%s</td><td>%s</td></tr>' % (stationid, stationname, genre, codec, bitrate, country)
|
||||||
msg += '</table>'
|
msg += '</table>'
|
||||||
# Shorten table if message too long
|
# Shorten table if message too long
|
||||||
if len(msg) < 5000:
|
if len(msg) < 5000:
|
||||||
@ -395,7 +396,8 @@ class MumbleBot:
|
|||||||
for s in rb_stations:
|
for s in rb_stations:
|
||||||
stationid = s['id']
|
stationid = s['id']
|
||||||
stationname = s['stationname']
|
stationname = s['stationname']
|
||||||
msg += f'<tr><td>{stationid}</td><td>{stationname}</td>'
|
# msg += f'<tr><td>{stationid}</td><td>{stationname}</td>'
|
||||||
|
msg += '<tr><td>%s</td><td>%s</td>' % (stationid, stationname)
|
||||||
if len(msg) < 5000:
|
if len(msg) < 5000:
|
||||||
self.send_msg(msg, text)
|
self.send_msg(msg, text)
|
||||||
else:
|
else:
|
||||||
@ -405,7 +407,8 @@ class MumbleBot:
|
|||||||
for s in rb_stations:
|
for s in rb_stations:
|
||||||
stationid = s['id']
|
stationid = s['id']
|
||||||
stationname = s['stationname'][:12]
|
stationname = s['stationname'][:12]
|
||||||
msg += f'{stationid} - {stationname}'
|
# msg += f'{stationid} - {stationname}'
|
||||||
|
msg += '%s - %s' % (stationid, stationname)
|
||||||
if len(msg) < 5000:
|
if len(msg) < 5000:
|
||||||
self.send_msg(msg, text)
|
self.send_msg(msg, text)
|
||||||
else:
|
else:
|
||||||
@ -426,10 +429,13 @@ class MumbleBot:
|
|||||||
bitrate = rstation[0]['bitrate']
|
bitrate = rstation[0]['bitrate']
|
||||||
genre = rstation[0]['tags']
|
genre = rstation[0]['tags']
|
||||||
homepage = rstation[0]['homepage']
|
homepage = rstation[0]['homepage']
|
||||||
msg = f'Start playing radio station:'
|
msg = 'Start playing radio station:'
|
||||||
|
# msg += '<table><tr><th>ID</th><th>Station Name</th><th>Genre</th><th>Codec/Bitrate</th><th>Country</th><th>Homepage</th></tr>' + \
|
||||||
|
# f'<tr><td>{parameter}</td><td>{stationname}</td><td>{genre}</td><td>{codec}/{bitrate}</td><td>{country}</td><td>{homepage}</td></tr></table>'
|
||||||
msg += '<table><tr><th>ID</th><th>Station Name</th><th>Genre</th><th>Codec/Bitrate</th><th>Country</th><th>Homepage</th></tr>' + \
|
msg += '<table><tr><th>ID</th><th>Station Name</th><th>Genre</th><th>Codec/Bitrate</th><th>Country</th><th>Homepage</th></tr>' + \
|
||||||
f'<tr><td>{parameter}</td><td>{stationname}</td><td>{genre}</td><td>{codec}/{bitrate}</td><td>{country}</td><td>{homepage}</td></tr></table>'
|
'<tr><td>%s</td><td>%s</td><td>%s</td><td>%s/%s</td><td>%s</td><td>%s</td></tr></table>' \
|
||||||
logging.debug(f'Play radio station {stationname}')
|
% (parameter, stationname, genre, codec, bitrate, country, homepage)
|
||||||
|
logging.debug('Play radio station %s' % stationname)
|
||||||
self.send_msg(msg, text)
|
self.send_msg(msg, text)
|
||||||
url = radiobrowser.geturl_byid(parameter)
|
url = radiobrowser.geturl_byid(parameter)
|
||||||
if url != "-1":
|
if url != "-1":
|
||||||
|
Reference in New Issue
Block a user