Add #890: If added torrent already exists, append extra trackers to it

This commit is contained in:
Calum Lind 2011-06-17 16:14:11 +01:00
parent f7c21fd87b
commit 6ad3a770af
2 changed files with 34 additions and 6 deletions

View File

@ -1,20 +1,21 @@
=== Deluge 1.3.3 (In Development) === === Deluge 1.3.3 (In Development) ===
==== Core ==== ==== Core ====
* Properly show the 'Checking Resume Data' state instead of just 7 * Properly show the 'Checking Resume Data' state instead of just 7
* Fix #1788: Added ability to use XDG_DOWNLOAD_DIR as default download folder * #1788: Added ability to use XDG_DOWNLOAD_DIR as default download folder
* Fix path error with torrent files prefixed with 'file://' from Firefox * Fix path error with torrent files prefixed with 'file://' from Firefox
* Fix #1869: Set the disk io read/write to bypass OS cache in Windows * #1869: Fix setting the disk io read/write to bypass OS cache in Windows
* Fix #1504: Win32 run deluged as not logged in user via runas or service * #1504: Fix win32 running deluged as not logged in user via runas or service
* #890: If added torrent already exists, append extra trackers to it
==== GtkUI ==== ==== GtkUI ====
* Show the checking icon for torrents in the 'Checking Resume Data' state * Show the checking icon for torrents in the 'Checking Resume Data' state
* #1195: Fix right-click selecting issue when switching between folders and files * #1195: Fix right-click selecting issue when switching between folders and files
* Add F2 key shortcut for renaming filenames in the Files Tab * Add F2 key shortcut for renaming filenames in the Files Tab
* Increase max piece size to 16 MiB in create torrent dialog * Increase max piece size to 16 MiB in create torrent dialog
* Fix #1475: Save and restore Preferences dialog size from config * #1475: Fix save and restore Preferences dialog size from config
* Add search as you type to the torrent view * Add search as you type to the torrent view
* Fix #1456: No ETA showing with multiple files * #1456: Fix no ETA showing with multiple files
* Fix #1560: FilesTab Progress value sorting by int instead of float * #1560: Fix FilesTab Progress value sorting by int instead of float
=== AutoAdd === === AutoAdd ===
* #1861: Fix AutoAdd Warning (column number is a boolean) * #1861: Fix AutoAdd Warning (column number is a boolean)

View File

@ -409,6 +409,33 @@ class TorrentManager(component.Component):
add_torrent_params["auto_managed"] = False add_torrent_params["auto_managed"] = False
add_torrent_params["duplicate_is_error"] = True add_torrent_params["duplicate_is_error"] = True
# If torrent already exists just append any extra trackers.
add_torrent_id = str(add_torrent_params["ti"].info_hash())
if add_torrent_id in self.get_torrent_list():
log.debug("Torrent (%s) exists, checking for trackers to add...", add_torrent_id)
add_torrent_trackers = []
for value in add_torrent_params["ti"].trackers():
tracker = {}
tracker["url"] = value.url
tracker["tier"] = value.tier
add_torrent_trackers.append(tracker)
torrent_trackers = {}
tracker_list = []
for tracker in self[add_torrent_id].get_status(["trackers"])["trackers"]:
torrent_trackers[(tracker["url"])] = tracker
tracker_list.append(tracker)
added_tracker = False
for tracker in add_torrent_trackers:
if tracker['url'] not in torrent_trackers:
tracker_list.append(tracker)
added_tracker = True
if added_tracker:
self[add_torrent_id].set_trackers(tracker_list)
return
# We need to pause the AlertManager momentarily to prevent alerts # We need to pause the AlertManager momentarily to prevent alerts
# for this torrent being generated before a Torrent object is created. # for this torrent being generated before a Torrent object is created.
component.pause("AlertManager") component.pause("AlertManager")