|
@@ -2,6 +2,7 @@
|
2
|
2
|
|
3
|
3
|
from __future__ import print_function
|
4
|
4
|
import sys
|
|
5
|
+import os
|
5
|
6
|
import time
|
6
|
7
|
import glob
|
7
|
8
|
import torrentfile
|
|
@@ -31,16 +32,21 @@ manager = torrentmanager.TorrentManager(maxRatio, maxRate)
|
31
|
32
|
run = True
|
32
|
33
|
while run:
|
33
|
34
|
for file in glob.glob(torrentsPath + "/*.torrent"):
|
|
35
|
+ torrent = torrentfile.TorrentFile()
|
34
|
36
|
try:
|
35
|
|
- torrent = torrentfile.TorrentFile()
|
36
|
37
|
torrent.readFile(file)
|
|
38
|
+ except:
|
|
39
|
+ os.remove(file)
|
|
40
|
+ warning("could not load", file)
|
|
41
|
+
|
|
42
|
+ try:
|
37
|
43
|
if not any(x.getName() == torrent.getName()
|
38
|
44
|
for x in manager.getTorrents()):
|
39
|
|
- debug("Found", torrent.getName())
|
40
|
45
|
torrent.getTracker().start()
|
|
46
|
+ debug("started", torrent.getName())
|
41
|
47
|
manager.appendTorrent(torrent)
|
42
|
48
|
except:
|
43
|
|
- warning("could not load or start", file)
|
|
49
|
+ warning("could not start", torrent.getName())
|
44
|
50
|
|
45
|
51
|
count = len(manager.getTorrents())
|
46
|
52
|
|