qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
28.54k stars 4k forks source link

Missing API properties that are noted in the Wiki but are not present in 5.0.1's API #21746

Closed chessset5 closed 3 weeks ago

chessset5 commented 3 weeks ago

qBittorrent & operating system versions

qBittorrent: 5.0.1 x64 Qt: 6.7.3 Python: Python312 Operating system:

Edition Windows 10 Pro N Version 22H2 Installed on ‎2/‎9/‎2024 OS build 19045.5011 Experience Windows Feature Experience Pack 1000.19060.1000.0

What is the problem?

I am scripting in python and I am trying to set the start_paused_enabled preference via the API but noticed it is missing from the API in qB 5.0.1.

Several other settings are also missing from preferences, specifically:

create_subfolder_enabled enable_os_cache proxy_torrents_only
ssl_cert ssl_key start_paused_enabled web_ui_password

According to https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-application-preferences All these settings should be available via the API.

The settings that are currently available via the API are as follows:

add_stopped_enabled add_to_top_of_queue add_trackers add_trackers_enabled alt_dl_limit alt_up_limit alternative_webui_enabled alternative_webui_path announce_ip announce_to_all_tiers announce_to_all_trackers anonymous_mode app_instance_name async_io_threads auto_delete_mode auto_tmm_enabled autorun_enabled autorun_on_torrent_added_enabled autorun_on_torrent_added_program autorun_program banned_IPs bdecode_depth_limit bdecode_token_limit bittorrent_protocol block_peers_on_privileged_ports bypass_auth_subnet_whitelist bypass_auth_subnet_whitelist_enabled bypass_local_auth category_changed_tmm_enabled checking_memory_use connection_speed current_interface_address current_interface_name current_network_interface delete_torrent_content_files dht dht_bootstrap_nodes disk_cache disk_cache_ttl disk_io_read_mode disk_io_type disk_io_write_mode disk_queue_size dl_limit dont_count_slow_torrents dyndns_domain dyndns_enabled dyndns_password dyndns_service dyndns_username embedded_tracker_port embedded_tracker_port_forwarding enable_coalesce_read_write enable_embedded_tracker enable_multi_connections_from_same_ip enable_piece_extent_affinity enable_upload_suggestions encryption excluded_file_names excluded_file_names_enabled export_dir export_dir_fin file_log_age file_log_age_type file_log_backup_enabled file_log_delete_old file_log_enabled file_log_max_size file_log_path file_pool_size hashing_threads i2p_address i2p_enabled i2p_inbound_length i2p_inbound_quantity i2p_mixed_mode i2p_outbound_length i2p_outbound_quantity i2p_port idn_support_enabled ignore_ssl_errors incomplete_files_ext ip_filter_enabled ip_filter_path ip_filter_trackers limit_lan_peers limit_tcp_overhead limit_utp_rate listen_port locale lsd mail_notification_auth_enabled mail_notification_email mail_notification_enabled mail_notification_password mail_notification_sender mail_notification_smtp mail_notification_ssl_enabled mail_notification_username mark_of_the_web max_active_checking_torrents max_active_downloads max_active_torrents max_active_uploads max_concurrent_http_announces max_connec max_connec_per_torrent max_inactive_seeding_time max_inactive_seeding_time_enabled max_ratio max_ratio_act max_ratio_enabled max_seeding_time max_seeding_time_enabled max_uploads max_uploads_per_torrent memory_working_set_limit merge_trackers outgoing_ports_max outgoing_ports_min peer_tos peer_turnover peer_turnover_cutoff peer_turnover_interval performance_warning pex preallocate_all proxy_auth_enabled proxy_bittorrent proxy_hostname_lookup proxy_ip proxy_misc proxy_password proxy_peer_connections proxy_port proxy_rss proxy_type proxy_username python_executable_path queueing_enabled random_port reannounce_when_address_changed recheck_completed_torrents refresh_interval request_queue_size resolve_peer_countries resume_data_storage_type rss_auto_downloading_enabled rss_download_repack_proper_episodes rss_fetch_delay rss_max_articles_per_feed rss_processing_enabled rss_refresh_interval rss_smart_episode_filters save_path save_path_changed_tmm_enabled save_resume_data_interval scan_dirs schedule_from_hour schedule_from_min schedule_to_hour schedule_to_min scheduler_days scheduler_enabled send_buffer_low_watermark send_buffer_watermark send_buffer_watermark_factor slow_torrent_dl_rate_threshold slow_torrent_inactive_timer slow_torrent_ul_rate_threshold socket_backlog_size socket_receive_buffer_size socket_send_buffer_size ssl_enabled ssl_listen_port ssrf_mitigation stop_tracker_timeout temp_path temp_path_enabled torrent_changed_tmm_enabled torrent_content_layout torrent_content_remove_option torrent_file_size_limit torrent_stop_condition up_limit upload_choking_algorithm upload_slots_behavior upnp upnp_lease_duration use_category_paths_in_manual_mode use_https use_subcategories use_unwanted_folder utp_tcp_mixed_mode validate_https_tracker_certificate web_ui_address web_ui_ban_duration web_ui_clickjacking_protection_enabled web_ui_csrf_protection_enabled web_ui_custom_http_headers web_ui_domain_list web_ui_host_header_validation_enabled web_ui_https_cert_path web_ui_https_key_path web_ui_max_auth_fail_count web_ui_port web_ui_reverse_proxies_list web_ui_reverse_proxy_enabled web_ui_secure_cookie_enabled web_ui_session_timeout web_ui_upnp web_ui_use_custom_http_headers_enabled web_ui_username

