def parseArgs(args): global GLOBAL_CONFIG GLOBAL_CONFIG = vars(args) if GLOBAL_CONFIG['add'] != None: song_dict = search.singleSongInfo(GLOBAL_CONFIG['add']) fileop.saveUrl(song_dict) elif GLOBAL_CONFIG['search'] != None: str_input = '+'.join(GLOBAL_CONFIG['search']) songs_dict = search.multiSongInfo(str_input) fileop.saveToJson(songs_dict) elif GLOBAL_CONFIG['remove'] != None : fileop.removeSelected(GLOBAL_CONFIG['remove']) elif GLOBAL_CONFIG['play'] != None: player.start(GLOBAL_CONFIG['play']) elif GLOBAL_CONFIG['clear'] == True: fileop.clearAll() elif GLOBAL_CONFIG['list'] == True: fileop.listData() else: printUsage()
def start(self): if self.state > STATE_START: return self logging.info("Starting game") self.__init__() self.state = STATE_PLAY for player in self.players: print("Started %s" % (player)) player.start() return self
def post(self): try: local_path = urllib.url2pathname(self.request.get("path")) logging.error("piplay:"+ local_path) os_path="".join([os.path.dirname(__file__),'/',local_path]) logging.error("piplay:"+ os_path) if is_video(os_path) : logging.error("isvideo") player.start(os_path) self.redirect("/remote"); else : self.redirect("/explorer"); except: logging.error("except:"+str(error)) self.redirect("/explorer")
def run(port): import player g1 = player.start() if app.config["DEBUG"]: g2 = gevent.spawn(run_debug, port) else: g2 = gevent.spawn(run_production, port) gevent.joinall([g1, g2])
def get(self): local_path = urllib.url2pathname(self.request.get("path")) if local_path == '' : local_path = "videos/" try: logging.error("try!") os_path=os.path.join(os.path.dirname(__file__),local_path) logging.error("ospath!") file_path = os_path[:-1] if os.path.isfile(file_path) is True: logging.error("isfile!") if is_video(file_path) is True: player.start(file_path) self.render("remote.html"); return file_list = os.listdir(os_path) logging.error("filelist") except Exception,error: logging.error("excepion:" + str(error)) self.redirect("explorer") return
def play_note(player, freq, beat): player.ChangeFrequency(freq) player.start(50) time.sleep(0.9 * beat) player.stop() time.sleep(0.1 * beat)
def addPlayer(self, player): self.players.append(player) if self.state > STATE_START: player.start(self.turn) return player
isLeaf = True def render_POST(self, request): if request.args.get(b'action') == [b"next"]: new_song = player.next_song() if request.args.get(b'action') == [b"pause"]: player.pause() if request.args.get(b'velocity_adjustment') is not None: player.controls['VELOCITY_ADJUSTMENT'] = int( request.args.get(b'velocity_adjustment')[0]) return (b"Hello world.") site = server.Site(Simple()) player.port = mido.open_output('Axiom Pro 25:Axiom Pro 25 MIDI 1 20:0') player.start(playlist=songs) reactor.listenTCP(8670, site) def simple_note(note_number, velocity=60, delay=1): print(f"playing {note_number} at velocity {velocity}") port.send(mido.Message(type="note_on", note=note_number, velocity=velocity)) time.sleep(delay) port.send(mido.Message(type="note_off", note=note_number, velocity=0)) port.send(mido.Message(type="note_off", note=note_number, velocity=127)) def main_thing(): try: for song in songs:
def Main(): host = input("Host IP: ") port = input("Port: ") network = Thread(target=connect_server, args=(host, port)) game = Thread(target=player.start(), args=())
size = width, height = 600, 600 pg.init() screen = pg.display.set_mode(size) screen.fill( 'black' ) #Changes the background to black, this can be changed later to an image. display = pg.display display.set_caption('DDR 2021') display_font = pg.freetype.SysFont("Comic Sans MS", 30) display_font.render_to(screen, (0, 0), "Press Space to Start!", fgcolor='white') while True: for event in pg.event.get(): if event.type == pg.QUIT: pg.quit() quit() if event.type == pg.KEYDOWN: key = event.key '''if key == pg.K_ESCAPE: player.pause(paused)''' if key == pg.K_SPACE: display_font.render_to(screen, (0, 0), "Press Space to Start!", fgcolor='black', bgcolor='black') player.start(chosen_song, screen, display) pg.display.update()
parser = argparse.ArgumentParser(description="Run a simple HTTP server") parser.add_argument( "-l", "--listen", default="localhost", help="Specify the IP address on which the server listens", ) parser.add_argument( "-p", "--port", type=int, default=7000, help="Specify the port on which the server listens", ) args = parser.parse_args() print("Before run") # Run the webserver webserver.run(addr=args.listen, port=args.port, allData=allData) # Run master #global oscBuilder #global lastJsonData #global lastJsonDataTimestamp player = player.PlayerMaster(oscBuilder, allData) player.start() # Start forever loops #waitForever()