mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-22 04:24:51 +00:00
Add tracker responses to TorrentDetails.
This commit is contained in:
parent
4ad4ac058c
commit
935aa72584
5 changed files with 51 additions and 241 deletions
1
TODO
1
TODO
|
@ -12,7 +12,6 @@
|
|||
* Figure out easy way for user-made plugins to add i18n support.
|
||||
* Change the menubar.py gtkui component to menus.py and add support for plugins
|
||||
to add menuitems to the torrentmenu in an easy way.
|
||||
* Add the tracker responses to the torrent details
|
||||
* Restart daemon function
|
||||
* Sync the details pane to current trunk
|
||||
* Automatically save torrent state every ~5 minutes, much like how
|
||||
|
|
|
@ -49,12 +49,12 @@ class Torrent:
|
|||
self.total_uploaded = 0
|
||||
# Set the allocation mode
|
||||
self.compact = compact
|
||||
# The reply from the tracker
|
||||
self.tracker_reply = ""
|
||||
# The tracker status
|
||||
self.tracker_status = ""
|
||||
|
||||
def set_tracker_reply(self, reply):
|
||||
"""Sets the tracker reply message"""
|
||||
self.tracker_reply = reply
|
||||
def set_tracker_status(self, status):
|
||||
"""Sets the tracker status"""
|
||||
self.tracker_status = status
|
||||
|
||||
def get_state(self):
|
||||
"""Returns the state of this torrent for saving to the session state"""
|
||||
|
@ -140,7 +140,8 @@ class Torrent:
|
|||
"total_wanted": status.total_wanted,
|
||||
"eta": self.get_eta(),
|
||||
"ratio": self.get_ratio(),
|
||||
"tracker": status.current_tracker
|
||||
"tracker": status.current_tracker,
|
||||
"tracker_status": self.tracker_status
|
||||
}
|
||||
|
||||
# Create the desired status dictionary and return it
|
||||
|
|
|
@ -87,6 +87,13 @@ class TorrentManager:
|
|||
self.on_alert_torrent_finished)
|
||||
self.alerts.register_handler("torrent_paused_alert",
|
||||
self.on_alert_torrent_paused)
|
||||
self.alerts.register_handler("tracker_reply_alert",
|
||||
self.on_alert_tracker_reply)
|
||||
self.alerts.register_handler("tracker_announce_alert",
|
||||
self.on_alert_tracker_announce)
|
||||
self.alerts.register_handler("tracker_alert", self.on_alert_tracker)
|
||||
self.alerts.register_handler("tracker_warning_alert",
|
||||
self.on_alert_tracker_warning)
|
||||
|
||||
def shutdown(self):
|
||||
log.debug("TorrentManager shutting down..")
|
||||
|
@ -364,4 +371,37 @@ class TorrentManager:
|
|||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
# Write the fastresume file
|
||||
self.write_fastresume(torrent_id)
|
||||
self.write_fastresume(torrent_id)
|
||||
|
||||
def on_alert_tracker_reply(self, alert):
|
||||
log.debug("on_alert_tracker_reply")
|
||||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
# Set the tracker status for the torrent
|
||||
self.torrents[torrent_id].set_tracker_status("Announce OK")
|
||||
|
||||
def on_alert_tracker_announce(self, alert):
|
||||
log.debug("on_alert_tracker_announce")
|
||||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
# Set the tracker status for the torrent
|
||||
self.torrents[torrent_id].set_tracker_status("Announce Sent")
|
||||
|
||||
def on_alert_tracker(self, alert):
|
||||
log.debug("on_alert_tracker")
|
||||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
tracker_status = "%s: %s (%s=%s, %s=%s)" % \
|
||||
("Alert", str(alert.msg()),
|
||||
"HTTP code", alert.status_code,
|
||||
"times in a row", alert.times_in_row)
|
||||
# Set the tracker status for the torrent
|
||||
self.torrents[torrent_id].set_tracker_status(tracker_status)
|
||||
|
||||
def on_alert_tracker_warning(self, alert):
|
||||
log.debug("on_alert_tracker_warning")
|
||||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
tracker_status = '%s: %s' % ("Warning", str(alert.msg()))
|
||||
# Set the tracker status for the torrent
|
||||
self.torrents[torrent_id].set_tracker_status(tracker_status)
|
||||
|
|
|
@ -92,7 +92,8 @@ class TorrentDetails:
|
|||
"total_done", "total_payload_download", "total_uploaded",
|
||||
"total_payload_upload", "download_payload_rate",
|
||||
"upload_payload_rate", "num_peers", "num_seeds", "total_peers",
|
||||
"total_seeds", "eta", "ratio", "tracker", "next_announce"]
|
||||
"total_seeds", "eta", "ratio", "tracker", "next_announce",
|
||||
"tracker_status"]
|
||||
status = functions.get_torrent_status(self.core,
|
||||
selected,
|
||||
status_keys)
|
||||
|
@ -129,6 +130,7 @@ class TorrentDetails:
|
|||
self.eta.set_text(deluge.common.ftime(status["eta"]))
|
||||
self.share_ratio.set_text("%.3f" % status["ratio"])
|
||||
self.tracker.set_text(status["tracker"])
|
||||
self.tracker_status.set_text(status["tracker_status"])
|
||||
self.next_announce.set_text(
|
||||
deluge.common.ftime(status["next_announce"]))
|
||||
|
||||
|
|
|
@ -1,232 +0,0 @@
|
|||
nobase_include_HEADERS = libtorrent/alert.hpp \
|
||||
libtorrent/alert_types.hpp \
|
||||
libtorrent/allocate_resources.hpp \
|
||||
libtorrent/bandwidth_manager.hpp \
|
||||
libtorrent/bencode.hpp \
|
||||
libtorrent/buffer.hpp \
|
||||
libtorrent/connection_queue.hpp \
|
||||
libtorrent/config.hpp \
|
||||
libtorrent/debug.hpp \
|
||||
libtorrent/disk_io_thread.hpp \
|
||||
libtorrent/entry.hpp \
|
||||
libtorrent/escape_string.hpp \
|
||||
libtorrent/extensions.hpp \
|
||||
libtorrent/file.hpp \
|
||||
libtorrent/file_pool.hpp \
|
||||
libtorrent/fingerprint.hpp \
|
||||
libtorrent/hasher.hpp \
|
||||
libtorrent/http_connection.hpp \
|
||||
libtorrent/http_stream.hpp \
|
||||
libtorrent/http_tracker_connection.hpp \
|
||||
libtorrent/identify_client.hpp \
|
||||
libtorrent/instantiate_connection.hpp \
|
||||
libtorrent/intrusive_ptr_base.hpp \
|
||||
libtorrent/invariant_check.hpp \
|
||||
libtorrent/io.hpp \
|
||||
libtorrent/ip_filter.hpp \
|
||||
libtorrent/lsd.hpp \
|
||||
libtorrent/peer.hpp \
|
||||
libtorrent/peer_connection.hpp \
|
||||
libtorrent/bt_peer_connection.hpp \
|
||||
libtorrent/web_peer_connection.hpp \
|
||||
libtorrent/pe_crypto.hpp \
|
||||
libtorrent/natpmp.hpp \
|
||||
libtorrent/pch.hpp \
|
||||
libtorrent/peer_id.hpp \
|
||||
libtorrent/peer_info.hpp \
|
||||
libtorrent/peer_request.hpp \
|
||||
libtorrent/piece_block_progress.hpp \
|
||||
libtorrent/piece_picker.hpp \
|
||||
libtorrent/policy.hpp \
|
||||
libtorrent/proxy_base.hpp \
|
||||
libtorrent/random_sample.hpp \
|
||||
libtorrent/resource_request.hpp \
|
||||
libtorrent/session.hpp \
|
||||
libtorrent/session_settings.hpp \
|
||||
libtorrent/session_status.hpp \
|
||||
libtorrent/size_type.hpp \
|
||||
libtorrent/socket.hpp \
|
||||
libtorrent/socket_type.hpp \
|
||||
libtorrent/socks4_stream.hpp \
|
||||
libtorrent/socks5_stream.hpp \
|
||||
libtorrent/stat.hpp \
|
||||
libtorrent/storage.hpp \
|
||||
libtorrent/time.hpp \
|
||||
libtorrent/torrent.hpp \
|
||||
libtorrent/torrent_handle.hpp \
|
||||
libtorrent/torrent_info.hpp \
|
||||
libtorrent/tracker_manager.hpp \
|
||||
libtorrent/udp_tracker_connection.hpp \
|
||||
libtorrent/utf8.hpp \
|
||||
libtorrent/xml_parse.hpp \
|
||||
libtorrent/variant_stream.hpp \
|
||||
libtorrent/version.hpp \
|
||||
libtorrent/time.hpp \
|
||||
libtorrent/aux_/allocate_resources_impl.hpp \
|
||||
libtorrent/aux_/session_impl.hpp \
|
||||
libtorrent/extensions/metadata_transfer.hpp \
|
||||
libtorrent/extensions/ut_pex.hpp \
|
||||
libtorrent/extensions/logger.hpp \
|
||||
\
|
||||
libtorrent/kademlia/closest_nodes.hpp \
|
||||
libtorrent/kademlia/dht_tracker.hpp \
|
||||
libtorrent/kademlia/find_data.hpp \
|
||||
libtorrent/kademlia/logging.hpp \
|
||||
libtorrent/kademlia/msg.hpp \
|
||||
libtorrent/kademlia/node.hpp \
|
||||
libtorrent/kademlia/node_entry.hpp \
|
||||
libtorrent/kademlia/node_id.hpp \
|
||||
libtorrent/kademlia/observer.hpp \
|
||||
libtorrent/kademlia/packet_iterator.hpp \
|
||||
libtorrent/kademlia/refresh.hpp \
|
||||
libtorrent/kademlia/routing_table.hpp \
|
||||
libtorrent/kademlia/rpc_manager.hpp \
|
||||
libtorrent/kademlia/traversal_algorithm.hpp \
|
||||
\
|
||||
libtorrent/asio.hpp \
|
||||
libtorrent/asio/basic_datagram_socket.hpp \
|
||||
libtorrent/asio/basic_deadline_timer.hpp \
|
||||
libtorrent/asio/basic_io_object.hpp \
|
||||
libtorrent/asio/basic_socket.hpp \
|
||||
libtorrent/asio/basic_socket_acceptor.hpp \
|
||||
libtorrent/asio/basic_socket_iostream.hpp \
|
||||
libtorrent/asio/basic_socket_streambuf.hpp \
|
||||
libtorrent/asio/basic_stream_socket.hpp \
|
||||
libtorrent/asio/basic_streambuf.hpp \
|
||||
libtorrent/asio/buffer.hpp \
|
||||
libtorrent/asio/buffered_read_stream.hpp \
|
||||
libtorrent/asio/buffered_read_stream_fwd.hpp \
|
||||
libtorrent/asio/buffered_stream.hpp \
|
||||
libtorrent/asio/buffered_stream_fwd.hpp \
|
||||
libtorrent/asio/buffered_write_stream.hpp \
|
||||
libtorrent/asio/buffered_write_stream_fwd.hpp \
|
||||
libtorrent/asio/completion_condition.hpp \
|
||||
libtorrent/asio/datagram_socket_service.hpp \
|
||||
libtorrent/asio/deadline_timer.hpp \
|
||||
libtorrent/asio/deadline_timer_service.hpp \
|
||||
libtorrent/asio/detail/bind_handler.hpp \
|
||||
libtorrent/asio/detail/buffer_resize_guard.hpp \
|
||||
libtorrent/asio/detail/buffered_stream_storage.hpp \
|
||||
libtorrent/asio/detail/call_stack.hpp \
|
||||
libtorrent/asio/detail/const_buffers_iterator.hpp \
|
||||
libtorrent/asio/detail/consuming_buffers.hpp \
|
||||
libtorrent/asio/detail/deadline_timer_service.hpp \
|
||||
libtorrent/asio/detail/epoll_reactor.hpp \
|
||||
libtorrent/asio/detail/epoll_reactor_fwd.hpp \
|
||||
libtorrent/asio/detail/event.hpp \
|
||||
libtorrent/asio/detail/fd_set_adapter.hpp \
|
||||
libtorrent/asio/detail/handler_alloc_helpers.hpp \
|
||||
libtorrent/asio/detail/handler_invoke_helpers.hpp \
|
||||
libtorrent/asio/detail/hash_map.hpp \
|
||||
libtorrent/asio/detail/io_control.hpp \
|
||||
libtorrent/asio/detail/kqueue_reactor.hpp \
|
||||
libtorrent/asio/detail/kqueue_reactor_fwd.hpp \
|
||||
libtorrent/asio/detail/local_free_on_block_exit.hpp \
|
||||
libtorrent/asio/detail/mutex.hpp \
|
||||
libtorrent/asio/detail/noncopyable.hpp \
|
||||
libtorrent/asio/detail/null_event.hpp \
|
||||
libtorrent/asio/detail/null_mutex.hpp \
|
||||
libtorrent/asio/detail/null_signal_blocker.hpp \
|
||||
libtorrent/asio/detail/null_thread.hpp \
|
||||
libtorrent/asio/detail/null_tss_ptr.hpp \
|
||||
libtorrent/asio/detail/old_win_sdk_compat.hpp \
|
||||
libtorrent/asio/detail/pipe_select_interrupter.hpp \
|
||||
libtorrent/asio/detail/pop_options.hpp \
|
||||
libtorrent/asio/detail/posix_event.hpp \
|
||||
libtorrent/asio/detail/posix_fd_set_adapter.hpp \
|
||||
libtorrent/asio/detail/posix_mutex.hpp \
|
||||
libtorrent/asio/detail/posix_signal_blocker.hpp \
|
||||
libtorrent/asio/detail/posix_thread.hpp \
|
||||
libtorrent/asio/detail/posix_tss_ptr.hpp \
|
||||
libtorrent/asio/detail/push_options.hpp \
|
||||
libtorrent/asio/detail/reactive_socket_service.hpp \
|
||||
libtorrent/asio/detail/reactor_op_queue.hpp \
|
||||
libtorrent/asio/detail/resolver_service.hpp \
|
||||
libtorrent/asio/detail/scoped_lock.hpp \
|
||||
libtorrent/asio/detail/select_interrupter.hpp \
|
||||
libtorrent/asio/detail/select_reactor.hpp \
|
||||
libtorrent/asio/detail/select_reactor_fwd.hpp \
|
||||
libtorrent/asio/detail/service_registry.hpp \
|
||||
libtorrent/asio/detail/service_registry_fwd.hpp \
|
||||
libtorrent/asio/detail/service_base.hpp \
|
||||
libtorrent/asio/detail/service_id.hpp \
|
||||
libtorrent/asio/detail/signal_blocker.hpp \
|
||||
libtorrent/asio/detail/signal_init.hpp \
|
||||
libtorrent/asio/detail/socket_holder.hpp \
|
||||
libtorrent/asio/detail/socket_ops.hpp \
|
||||
libtorrent/asio/detail/socket_option.hpp \
|
||||
libtorrent/asio/detail/socket_select_interrupter.hpp \
|
||||
libtorrent/asio/detail/socket_types.hpp \
|
||||
libtorrent/asio/detail/strand_service.hpp \
|
||||
libtorrent/asio/detail/task_io_service.hpp \
|
||||
libtorrent/asio/detail/task_io_service_fwd.hpp \
|
||||
libtorrent/asio/detail/thread.hpp \
|
||||
libtorrent/asio/detail/throw_error.hpp \
|
||||
libtorrent/asio/detail/timer_queue.hpp \
|
||||
libtorrent/asio/detail/timer_queue_base.hpp \
|
||||
libtorrent/asio/detail/tss_ptr.hpp \
|
||||
libtorrent/asio/detail/win_event.hpp \
|
||||
libtorrent/asio/detail/win_fd_set_adapter.hpp \
|
||||
libtorrent/asio/detail/win_iocp_io_service.hpp \
|
||||
libtorrent/asio/detail/win_iocp_io_service_fwd.hpp \
|
||||
libtorrent/asio/detail/win_iocp_operation.hpp \
|
||||
libtorrent/asio/detail/win_iocp_socket_service.hpp \
|
||||
libtorrent/asio/detail/win_mutex.hpp \
|
||||
libtorrent/asio/detail/win_signal_blocker.hpp \
|
||||
libtorrent/asio/detail/win_thread.hpp \
|
||||
libtorrent/asio/detail/win_tss_ptr.hpp \
|
||||
libtorrent/asio/detail/winsock_init.hpp \
|
||||
libtorrent/asio/detail/wrapped_handler.hpp \
|
||||
libtorrent/asio/error.hpp \
|
||||
libtorrent/asio/error_code.hpp \
|
||||
libtorrent/asio/handler_alloc_hook.hpp \
|
||||
libtorrent/asio/handler_invoke_hook.hpp \
|
||||
libtorrent/asio/impl/error_code.ipp \
|
||||
libtorrent/asio/impl/io_service.ipp \
|
||||
libtorrent/asio/impl/read.ipp \
|
||||
libtorrent/asio/impl/read_until.ipp \
|
||||
libtorrent/asio/impl/write.ipp \
|
||||
libtorrent/asio/io_service.hpp \
|
||||
libtorrent/asio/ip/address.hpp \
|
||||
libtorrent/asio/ip/address_v4.hpp \
|
||||
libtorrent/asio/ip/address_v6.hpp \
|
||||
libtorrent/asio/ip/basic_endpoint.hpp \
|
||||
libtorrent/asio/ip/basic_resolver.hpp \
|
||||
libtorrent/asio/ip/basic_resolver_entry.hpp \
|
||||
libtorrent/asio/ip/basic_resolver_iterator.hpp \
|
||||
libtorrent/asio/ip/basic_resolver_query.hpp \
|
||||
libtorrent/asio/ip/detail/socket_option.hpp \
|
||||
libtorrent/asio/ip/host_name.hpp \
|
||||
libtorrent/asio/ip/multicast.hpp \
|
||||
libtorrent/asio/ip/resolver_query_base.hpp \
|
||||
libtorrent/asio/ip/resolver_service.hpp \
|
||||
libtorrent/asio/ip/tcp.hpp \
|
||||
libtorrent/asio/ip/udp.hpp \
|
||||
libtorrent/asio/is_read_buffered.hpp \
|
||||
libtorrent/asio/is_write_buffered.hpp \
|
||||
libtorrent/asio/placeholders.hpp \
|
||||
libtorrent/asio/read.hpp \
|
||||
libtorrent/asio/read_until.hpp \
|
||||
libtorrent/asio/socket_acceptor_service.hpp \
|
||||
libtorrent/asio/socket_base.hpp \
|
||||
libtorrent/asio/ssl/basic_context.hpp \
|
||||
libtorrent/asio/ssl/context.hpp \
|
||||
libtorrent/asio/ssl/context_base.hpp \
|
||||
libtorrent/asio/ssl/context_service.hpp \
|
||||
libtorrent/asio/ssl/detail/openssl_context_service.hpp \
|
||||
libtorrent/asio/ssl/detail/openssl_init.hpp \
|
||||
libtorrent/asio/ssl/detail/openssl_operation.hpp \
|
||||
libtorrent/asio/ssl/detail/openssl_stream_service.hpp \
|
||||
libtorrent/asio/ssl/detail/openssl_types.hpp \
|
||||
libtorrent/asio/ssl/stream.hpp \
|
||||
libtorrent/asio/ssl/stream_base.hpp \
|
||||
libtorrent/asio/ssl/stream_service.hpp \
|
||||
libtorrent/asio/ssl.hpp \
|
||||
libtorrent/asio/strand.hpp \
|
||||
libtorrent/asio/stream_socket_service.hpp \
|
||||
libtorrent/asio/streambuf.hpp \
|
||||
libtorrent/asio/system_error.hpp \
|
||||
libtorrent/asio/thread.hpp \
|
||||
libtorrent/asio/time_traits.hpp \
|
||||
libtorrent/asio/write.hpp
|
||||
|
Loading…
Add table
Reference in a new issue