def get_speed_text(): fdict = {} transfer_info = qb.global_transfer_info fdict['current_download_speed'] = u.get_human_readable(transfer_info['dl_info_speed']) fdict['current_upload_speed'] = u.get_human_readable(transfer_info['up_info_speed']) preferences = qb.preferences() fdict['global_down_limit'] = u.get_human_readable(preferences['dl_limit']) if preferences['dl_limit'] else 'none' fdict['global_up_limit'] = u.get_human_readable(preferences['up_limit']) if preferences['up_limit'] else 'none' fdict['alt_speed_status'] = 'on' if qb.get_alternative_speed_status() else 'off' fdict['alt_speed_down'] = u.get_human_readable(preferences['alt_dl_limit'], 0) if preferences[ 'alt_dl_limit'] > -1 else 'none' fdict['alt_speed_up'] = u.get_human_readable(preferences['alt_up_limit'], 0) if preferences[ 'alt_up_limit'] > -1 else 'none' fdict['queueing_max_active_downloads'] = preferences['max_active_downloads'] fdict['queueing_max_active_uploads'] = preferences['max_active_uploads'] fdict['queueing_max_active_torrents'] = preferences['max_active_torrents'] fdict['queueing_count_slow_torrents'] = 'no' if preferences['dont_count_slow_torrents'] else 'yes' fdict['queueing_slow_torrent_down_threshold'] = preferences['slow_torrent_dl_rate_threshold'] fdict['queueing_slow_torrent_up_threshold'] = preferences['slow_torrent_ul_rate_threshold'] fdict['queueing_slow_torrent_inactive_timer'] = preferences['slow_torrent_inactive_timer'] fdict['max_ratio_enabled'] = "yes" if preferences['max_ratio_enabled'] else "no" fdict['max_ratio'] = preferences['max_ratio'] fdict['max_seeding_time_enabled'] = "yes" if preferences['max_seeding_time_enabled'] else "no" fdict['max_seeding_time'] = preferences['max_seeding_time'] fdict['max_ratio_act'] = "pause" if preferences['max_ratio_act'] == 0 else "remove" # 0 = pause them, 1 = remove them return TEXT.format(**fdict)
def on_settings_command(update: Update, context: CallbackContext): logger.info('/settings from %s', update.effective_user.first_name) preferences = qb.preferences() lines = sorted(['{}: <code>{}</code>'.format(k, v) for k, v in preferences.items()]) for strings_chunk in u.split_text(lines): update.message.reply_html('\n'.join(strings_chunk), disable_web_page_preview=True)
def on_atm_command(update: Update, context: CallbackContext): logger.info('/atm command used by %s', update.effective_user.first_name) preferences = qb.preferences() text = "Auto Torrent Management enabled by default: {auto_tmm_enabled}\n\n" \ "- relocate torrents if their category changes: {torrent_changed_tmm_enabled}\n" \ "- relocate affected torrents when default save path changes: {save_path_changed_tmm_enabled}\n" \ "- relocate affected torrents when their " \ "category's save path changes: {category_changed_tmm_enabled}".format(**preferences) update.message.reply_html(text)