You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fake-tracker.py 773B

1234567891011121314151617181920212223242526272829303132333435
  1. #! /usr/bin/env python
  2. import sys
  3. import time
  4. import torrentfile
  5. import torrenttracker
  6. import torrentmanager
  7. import config
  8. if len(sys.argv) >= 2:
  9. config = config.Config(sys.argv[1])
  10. else:
  11. config = config.Config()
  12. maxRatio = config.getMaxRatio()
  13. maxRate = config.getMaxRatio()
  14. trackers = []
  15. for file in ('torrent.torrent', 'torrent2.torrent'):
  16. torrent = torrentfile.TorrentFile()
  17. torrent.readFile(file)
  18. trackers.append(torrent)
  19. manager = torrentmanager.TorrentManager(trackers)
  20. manager.start()
  21. run = True
  22. while run:
  23. t = manager.getNextTime()
  24. torrent = t['torrent']
  25. secs = t['time']
  26. print(torrent.getName() + ": Next update in " + str(secs) + " seconds")
  27. time.sleep(secs)
  28. print("Updating...")
  29. manager.updateNextTracker()