diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index 1861928d8..7aa3f1149 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -191,6 +191,8 @@ namespace p.trackerid = extract(params["trackerid"]); if (params.has_key("url")) p.url = extract(params["url"]); + if (params.has_key("merge_resume_trackers")) + p.merge_resume_trackers = params["merge_resume_trackers"]; } torrent_handle add_torrent(session& s, dict params) diff --git a/docs/manual.rst b/docs/manual.rst index 1d63d730a..4942e10f8 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -402,6 +402,10 @@ add_torrent() bool share_mode; std::string trackerid; std::string url; + std::string uuid; + std::string source_feed_url; + bool apply_ip_filter; + bool merge_resume_trackers; }; torrent_handle add_torrent(add_torrent_params const& params); @@ -544,6 +548,20 @@ is used for forward binary compatibility. this is empty, and no tracker ID is used, since this is an optional argument. If a tracker returns a tracker ID, that ID is used instead of this. +if ``uuid`` is specified, it is used to find duplicates. If another torrent is already +running with the same UUID as the one being added, it will be considered a duplicate. This +is mainly useful for RSS feed items which has UUIDs specified. + +``source_feed_url`` should point to the URL of the RSS feed this torrent comes from, +if it comes from an RSS feed. + +``apply_ip_filter`` determines if the IP filter should apply to this torrent or not. By +default all torrents are subject to filtering by the IP filter. This is useful if certain +torrents needs to be excempt for some reason, being an auto-update torrent for instance. + +``merge_resume_trackers`` defaults to false and specifies whether tracker URLs loaded from +resume data should be added to the trackers in the torrent or replace the trackers. + remove_torrent() ---------------- diff --git a/include/libtorrent/add_torrent_params.hpp b/include/libtorrent/add_torrent_params.hpp index bb12d9432..ee06f444d 100644 --- a/include/libtorrent/add_torrent_params.hpp +++ b/include/libtorrent/add_torrent_params.hpp @@ -64,6 +64,7 @@ namespace libtorrent , file_priorities(0) , share_mode(false) , apply_ip_filter(true) + , merge_resume_trackers(false) {} // libtorrent version. Used for forward binary compatibility @@ -90,6 +91,7 @@ namespace libtorrent std::string uuid; std::string source_feed_url; bool apply_ip_filter; + bool merge_resume_trackers; }; } diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index e8c5e0b28..94d755571 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -1310,6 +1310,10 @@ namespace libtorrent // set to true if the session IP filter applies to this // torrent or not. Defaults to true. bool m_apply_ip_filter:1; + + // if set to true, add tracker URLs loaded from resume + // data into this torrent instead of replacing them + bool m_merge_resume_trackers:1; }; } diff --git a/src/torrent.cpp b/src/torrent.cpp index 0247a4790..a8d4566a9 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -407,6 +407,7 @@ namespace libtorrent , m_lsd_seq(0) , m_magnet_link(false) , m_apply_ip_filter(p.apply_ip_filter) + , m_merge_resume_trackers(p.merge_resume_trackers) { if (!m_apply_ip_filter) ++m_ses.m_non_filtered_torrents; @@ -4417,7 +4418,7 @@ namespace libtorrent lazy_entry const* trackers = rd.dict_find_list("trackers"); if (trackers) { - m_trackers.clear(); + if (!m_merge_resume_trackers) m_trackers.clear(); int tier = 0; for (int i = 0; i < trackers->list_size(); ++i) {