示例#1
0
文件: ftpd.py 项目: svanzoest/aksy
def main():
    parser = create_option_parser(usage='%prog [options]')
    parser.add_option("--ftp_host", nargs=1, dest="ftp_host",
      help="Server host or IP address to bind on. Only change if running in an isolated network!", default='localhost')
    parser.add_option("--ftp_port", nargs=1, dest="ftp_port",
      help="Server port to bind on.", default=2121)

    options = parser.parse_args()[0]

    authorizer = ftpserver.DummyAuthorizer()
    authorizer.add_anonymous('/', perm=('r', 'w'))

    address = (options.ftp_host, options.ftp_port)
    if options.ftp_host != 'localhost':
        import warnings
        warnings.warn('Running aksyftpd on non-local address %s' % options.ftp_host, RuntimeWarning)
    
    sampler = Devices.get_instance(options.sampler_type, options.connector)

    try:    
        ftp_handler = ftpserver.FTPHandler
        ftp_handler.authorizer = authorizer
        ftp_handler.banner = "aksyftpd (pyftpd version %s) ready." % ftpserver.__ver__
        ftp_handler.abstracted_fs = AksyFtpFS(sampler)

        ftpd = ftpserver.FTPServer(address, ftp_handler)
        ftpd.max_cons = 256
        ftpd.max_cons_per_ip = ftpd.max_cons 
        ftpd.serve_forever()
    finally:
        sampler.close()
示例#2
0
文件: get.py 项目: svanzoest/aksy
def create_option_parser():
    usage = """%prog [filename patterns]
    
    Download all program files and multis from memory:
    
    %prog *.akp *.akm
    
    Download the AUTOLOAD folder from disk:
    
    %prog -l disk sampler*/AUTOLOAD"""
    parser = config.create_option_parser(usage=usage)
    parser.add_option("-l",
                      nargs=1,
                      default="memory",
                      dest="location",
                      help="Download from location (memory or disk)")
    parser.add_option("-d",
                      nargs=1,
                      default=".",
                      dest="destdir",
                      help="The destination directory")
    parser.add_option("-o",
                      default=False,
                      dest="overwriteExisting",
                      help="Whether to overwrite existing files")
    return parser
示例#3
0
 
def main(): 
    parser = config.create_option_parser(usage="%prog [options]")
    options = parser.parse_args()[0]

    sampler = Devices.get_instance(options.sampler_type, options.connector)

    try:
        m = Main(sampler)
        accel_group = gtk.AccelGroup()
        
        win = gtk.Window()
        win.add_accel_group(accel_group)
        setup_keybindings(m, accel_group)

        win.add(m.editor)

        m.set_window(win)
        win.show_all()
        # TODO: make edit menu functional
        m.w_edit_menu.hide()
        win.connect("delete-event", gtk.main_quit)

        gtk.main()
    finally:
示例#4
0
文件: put.py 项目: svanzoest/aksy
def create_option_parser(): 
    usage = "%prog [files|folders]"
    parser = config.create_option_parser(usage)
    parser.add_option("-p", nargs=1, dest="programName",
          help="Upload the specified program and the samples it references")
    parser.add_option("-d", nargs=1, dest="drumProgramName",
          help="Create and upload a new drum program from files using a specific naming scheme")
    return parser
示例#5
0
def create_option_parser():
    usage = "%prog [files|folders]"
    parser = config.create_option_parser(usage)
    parser.add_option(
        "-p",
        nargs=1,
        dest="programName",
        help="Upload the specified program and the samples it references")
    parser.add_option(
        "-d",
        nargs=1,
        dest="drumProgramName",
        help=
        "Create and upload a new drum program from files using a specific naming scheme"
    )
    return parser
示例#6
0
文件: get.py 项目: svanzoest/aksy
def create_option_parser(): 
    usage = """%prog [filename patterns]
    
    Download all program files and multis from memory:
    
    %prog *.akp *.akm
    
    Download the AUTOLOAD folder from disk:
    
    %prog -l disk sampler*/AUTOLOAD"""
    parser = config.create_option_parser(usage=usage)
    parser.add_option("-l", nargs=1, default="memory", dest="location",
          help="Download from location (memory or disk)")
    parser.add_option("-d", nargs=1, default=".", dest="destdir",
          help="The destination directory")
    parser.add_option("-o", default=False, dest="overwriteExisting",
          help="Whether to overwrite existing files")
    return parser
示例#7
0
def main():
    parser = create_option_parser(usage='%prog [options]')
    parser.add_option(
        "--ftp_host",
        nargs=1,
        dest="ftp_host",
        help=
        "Server host or IP address to bind on. Only change if running in an isolated network!",
        default='localhost')
    parser.add_option("--ftp_port",
                      nargs=1,
                      dest="ftp_port",
                      help="Server port to bind on.",
                      default=2121)

    options = parser.parse_args()[0]

    authorizer = ftpserver.DummyAuthorizer()
    authorizer.add_anonymous('/', perm=('r', 'w'))

    address = (options.ftp_host, options.ftp_port)
    if options.ftp_host != 'localhost':
        import warnings
        warnings.warn(
            'Running aksyftpd on non-local address %s' % options.ftp_host,
            RuntimeWarning)

    sampler = Devices.get_instance(options.sampler_type, options.connector)

    try:
        ftp_handler = ftpserver.FTPHandler
        ftp_handler.authorizer = authorizer
        ftp_handler.banner = "aksyftpd (pyftpd version %s) ready." % ftpserver.__ver__
        ftp_handler.abstracted_fs = AksyFtpFS(sampler)

        ftpd = ftpserver.FTPServer(address, ftp_handler)
        ftpd.max_cons = 256
        ftpd.max_cons_per_ip = ftpd.max_cons
        ftpd.serve_forever()
    finally:
        sampler.close()