forked from premiere/premiere-libtorrent
added option to replace trackers or add trackers when loading trackers from resume data
This commit is contained in:
parent
0c28a3e3ca
commit
c0f2d5186f
|
@ -191,6 +191,8 @@ namespace
|
||||||
p.trackerid = extract<std::string>(params["trackerid"]);
|
p.trackerid = extract<std::string>(params["trackerid"]);
|
||||||
if (params.has_key("url"))
|
if (params.has_key("url"))
|
||||||
p.url = extract<std::string>(params["url"]);
|
p.url = extract<std::string>(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)
|
torrent_handle add_torrent(session& s, dict params)
|
||||||
|
|
|
@ -402,6 +402,10 @@ add_torrent()
|
||||||
bool share_mode;
|
bool share_mode;
|
||||||
std::string trackerid;
|
std::string trackerid;
|
||||||
std::string url;
|
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);
|
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
|
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.
|
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()
|
remove_torrent()
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ namespace libtorrent
|
||||||
, file_priorities(0)
|
, file_priorities(0)
|
||||||
, share_mode(false)
|
, share_mode(false)
|
||||||
, apply_ip_filter(true)
|
, apply_ip_filter(true)
|
||||||
|
, merge_resume_trackers(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// libtorrent version. Used for forward binary compatibility
|
// libtorrent version. Used for forward binary compatibility
|
||||||
|
@ -90,6 +91,7 @@ namespace libtorrent
|
||||||
std::string uuid;
|
std::string uuid;
|
||||||
std::string source_feed_url;
|
std::string source_feed_url;
|
||||||
bool apply_ip_filter;
|
bool apply_ip_filter;
|
||||||
|
bool merge_resume_trackers;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1310,6 +1310,10 @@ namespace libtorrent
|
||||||
// set to true if the session IP filter applies to this
|
// set to true if the session IP filter applies to this
|
||||||
// torrent or not. Defaults to true.
|
// torrent or not. Defaults to true.
|
||||||
bool m_apply_ip_filter:1;
|
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;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -407,6 +407,7 @@ namespace libtorrent
|
||||||
, m_lsd_seq(0)
|
, m_lsd_seq(0)
|
||||||
, m_magnet_link(false)
|
, m_magnet_link(false)
|
||||||
, m_apply_ip_filter(p.apply_ip_filter)
|
, 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;
|
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");
|
lazy_entry const* trackers = rd.dict_find_list("trackers");
|
||||||
if (trackers)
|
if (trackers)
|
||||||
{
|
{
|
||||||
m_trackers.clear();
|
if (!m_merge_resume_trackers) m_trackers.clear();
|
||||||
int tier = 0;
|
int tier = 0;
|
||||||
for (int i = 0; i < trackers->list_size(); ++i)
|
for (int i = 0; i < trackers->list_size(); ++i)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue