mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-22 17:26:21 +03:00
Merge pull request #480 from Gelmir/create_torrent_tiers
Support tracker tiers / groups in torrent creator
This commit is contained in:
commit
f01c301839
2 changed files with 14 additions and 1 deletions
|
@ -123,6 +123,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="A tracker tier is a group of trackers, consisting of a main tracker and its mirrors.">You can separate tracker tiers / groups with an empty line.</string>
|
||||||
|
</property>
|
||||||
<property name="acceptRichText">
|
<property name="acceptRichText">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -113,8 +113,18 @@ void TorrentCreatorThread::run() {
|
||||||
foreach (const QString &seed, url_seeds) {
|
foreach (const QString &seed, url_seeds) {
|
||||||
t.add_url_seed(seed.trimmed().toStdString());
|
t.add_url_seed(seed.trimmed().toStdString());
|
||||||
}
|
}
|
||||||
|
int tier = 0;
|
||||||
|
bool newline = false;
|
||||||
foreach (const QString &tracker, trackers) {
|
foreach (const QString &tracker, trackers) {
|
||||||
t.add_tracker(tracker.trimmed().toStdString());
|
if (tracker.isEmpty()) {
|
||||||
|
if (newline)
|
||||||
|
continue;
|
||||||
|
++tier;
|
||||||
|
newline = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
t.add_tracker(tracker.trimmed().toStdString(), tier);
|
||||||
|
newline = false;
|
||||||
}
|
}
|
||||||
if (abort) return;
|
if (abort) return;
|
||||||
// calculate the hash for all pieces
|
// calculate the hash for all pieces
|
||||||
|
|
Loading…
Reference in a new issue