Example #1
0
def main():
    file_location, download_dir = get_args()
    
    # parse the torrent file and make into an object
    torrentfile = TorrentFile(file_location)

    # create bittorrent client (brain behind everything)
    client = BitTorrentClient(download_dir, torrentfile)
    client.create_files()

    # create tracker and add it to the client
    tracker = Tracker(client.peer_id, torrentfile)
    client.add_tracker(tracker)

    # connect to the peers associated to the tracker
    tracker.get_peers_and_connect(client, torrentfile)
    
    reactor.run()