Example #1
0
    def __init__(self):
	self.daemon_config = "/etc/tpm/config"
	
	check_config.init_tpm()
	
	#Check the config, might make this a def.
	if check_config.check(self.daemon_config):
	    self.local_database = "/etc/tpm/torrent.db"
	    self.sql = sql.Database(self.local_database)
	    self.cfg = ConfigParser.RawConfigParser()
	    self.cfg.readfp(open(self.daemon_config))
	    self.ports = self.cfg.get("tracker", "ports")
	    self.tracker = self.cfg.get("tracker", "address")
	    self.server = self.cfg.get("server", "address")
	    self.s = libtorrent.session()
	    self.s.listen_on(int(self.ports.split(" ")[0]), int(self.ports.split(" ")[1]))
	    print "[tpmd] Running"
Example #2
0
File: tpm.py Project: Cightline/tpm
	    self.q.append("list_torrents")
	    self.list_torrents()
	
	elif self.options.torrent_largest:
	    self.q.append("torrent_largest")
	    self.message({"torrent_largest":self.options.torrent_largest})
	    


class tpm_Proto(LineReceiver):
    
    def connectionMade(self):
	t.handle_instance(self)
	
    def lineReceived(self, line):
	#print "server_line", line
	t.delegate_data(line)

if __name__ == "__main__":
    check_config.check_root()
    check_config.init_tpm()
    t = tpm()
    factory = protocol.ClientFactory()
    factory.protocol = tpm_Proto
    reactor.connectTCP("localhost", 8001, factory)
    reactor.run()