Our main tracker first, then user trackers, then trackers.txt

This commit is contained in:
nyaadev 2017-05-13 15:46:08 +02:00
parent 799e9dea87
commit 7e25e6d9b8
1 changed files with 11 additions and 2 deletions

View File

@ -36,12 +36,21 @@ def default_trackers():
def get_trackers(torrent):
trackers = default_trackers()
torrent_trackers = torrent.trackers
trackers = OrderedSet()
# Our main one first
main_announce_url = app.config.get('MAIN_ANNOUNCE_URL')
if main_announce_url:
trackers.add(main_announce_url)
# then the user ones
torrent_trackers = torrent.trackers
for torrent_tracker in torrent_trackers:
trackers.add(torrent_tracker.tracker.uri)
# and finally our tracker list
trackers.update(default_trackers())
return list(trackers)