def get(self):
        """get() - when a http request comes in (from a priviliged user),
        check each orchestra's events page and decide whether they are
        busy or not!"""
        for orch in Orchestra.orchs:
            orch_entity = Orchestra.get_by_id(orch)
            if orch_entity:
                eventinfo = runupdate(orch)
                if eventinfo:
                    time = eventinfo[0]
                    location = eventinfo[1]
                    detail = eventinfo[2]
                    if location == None:
                        orch_entity.location = Orchestra.orchs[orch]["home"]
                        detail = """
                            <em>Could not findthe location listed</em><br />
                        """+detail
                    else:
                        orch_entity.location = ndb.GeoPt(
                            location[0], location[1])
                    orch_entity.time = time
                    orch_entity.detail = detail
                    orch_entity.put()

        return self.response.set_status(200)
    def get(self):
        """Sorts and returns our webpage on get requests,
        with all the Orchestras and their details from the NDB
        all formatted nicely with Jinja2"""
        for orch in Orchestra.orchs.keys():
            orch_entity = Orchestra.get_by_id(orch)
            if not orch_entity:
                geo_loc = Orchestra.orchs[orch]["home"]
                print orch, geo_loc
                gig_time = datetime.datetime.now()

                orch_entity = Orchestra(id=orch, location=geo_loc, time=gig_time)
                orch_entity.put()

        orch_results = Orchestra.query().fetch()

        template_values = {"orchs": orch_results, "orchlist": Orchestra.orchs}

        template = self.jinja_env.get_template("index.html")
        self.response.write(template.render(template_values))
Exemple #3
0
 def test_has_audio_extension(self):
     self.assertTrue(Orchestra._has_audio_extension("filename.mp3"))
     self.assertTrue(Orchestra._has_audio_extension("filename.flac"))
     self.assertTrue(Orchestra._has_audio_extension("filename.wav"))
     self.assertTrue(Orchestra._has_audio_extension("filename.WAV"))
     self.assertFalse(Orchestra._has_audio_extension("filename"))
     self.assertFalse(Orchestra._has_audio_extension("filename.avi"))
Exemple #4
0
#!/usr/bin/python

from tr_log_reader import TrLogReader
from argparse import ArgumentParser
import Queue
import threading
import time
from orchestra import Orchestra, Server
from session import Session
import subprocess
from logger import logger

parser = ArgumentParser()
parser.add_argument("sessiondir")
Server.add_parser_arguments(parser)
Orchestra.add_parser_arguments(parser)
options = parser.parse_args()

if options.realtime:
    if options.max_passivity:
        raise Exception("cannot enforce max passivity in real time")
    session = Session(realtime=True)
    sessiondir = session.dir
    logfile = session.get_log_reader()
    session.start()
else:
    sessiondir = options.sessiondir
    logfilename = "%s/session.log" % sessiondir

print "session: %s" % sessiondir
#!/usr/bin/python

from tr_log_reader import TrLogReader
from argparse import ArgumentParser
import Queue
import threading
import time
from orchestra import Orchestra, Server
from session import Session
from logger import logger

parser = ArgumentParser()
parser.add_argument("sessiondirs", nargs="+")
parser.add_argument("--pause", type=float, default=1.0)
Server.add_parser_arguments(parser)
Orchestra.add_parser_arguments(parser)
options = parser.parse_args()

assert not options.realtime

def get_chunk_from_queue():
    while True:
        try:
            # having a timeout allows ctrl-c to interrupt
            return tr_log.chunks_queue.get(True, timeout=10)
        except Queue.Empty:
            pass

def play():
    global orchestra_thread
    quit_on_end = False