Esempio n. 1
0
 def __init__(self):
     dcTorrentLogging.setRootLogger(os.path.join(defaultDirs['log'], 'admin.log'), logging.DEBUG)
     self.logger = logging.getLogger('admin')
Esempio n. 2
0
    if len(argv) == 1:
        print '%s start tracker/seed/peer' % argv[0]
        print '%s make torrent' % argv[0]
        print
        sys.exit(2) # common exit code for syntax error

    if len(argv) == 3 and argv[1] == 'test':
        testDcTorrent(argv);

    if len(argv) > 3:
        if not os.path.exists(defaultDirs['log']):
            os.makedirs(defaultDirs['log'])
        start = argv[1]
        action = argv[2]
        if action == 'track':
            dcTorrentLogging.setRootLogger(os.path.join(defaultDirs['log'], 'track.log'), logging.DEBUG)
            t = TrackerServer(trackerAnnouceCallback)
            t.track(argv[3:])
        elif action == 'torrent':
            source = argv[3]
            filename = os.path.basename(source)
            dir = os.path.dirname(source)
            host = socket.gethostbyname(socket.gethostname())
            trackers = [host]
            make_torrent(filename, dir, trackers)
        elif action == 'torrents':
            # dir, tracker port
            host = socket.gethostbyname(socket.gethostname())
            dir = argv[3]
            trackers = [host]
            make_torrents(dir, trackers)