This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, threadpool, macros | |
template spawnBackgroundJob(t: typedesc, chan:ptr TChannel[t], iter: expr): stmt {.immediate.}= | |
block: | |
proc threadFunc(channel: ptr TChannel[t]) {.thread.} = | |
echo "Thread is starting" | |
for i in iter: | |
echo "Sending ", i | |
channel[].send(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import libtorrent as lt | |
import time | |
import sys | |
ses = lt.session() | |
ses.listen_on(6881, 6891) | |
info = lt.torrent_info(sys.argv[1]) | |
h = ses.add_torrent({'ti': info, 'save_path': './'}) | |
print 'starting', h.name() |