Steps to reproduce

import requests

# Replace these with the qBittorrent WebUI details
QB_IP_ADDRESS = "localhost"
QB_PORT = "8080"
QB_SERVER = "http://" + QB_IP_ADDRESS + ":" + QB_PORT

# Set the Username and Password
QB_USERNAME = 'un'
QB_PASSWORD = 'pw'

# Login to qBittorrent WebUI
qbit_session = requests.Session()
login_response = qbit_session.post(f'{QB_SERVER}/api/v2/auth/login', data={
    'username': QB_USERNAME,
    'password': QB_PASSWORD
})

ap: json = qbit_session.post(f'{QB_SERVER}/api/v2/app/preferences', data={"start_paused_enabled": 1})
a_dict = dict(ap.json())
keys = list(a_dict.keys())
keys.sort()
for k in keys:
    print(f"{k} : {a_dict[k]}")

# Logout from qBittorrent session
qbit_session.get(f'{QB_SERVER}/api/v2/auth/logout')

If you run the following python script, which is a cut down version of the one I am creating, you will notice in the return json, start_paused_enabled is missing from the output.

Furthermore in Advanced Settings in qB torrent the value of Start BitTorrent session in a paused state is still in the same state it was before running the script.

Screenshot 2024-11-02 at 2 51 40 AM

This was the state after running the script, it should be enabled.

Additional context

No response

Log(s) & preferences file(s)

qbittorrent.log

chessset5 commented 3 weeks ago

Reading this over again I am not 100% that start_paused_enabled is meant for Start BitTorrent session in a paused state, regardless, start_paused_enabled isn't doing anything when posted via the API.

sledgehammer999 commented 3 weeks ago

The wiki is probably not up to date. This string seems to have been renamed to add_stopped_enabled with PR #20532. See commit/file change: https://github.com/qbittorrent/qBittorrent/commit/5d1c2496063b41874e85af0145b153e006fc92d3#diff-90b22e23f40f2d63acaf72e075355de5190f200f0d1a324591c4f1914fe12da4L142

For the current keys available in v5.0.x you can look in AppController::preferencesAction()

chessset5 commented 3 weeks ago

Cool thanks