mirror of
https://github.com/NohamR/TransmissionBot.git
synced 2025-05-24 14:22:00 +00:00
bigfix
* fix divide by zero in `t/summary` if no transfers in list (oops) * fix error in resume all
This commit is contained in:
parent
5dd6e778c0
commit
af09ede67f
10
bot.py
10
bot.py
@ -642,7 +642,7 @@ def resume_torrents(torrents=[], reason=DEFAULT_REASON, start_all=False):
|
|||||||
if start_all:
|
if start_all:
|
||||||
if not CONFIG['dryrun']:
|
if not CONFIG['dryrun']:
|
||||||
TSCLIENT.start_all()
|
TSCLIENT.start_all()
|
||||||
logger.info("Resumed: all transfers\n\tReason: {}\n\tDry run: {}".format(torrent.name, torrent.hashString, reason, CONFIG['dryrun']))
|
logger.info("Resumed: all transfers\n\tReason: {}\n\tDry run: {}".format(reason, CONFIG['dryrun']))
|
||||||
else:
|
else:
|
||||||
for torrent in (torrents if len(torrents) > 0 else TSCLIENT.get_torrents()):
|
for torrent in (torrents if len(torrents) > 0 else TSCLIENT.get_torrents()):
|
||||||
if torrent.status == "stopped":
|
if torrent.status == "stopped":
|
||||||
@ -1331,9 +1331,9 @@ def torSummary(torrents, repeat_msg_key=None, show_repeat=True):
|
|||||||
totDown = humanbytes(sumDown)
|
totDown = humanbytes(sumDown)
|
||||||
totUp = humanbytes(sumUp)
|
totUp = humanbytes(sumUp)
|
||||||
|
|
||||||
totRatio = '{:.2f}'.format(sumUp / sumDown)
|
totRatio = '{:.2f}'.format((sumUp / sumDown) if sumDown > 0 else 0)
|
||||||
|
|
||||||
totDownRatio = '{:.2f}'.format(sumDown / sumTot * 100.0)
|
totDownRatio = '{:.2f}'.format((sumDown / sumTot * 100.0) if sumTot > 0 else 0)
|
||||||
|
|
||||||
numTopRatios = min([len(torrents),CONFIG['summary_num_top_ratio']])
|
numTopRatios = min([len(torrents),CONFIG['summary_num_top_ratio']])
|
||||||
topRatios = "• Top {} ratio{}:".format(numTopRatios,"s" if numTopRatios != 1 else "")
|
topRatios = "• Top {} ratio{}:".format(numTopRatios,"s" if numTopRatios != 1 else "")
|
||||||
@ -1945,10 +1945,6 @@ async def modify(message, content=""):
|
|||||||
embed.set_author(name="No matching transfers found!", icon_url=CONFIG['logo_url'])
|
embed.set_author(name="No matching transfers found!", icon_url=CONFIG['logo_url'])
|
||||||
embeds = [embed]
|
embeds = [embed]
|
||||||
else:
|
else:
|
||||||
try:
|
|
||||||
await message.delete()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
ops = ["pauseall","resumeall"]
|
ops = ["pauseall","resumeall"]
|
||||||
opNames = ["pause all","resume all"]
|
opNames = ["pause all","resume all"]
|
||||||
opEmoji = ['⏸','▶️']
|
opEmoji = ['⏸','▶️']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user