|
@@ -9,7 +9,10 @@ import torrentmanager
|
9
|
9
|
import config
|
10
|
10
|
|
11
|
11
|
def warning(*objs):
|
12
|
|
- print("WARNING:", *objs, file=sys.stderr)
|
|
12
|
+ print(time.strftime("%d/%m/%Y %H:%M:%S"), "WARNING:", *objs, file=sys.stderr)
|
|
13
|
+
|
|
14
|
+def debug(*objs):
|
|
15
|
+ print(time.strftime("%d/%m/%Y %H:%M:%S"), *objs)
|
13
|
16
|
|
14
|
17
|
if len(sys.argv) >= 2:
|
15
|
18
|
config = config.Config(sys.argv[1])
|
|
@@ -33,7 +36,7 @@ while run:
|
33
|
36
|
torrent.readFile(file)
|
34
|
37
|
if not any(x.getName() == torrent.getName()
|
35
|
38
|
for x in manager.getTorrents()):
|
36
|
|
- print("Found", torrent.getName())
|
|
39
|
+ debug("Found", torrent.getName())
|
37
|
40
|
torrent.getTracker().start()
|
38
|
41
|
manager.appendTorrent(torrent)
|
39
|
42
|
except:
|
|
@@ -50,9 +53,9 @@ while run:
|
50
|
53
|
torrent = t['torrent']
|
51
|
54
|
secs = t['time']
|
52
|
55
|
if secs > 0:
|
53
|
|
- print(torrent.getName() + ": Next update in " + str(secs) + " seconds")
|
|
56
|
+ debug(torrent.getName() + ": Next update in " + str(secs) + " seconds")
|
54
|
57
|
time.sleep(secs)
|
55
|
|
- print("Updating", torrent.getName(),
|
|
58
|
+ debug("Updating", torrent.getName(),
|
56
|
59
|
"ratio =", (torrent.getTracker().getUploaded() / float(torrent.getSize())))
|
57
|
60
|
try:
|
58
|
61
|
manager.updateTorrent()
|