Browse Source

Add URL seeds from duplicate torrents to existing ones

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
f7a86b5484
  1. 2
      Changelog
  2. 17
      src/bittorrent.cpp

2
Changelog

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
- FEATURE: User can choose to apply transfer limits on LAN too
- FEATURE: User can choose to include the protocol overhead in transfer limits
- FEATURE: Torrents can be automatically rechecked on completion
- FEATURE: If 2 torrents have the same hash, add new trackers to the existing torrent
- FEATURE: If 2 torrents have the same hash, add new trackers/URL seeds to the existing torrent
- FEATURE: Trackers can be added from Web UI
- COSMETIC: Improved style management

17
src/bittorrent.cpp

@ -978,7 +978,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr @@ -978,7 +978,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
addConsoleMessage(tr("'%1' is already in download list.", "e.g: 'xxx.avi' is already in download list.").arg(file));
//emit duplicateTorrent(file);
}
// Check if the torrent contains trackers we don't know about
// Check if the torrent contains trackers or url seeds we don't know about
// and add them
QTorrentHandle h_ex = getTorrentHandle(hash);
if(h_ex.is_valid()) {
@ -1001,7 +1001,20 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr @@ -1001,7 +1001,20 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
}
}
if(trackers_added) {
addConsoleMessage(tr("However, new trackers were added to the existing torrent."));
addConsoleMessage(tr("Note: new trackers were added to the existing torrent."));
}
bool urlseeds_added = false;
QStringList old_urlseeds = h_ex.url_seeds();
std::vector<std::string> new_urlseeds = t->url_seeds();
for(std::vector<std::string>::iterator it = new_urlseeds.begin(); it != new_urlseeds.end(); it++) {
QString new_url = misc::toQString(it->c_str());
if(!old_urlseeds.contains(new_url)) {
urlseeds_added = true;
h_ex.add_url_seed(new_url);
}
}
if(urlseeds_added) {
addConsoleMessage(tr("Note: new URL seeds were added to the existing torrent."));
}
}
}else{

Loading…
Cancel
Save