Fixed identation (again)

This commit is contained in:
elpatron68 2019-07-28 15:32:58 +02:00
parent 83c458261c
commit 58a654199a

View File

@ -389,35 +389,35 @@ class MumbleBot:
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 += '<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>'
# Full message as html table # Full message as html table
if len(msg) <= 5000:
self.send_msg(msg, text)
# Shorten message if message too long (stage I)
else:
logging.debug('Result too long stage I')
msg = var.config.get('strings', 'rbqueryresult') + " :" + ' (shortened L1)'
msg += '\n<table><tr><th>!rbplay ID</th><th>Station Name</th></tr>'
for s in rb_stations:
stationid = s['id']
stationname = s['stationname']
# 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)
# Shorten message if message too long (stage I) # Shorten message if message too long (stage II)
else: else:
logging.debug('Result too long stage I') logging.debug('Result too long stage II')
msg = var.config.get('strings', 'rbqueryresult') + " :" + ' (shortened L1)' msg = var.config.get('strings', 'rbqueryresult') + " :" + ' (shortened L2)'
msg += '\n<table><tr><th>!rbplay ID</th><th>Station Name</th></tr>' msg += '!rbplay ID - Station Name'
for s in rb_stations: for s in rb_stations:
stationid = s['id'] stationid = s['id']
stationname = s['stationname'] stationname = s['stationname'][:12]
# msg += f'<tr><td>{stationid}</td><td>{stationname}</td>' # msg += f'{stationid} - {stationname}'
msg += '<tr><td>%s</td><td>%s</td>' % (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)
# Shorten message if message too long (stage II) # Message still too long
else: else:
logging.debug('Result too long stage II') self.send_msg('Query result too long to post (> 5000 characters), please try another query.', text)
msg = var.config.get('strings', 'rbqueryresult') + " :" + ' (shortened L2)'
msg += '!rbplay ID - Station Name'
for s in rb_stations:
stationid = s['id']
stationname = s['stationname'][:12]
# msg += f'{stationid} - {stationname}'
msg += '%s - %s' % (stationid, stationname)
if len(msg) <= 5000:
self.send_msg(msg, text)
# Message still too long
else:
self.send_msg('Query result too long to post (> 5000 characters), please try another query.', text)
# Play a secific station (by id) from http://www.radio-browser.info API # Play a secific station (by id) from http://www.radio-browser.info API
elif command == var.config.get('command', 'rb_play'): elif command == var.config.get('command', 'rb_play'):
logging.debug('Play a station by ID') logging.debug('Play a station by ID')