Beispiel #1
0
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)
Beispiel #2
0
def on_altoff_button_quick(_, update):
    logger.info('quick info: altoff button')

    if bool(qb.get_alternative_speed_status()):
        qb.toggle_alternative_speed()

    text = get_quick_info_text()
    update.callback_query.edit_message_text(text, parse_mode=ParseMode.HTML, reply_markup=kb.QUICK_MENU_BUTTON)
    update.callback_query.answer('Alternative speed disabled')
Beispiel #3
0
def on_altoff_button_overview(update: Update, context: CallbackContext):
    logger.info('overview: altoff button')

    if bool(qb.get_alternative_speed_status()):
        qb.toggle_alternative_speed()

    text = get_quick_info_text()
    update.callback_query.edit_message_text(
        text,
        parse_mode=ParseMode.HTML,
        reply_markup=kb.get_overview_altspeed_markup())
    update.callback_query.answer('Alternative speed disabled')