Exemplo n.º 1
0
def track(args):
    if len(args) == 0:
        print formatDefinitions(defaults, 80)
        return
    try:
        config, _ = parseargs(args, defaults, 0, 0)
    except ValueError as e:
        print 'error: ' + str(e)
        print 'run with no arguments for parameter explanations'
        return
    r = RawServer(threading.Event(), config['timeout_check_interval'],
                  config['socket_timeout'], ipv6_enable=config['ipv6_enabled'])
    t = Tracker(config, r)
    r.bind(config['port'], config['bind'],
           reuse=True, ipv6_socket_style=config['ipv6_binds_v4'])
    r.listen_forever(
        HTTPHandler(t.get, config['min_time_between_log_flushes']))
    t.save_state()
    print '# Shutting down: ' + isotime()
Exemplo n.º 2
0
def main(argv):
    program, _ = os.path.splitext(os.path.basename(argv[0]))
    usage = "Usage: %s <trackerurl> <file> [file...] [params...]" % program

    if len(argv) < 3:
        print "{}\n\n{}{}".format(usage, formatDefinitions(defaults, 80),
                                  announcelist_details)
        return 2

    try:
        config, args = parseargs(argv[1:], defaults, 2, None)
        for file in args[1:]:
            make_meta_file(file, args[0], config.copy(), progress=prog)
    except ValueError as e:
        print 'error: ' + str(e)
        print 'run with no args for parameter explanations'

    return 0
Exemplo n.º 3
0
def main(argv):
    program, _ = os.path.splitext(os.path.basename(argv[0]))
    usage = "Usage: %s <trackerurl> <file> [file...] [params...]" % program

    if len(argv) < 3:
        print "{}\n\n{}{}".format(usage, formatDefinitions(defaults, 80),
                                  announcelist_details)
        return 2

    try:
        config, args = parseargs(argv[1:], defaults, 2, None)
        for file in args[1:]:
            make_meta_file(file, args[0], config.copy(), progress=prog)
    except ValueError as e:
        print 'error: ' + str(e)
        print 'run with no args for parameter explanations'

    return 0
Exemplo n.º 4
0
def main(cmd, *argv):
    "Make a .torrent file for every file or directory in each given directory."
    program, _ = os.path.splitext(os.path.basename(cmd))
    usage = "Usage: %s <trackerurl> <dir> [dir...] [params...]" % program
    desc = __doc__

    if len(argv) < 2:
        print("{}\n{}\n{}{}".format(usage, desc,
                                    formatDefinitions(defaults, 80),
                                    announcelist_details))
        return 2

    try:
        config, args = parseargs(argv, defaults, 2, None)
        for directory in args[1:]:
            completedir(directory, args[0], config)
    except ValueError as error:
        print('error: ', error)
        print('run with no args for parameter explanations')
        return 1

    return 0
Exemplo n.º 5
0
def main(cmd, *argv):
    "Make a .torrent file for every file or directory in each given directory."
    program, _ = os.path.splitext(os.path.basename(cmd))
    usage = "Usage: %s <trackerurl> <dir> [dir...] [params...]" % program
    desc = __doc__

    if len(argv) < 2:
        print("{}\n{}\n{}{}".format(usage, desc,
                                    formatDefinitions(defaults, 80),
                                    announcelist_details))
        return 2

    try:
        config, args = parseargs(argv, defaults, 2, None)
        for directory in args[1:]:
            completedir(directory, args[0], config)
    except ValueError as error:
        print('error: ', error)
        print('run with no args for parameter explanations')
        return 1

    return 0
Exemplo n.º 6
0
def get_usage(defaults=defaults, cols=100, presets={}):
    return argslistheader + formatDefinitions(defaults, cols, presets)
Exemplo n.º 7
0
def get_usage(defaults=defaults, cols=100, presets={}):
    return argslistheader + formatDefinitions(defaults, cols, presets)