Changeset 243 for indytube/trunk
- Timestamp:
- 10/14/07 23:52:37 (15 months ago)
- Location:
- indytube/trunk/bittorrent
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
indytube/trunk/bittorrent/client.py
r241 r243 56 56 57 57 def _callRemoteFailed(self, result): 58 print "failed! %s " % result 58 59 print "failed! " 60 print " .__class__ =", result.__class__ 61 print " .getErrorMessage() =", result.getErrorMessage() 62 print " .type =", result.type 59 63 self._doReactorStop() 60 64 61 65 def runReactor(self): 62 reactor.run(installSignalHandlers=0) 66 #start the twisted reactor 67 # see http://twistedmatrix.com/trac/wiki/FrequentlyAskedQuestions#Igetexceptions.ValueError:signalonlyworksinmainthreadwhenItrytorunmyTwistedprogramWhatswrong 68 # if you want to not install the signal handlers 69 #reactor.run(installSignalHandlers=0) 70 reactor.run() 63 71 64 72 def _doReactorStop(self): 65 reactor.crash() 73 reactor.stop() 74 print "stopping reactor!" 75 #crash? if you do installSignalHandlers = 0 you may need it 76 #reactor.crash() 77 78 79 def main(): 80 # test a simple connection to the server, on the localhost 81 client = IndyTubeClient('localhost',9119) 82 client.setupOperation('http://localhost/download/video','filename.ogg') 83 client.connectToServer() 84 client.runReactor() 85 86 # this only runs if the module was *not* imported 87 if __name__ == '__main__': 88 main() 89 -
indytube/trunk/bittorrent/server.py
r239 r243 90 90 self.pb_downloadDir = config.get('pb-server', 'DOWNLOAD_DIR') 91 91 self.pb_serverName = config.get('pb-server', 'SERVER_NAME') 92 self.pb_trackerUrl = config.get('pb-server', 'TRACKER_URL') 92 93 93 print "I have %s %s %s %s " % ( self.pb_protocolPort , self.pb_torrentDir , self.pb_downloadDir, self.pb_serverName)94 print "I have %s %s %s %s %s " % ( self.pb_protocolPort , self.pb_torrentDir , self.pb_downloadDir, self.pb_serverName, self.pb_trackerUrl ) 94 95 95 96 def __init__(self): … … 117 118 torrent_filepath = self.pb_torrentDir + '/' + filename + ".torrent" 118 119 incoming_comment = "Torrent file made by Indytube" 119 make_meta_files( trackerURL, [incoming_fp], piece_len_pow2=18, comment=incoming_comment, target = torrent_filepath)120 make_meta_files( self.pb_trackerUrl, [incoming_fp], piece_len_pow2=18, comment=incoming_comment, target = torrent_filepath) 120 121 121 122 #4. Seeding and tracking! … … 162 163 # 163 164 #Ready for running via 164 #$ twisted -ny <nameofscript.py>165 #$ twisted -ny bittorrent/server.py
