deluge.core.torrentmanager

TorrentManager handles Torrent objects

class deluge.core.torrentmanager.TorrentManager

Bases: deluge.component.Component

TorrentManager contains a list of torrents in the current libtorrent session. This object is also responsible for saving the state of the session for use on restart.

add(torrent_info=None, state=None, options=None, save_state=True, filedump=None, filename=None, magnet=None, resume_data=None)
Add a torrent to the manager and returns it’s torrent_id
get_torrent_info_from_file(filepath)
Returns a torrent_info for the file specified or None
get_torrent_list()
Returns a list of torrent_ids
legacy_delete_resume_data(torrent_id)
Deletes the .fastresume file
legacy_get_resume_data_from_file(torrent_id)
Returns an entry with the resume data or None
load_resume_data_file()
load_state()
Load the state of the TorrentManager from the torrents.state file
load_torrent(torrent_id)
Load a torrent file from state and return it’s torrent info
on_alert_file_error(alert)
on_alert_file_renamed(alert)
on_alert_metadata_received(alert)
on_alert_save_resume_data(alert)
on_alert_save_resume_data_failed(alert)
on_alert_state_changed(alert)
on_alert_storage_moved(alert)
on_alert_torrent_checked(alert)
on_alert_torrent_finished(alert)
on_alert_torrent_paused(alert)
on_alert_torrent_resumed(alert)
on_alert_tracker_announce(alert)
on_alert_tracker_error(alert)
on_alert_tracker_reply(alert)
on_alert_tracker_warning(alert)
on_set_max_connections_per_torrent(key, value)
Sets the per-torrent connection limit
on_set_max_download_speed_per_torrent(key, value)
on_set_max_upload_slots_per_torrent(key, value)
Sets the per-torrent upload slot limit
on_set_max_upload_speed_per_torrent(key, value)
queue_bottom(torrent_id)
Queue torrent to bottom
queue_down(torrent_id)
Queue torrent down one position
queue_top(torrent_id)
Queue torrent to top
queue_up(torrent_id)
Queue torrent up one position
remove(torrent_id, remove_data=False)

Remove a torrent from the session.

Parameters:
  • torrent_id (string) – the torrent to remove
  • remove_data (bool) – if True, remove the downloaded data
Returns:

True if removed successfully, False if not

Return type:

bool

Raises InvalidTorrentError:
 

if the torrent_id is not in the session

save_resume_data(torrent_ids=None)
Saves resume data for list of torrent_ids or for all torrents if torrent_ids is None
save_resume_data_file(resume_data=None)

Saves the resume data file with the contents of self.resume_data. If resume_data is None, then we grab the resume_data from the file on disk, else, we update resume_data with self.resume_data and save that to disk.

Parameter:resume_data (dict) – the current resume_data, this will be loaded from disk if not provided
save_state()
Save the state of the TorrentManager to the torrents.state file
start()
stop()
update()
class deluge.core.torrentmanager.TorrentManagerState
class deluge.core.torrentmanager.TorrentState(torrent_id=None, filename=None, total_uploaded=0, trackers=None, compact=False, paused=False, save_path=None, max_connections=-1, max_upload_slots=-1, max_upload_speed=-1.0, max_download_speed=-1.0, prioritize_first_last=False, file_priorities=None, queue=None, auto_managed=True, is_finished=False, stop_ratio=2.0, stop_at_ratio=False, remove_at_ratio=False, move_completed=False, move_completed_path=None, magnet=None, time_added=-1)

Previous topic

deluge.core.torrent

Next topic

deluge.plugins.init

This Page