def __init__(self): # Create objects self.cfg = MasterConfig.MasterConfig() # Create the MusicPlayer to handle the music. This will be passed to the ShowRunner. self.player = MusicPlayer.MusicPlayer(self.cfg.getMusicDir()) # Using the list of configured Power Boxes, instantiate the power box list self.powerBoxList = {} self.powerBoxConfig = self.cfg.getPowerBoxList() for box in self.powerBoxConfig: self.powerBoxList[box['id']] = PowerBoxProxy.PowerBoxProxy( box['address'], box['port'], box['channels']) # Connect each PowerBoxProxy to its associated Power Box print("The following Power Boxes have been configured:") for box in self.powerBoxList: print(" Box #" + str(box) + ", address: " + self.powerBoxList[box].address + ", port: " + str(self.powerBoxList[box].port) + ", channels: " + str(self.powerBoxList[box].numChannels)) self.powerBoxList[box].connect() # Create the Show runner that will reach each script and run the show. self.showRunner = ShowRunner.ShowRunner(self.powerBoxList, self.player, self.cfg.getMusicDir()) # The playlist stores the high level of song/scripts and other generic light control commands. self.playlist = [] return
def __init__(self): self.dir = os.getcwd() self.library = Library(self.dir) #self.musicPlayer = threading.Thread(target=MusicPlayer.__init__, args = [self.library]) self.musicPlayer = MusicPlayer(self.library) self.musicPlayer.start() self.commandList = "download (song) - downloads a song to your library \nlist (songs/playlists) [start] - Lists your songs or playlists, optionally starting with certain character(s) \ncreate playlist (name) - creates a playlist with given name \nadd (song) :: (playlist) - adds given song in your library to given playlist \nshuffle [playlist] - shuffles your main library or a specific playlist \nplay (song/playlist) - plays the current music if no argument give, or plays a song or a playlist \ndelete (song/playlist) - removes a song or a playlist \npause - pauses the music \nrewind - rewinds the music \nskip - skips to the next song\ninfo - gives info about Tünz \nexit - exits Tünz"
def start(self): clock = ClockThread.ClockThread() clock.setDaemon(True) clock.start() musicPlayer = MusicPlayer.MusicPlayer() textToSpeech = TextToSpeech.TextToSpeech() weather = Weather.Weather() segmentDimmer = SegmentDimmerThread.SegmentDimmerThread(clock, weather) segmentDimmer.setDaemon(True) segmentDimmer.start() gCalendar = GCalendar.GCalendar() volumeController = VolumeControllerThread.VolumeControllerThread() volumeController.setDaemon(True) volumeController.start() sleep(1) # Wait one second so clock's hour and minute values get filled ready for when alarm needs them alarm = AlarmThread.AlarmThread(musicPlayer, textToSpeech, weather, clock, gCalendar) alarm.setDaemon(True) # DEFAULT WAKEUP TIME - 6:00AM alarm.setAlarm(6,0) alarm.start() internalCommServer = InternalCommServer.InternalCommServer(alarm, musicPlayer, textToSpeech) internalCommServer.setDaemon(True) internalCommServer.start() try: while (self.ended == False): sleep(1) except (KeyboardInterrupt, SystemExit): logger.warn("Interrupted") logger.warn("Main powering off process beginning") clock.end() alarm.end() segmentDimmer.end() volumeController.end() internalCommServer.end() sleep(2) logger.info("Main powering off process finished")
def __init__(self, source, master=None): ''' A constructor that takes in a Tk() master object (optional, defaults to None) Initializes the UI for the Tk window object. pre: Takes in a String source non-default argument. It is assumed to be a legal file directory, where a music library is stored on a device (i.e. mp3 player) ''' super().__init__(master) self.pack(expand=True, fill=BOTH) self.source_directory = source self.musicPlayer = mp.MusicPlayer() # self.musicPlayer.readMusicFile("defaults") # set up UI frames self.playBackFrame = Frame(self, bg=ui.fgLight) self.playBackFrame.pack(side=TOP, fill=X, ipady=ui.padSmall) self.playListsFrame = Frame(self, bg=ui.bgLight) self.playListsFrame.pack(side=LEFT, fill=Y) self.songFrame = MainView(self, source=self.source_directory, bg=ui.bgDark) self.songFrame.pack(expand=True, fill=BOTH) # playBackFrame UI self.rewindButton = Button(self.playBackFrame, text="<<") self.rewindButton.pack(side=LEFT, padx=(ui.padSmall, ui.padNone)) self.playButton = Button(self.playBackFrame, text=">") self.playButton.pack(side=LEFT) self.fastForwardButton = Button(self.playBackFrame, text=">>") self.fastForwardButton.pack(side=LEFT) self.songScaleValue = self.musicPlayer.getVolumeVar() self.songScale = Scale(self.playBackFrame, orient=HORIZONTAL, variable=self.songScaleValue) self.songScale.pack(side=LEFT, padx=(ui.padSmall, ui.padNone))
from MusicPlayer import * from SimpleMelodies import * # open simple synth # output 1 m = MusicPlayer(1) m.printDevices() m.playMusic(row) m.playMusic(yankee) m.close()