Ejemplo n.º 1
0
def root():
    """ Returns the spectrogram of audio data served from /data
    """
    app.debug = True
    if app.debug:
        with open("slug.json") as f:
            slug = json.load(f)
        jslibs = hemlib.slug_libs(app, slug['libs'])
        hemfiles = hemlib.coffee_assets(SRCDIR, HOST, PORT, excludes=EXCLUDES)

    else:
        jslibs = ['/static/js/demo/application.js']
        hemfiles = []
    print "soundserver hemfiles", hemfiles
    #demofiles = [os.path.join(EXAMPLE_SRCDIR,".coffee") for name in demos]
    demofiles = ["static/coffee/spectrogram.coffee"]

    for demo in demofiles:
        if not os.path.isfile(demo):
            raise RuntimeError("Cannot find demo named '%s'" % demo)

    hemfiles.extend(hemlib.make_urls(demofiles, HOST, PORT))

    return flask.render_template("spectrogram.html",
                                 jslibs=jslibs,
                                 hemfiles=hemfiles,
                                 demos="basdf")
Ejemplo n.º 2
0
def root():
    """ Returns the spectrogram of audio data served from /data
    """
    app.debug = True
    if app.debug:
        with open("slug.json") as f:
            slug = json.load(f)
        jslibs = hemlib.slug_libs(app, slug['libs'])
        hemfiles = hemlib.coffee_assets(SRCDIR, HOST, PORT,
                                        excludes=EXCLUDES)

    else:
        jslibs = ['/static/js/demo/application.js']
        hemfiles = []
    print("soundserver hemfiles", hemfiles)
    #demofiles = [os.path.join(EXAMPLE_SRCDIR,".coffee") for name in demos]
    demofiles = ["static/coffee/spectrogram.coffee"]

    for demo in demofiles:
        if not os.path.isfile(demo):
            raise RuntimeError("Cannot find demo named '%s'"%demo)

    hemfiles.extend(hemlib.make_urls(demofiles, HOST, PORT))

    return flask.render_template("spectrogram.html", jslibs = jslibs,
                                 hemfiles=hemfiles, demos="basdf")
Ejemplo n.º 3
0
def display_page(file_set, template, **extra_template_vars):
    for f in file_set:
        if not os.path.isfile(f):
            raise RuntimeError("Cannot find file named '%s'" % f)
    if app.debug:
        jslibs = hemlib.slug_libs(app, slug['libs'])
        hemfiles = hemlib.coffee_assets(SRCDIR, HOST, slug['port'],
                                        excludes=EXCLUDES)
        hemfiles.extend(hemlib.make_urls(file_set, HOST, slug['port']))
        print "demoserver hemfiles", hemfiles
    else:
        jslibs= ['/static/js/demo/application.js']
        hemfiles = []
    return flask.render_template(template, jslibs=jslibs,
            hemfiles=hemfiles, **extra_template_vars)
Ejemplo n.º 4
0
def display_page(file_set, template, **extra_template_vars):
    for f in file_set:
        if not os.path.isfile(f):
            raise RuntimeError("Cannot find file named '%s'" % f)
    if app.debug:
        jslibs = hemlib.slug_libs(app, slug['libs'])
        hemfiles = hemlib.coffee_assets(SRCDIR,
                                        HOST,
                                        slug['port'],
                                        excludes=EXCLUDES)
        hemfiles.extend(hemlib.make_urls(file_set, HOST, slug['port']))
        print "demoserver hemfiles", hemfiles
    else:
        jslibs = ['/static/js/demo/application.js']
        hemfiles = []
    return flask.render_template(template,
                                 jslibs=jslibs,
                                 hemfiles=hemfiles,
                                 **extra_template_vars)
Ejemplo n.º 5
0
def test(testname):
    if app.debug:
        with open("slug.json") as f:
            slug = json.load(f)
        jslibs = hemlib.slug_libs(app, slug['libs'])
        hemfiles = hemlib.coffee_assets(SRCDIR, HOST, PORT,
                    excludes=EXCLUDES)
    else:
        jslibs= ['/static/js/application.js']
        hemfiles = []
    tests = alltests[testname]
    testfiles = [os.path.join(SRCDIR, name+".coffee") for name in tests]
    for test in testfiles:
        if not os.path.isfile(test):
            raise RuntimeError("Cannot find test named '%s'"%demo)

    hemfiles.extend(hemlib.make_urls(testfiles, HOST, PORT))

    return flask.render_template("tests.html", jslibs=jslibs,
            hemfiles=hemfiles, tests=tests)
Ejemplo n.º 6
0
def test(testname):
    if app.debug:
        with open("slug.json") as f:
            slug = json.load(f)
        jslibs = hemlib.slug_libs(app, slug['libs'])
        hemfiles = hemlib.coffee_assets(SRCDIR, HOST, PORT, excludes=EXCLUDES)
    else:
        jslibs = ['/static/js/application.js']
        hemfiles = []
    tests = alltests[testname]
    testfiles = [os.path.join(SRCDIR, name + ".coffee") for name in tests]
    for test in testfiles:
        if not os.path.isfile(test):
            raise RuntimeError("Cannot find test named '%s'" % demo)

    hemfiles.extend(hemlib.make_urls(testfiles, HOST, PORT))

    return flask.render_template("tests.html",
                                 jslibs=jslibs,
                                 hemfiles=hemfiles,
                                 tests=tests)
Ejemplo n.º 7
0
def demo(demoname):

    if app.debug:
        with open("slug.demo.json") as f:
            slug = json.load(f)
        jslibs = hemlib.slug_libs(app, slug['libs'])
        hemfiles = hemlib.coffee_assets(SRCDIR, HOST, PORT)
    else:
        jslibs = ['/static/js/demo/application.js']
        hemfiles = []

    demos = alldemos[demoname]
    demofiles = [os.path.join(DEMO_SRCDIR, name+".coffee") for name in demos]

    for demo in demofiles:
        if not os.path.isfile(demo):
            raise RuntimeError("Cannot find demo named '%s'"%demo)

    hemfiles.extend(hemlib.make_urls(demofiles, HOST, PORT))

    return flask.render_template("demos.html", jslibs = jslibs,
                                 hemfiles=hemfiles, demos=demos)
Ejemplo n.º 8
0
def demo(demoname):

    if app.debug:
        with open("slug.demo.json") as f:
            slug = json.load(f)
        jslibs = hemlib.slug_libs(app, slug['libs'])
        hemfiles = hemlib.coffee_assets(SRCDIR, HOST, PORT)
    else:
        jslibs = ['/static/js/demo/application.js']
        hemfiles = []

    demos = alldemos[demoname]
    demofiles = [os.path.join(DEMO_SRCDIR, name + ".coffee") for name in demos]

    for demo in demofiles:
        if not os.path.isfile(demo):
            raise RuntimeError("Cannot find demo named '%s'" % demo)

    hemfiles.extend(hemlib.make_urls(demofiles, HOST, PORT))

    return flask.render_template("demos.html",
                                 jslibs=jslibs,
                                 hemfiles=hemfiles,
                                 demos=demos)