1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 14:00:00 +00:00

Re-add generated torrent tracker count limit

As found out in #164, this feature disappeared somewhere along the line.
This commit is contained in:
TheAMM 2017-05-22 23:59:21 +03:00
parent f04c3e1cf3
commit 1e230584ab

View file

@ -11,6 +11,8 @@ from nyaa import models
USED_TRACKERS = OrderedSet()
# Limit the amount of trackers added into .torrent files
MAX_TRACKERS = 5
def read_trackers_from_file(file_object):
USED_TRACKERS.clear()
@ -116,7 +118,7 @@ def create_default_metadata_base(torrent, trackers=None):
metadata_base['announce'] = trackers[0]
if len(trackers) > 1:
# Yes, it's a list of lists with a single element inside.
metadata_base['announce-list'] = [[tracker] for tracker in trackers]
metadata_base['announce-list'] = [[tracker] for tracker in trackers[:MAX_TRACKERS]]
return metadata_base