Exemple #1
0
	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"
Exemple #2
0
def applications(text):
    if 'chrome' in text or 'google' in text:
        try:
            return subprocess.Popen(
                r'C:\Program Files\Google\Chrome\Application\chrome.exe')
        except FileNotFoundError:
            return subprocess.Popen(
                r'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe')
    elif 'discord' in text:
        return subprocess.Popen(
            r'C:\Users\{}\AppData\Local\Discord\app-0.0.308\Discord.exe'.
            format(username))
    elif 'windows explorer' in text or 'explorer' in text:
        return subprocess.Popen(r'C:\Windows\explorer.exe')
    elif 'premiere' in text:
        try:
            return subprocess.Popen(
                r'C:\Program Files\Adobe\Adobe Premiere Pro 2020\Adobe Premiere Pro.exe'
            )
        except FileNotFoundError:
            return subprocess.Popen(
                r'C:\Program Files (x86)\Adobe Premiere Pro 2020\Adobe Premiere Pro.exe'
            )
    elif 'pycharm' in text:
        try:
            return subprocess.Popen(
                r'C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\bin\pycharm64.exe'
            )
        except FileNotFoundError:
            return subprocess.Popen(
                r'C:\Program Files (x86)\JetBrains\PyCharm Community Edition '
                r'2020.2.1\bin\pycharm64.exe')
    elif 'steam' in text:
        try:
            return subprocess.Popen(r'C:\Program Files\Steam\steam.exe')
        except FileNotFoundError:
            return subprocess.Popen(r'C:\Program Files (x86)\Steam\steam.exe')
    elif 'cad' in text:
        try:
            return subprocess.Popen(
                r'C:\Program Files\Autodesk\AutoCAD 2019\acad.exe')
        except FileNotFoundError:
            return subprocess.Popen(
                r'C:\Program Files (x86)\Autodesk\AutoCAD 2019\acad.exe')
    elif 'groove' in text:
        Player.play()
    else:
        if len(text) > 0:
            return Error.printline(f"[ERROR]: {text} is not available.")
        else:
            return Error.printline(f"[ERROR]: No input found.")
Exemple #3
0
 def Submit1():
     runStat.set("Running..")
     folder_name = folder1.get("1.0","end-1c")
     #print(folder1.get("1.0","end-1c"))
     playlist_link = link1.get("1.0","end-1c")
     #print(link1.get("1.0","end-1c"))
     link_to_pass = "******"+folder_name
     if not os.path.isdir(link_to_pass): 
         runStat.set("Downloading Youtube Playlist")
         download_youtube_playlist.execute(playlist_link)
         runStat.set("Converting files to mp3")
         convert_to_mp3.execute(folder_name)
     #p1 = subprocess.call(["python",'\"C:\\Users\\Envy3\\Dropbox (MIT)\\MIT\\Freshman\\Summer\\Learning Creative Learning (LCL)\\Week5.py\"',link_to_pass], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
     runStat.set("Started Music Player")
     MusicPlayer.execute(link_to_pass)
    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
Exemple #5
0
 def __init__(self, queue):
     Observable.__init__(self)
     
     self._musicplayer = MusicPlayer.GStreamerPlayer()
     self._musicplayer.attach(self)
     
     self.queue = queue
     self._currentTrack = None
     
     self.state = PlayerStates.STOPPED
     
     print("Creating a new QueuePlayer object")
Exemple #6
0
 def start(self, amount):
     print amount
     if self.thread == "" or not self.thread.is_alive():
         print "initing player"
         player = Player.Player(self.username, self.spotify, self.device,
                                self.playlist, int(amount))
         self.thread = player
         player.start()
         return "started player"
     else:
         print "player is already running"
         return "player is already running"
Exemple #7
0
    def __init__(self):
        GPIO.setmode(GPIO.BOARD)

        self.display = LCDDisplay.LCDThread()

        self.display.spool_string_value("GPM-Connecting..", "Please wait     ")

        self.mus = Mobileclient()
        fd = open('Secret.txt', 'r')
        data = fd.read().split("\n")
        fd.close()
        self.mus.login(data[0], data[1], Mobileclient.FROM_MAC_ADDRESS)

        self.Lib = self.mus.get_all_songs()
        self.playlists = self.mus.get_all_user_playlist_contents()

        tplay = self.playlists
        self.playlists = {}

        self.index = 0

        for pl in tplay:
            out = self.append_song_to_playlist(pl, songs=self.Lib)
            self.playlists[out["name"]] = out

        self.lists_w_id = [{'quit': 0}]
        for item in self.playlists.values():
            self.lists_w_id.append({item["name"]: item["id"]})

        self.display.spool_string_value("Ready           ", "Awaiting input  ")
        self.button_set_up()
        self.display.spool_string_value(
            self.lists_w_id[self.index].items()[0][0][:16])

        self.player = MusicPlayer.PlayerThread(self.playlists, self.display,
                                               self, self.Lib)
        self.working = True

        try:
            while self.working:
                time.sleep(10)
        except KeyboardInterrupt:
            pass
        finally:
            self.display.spool_string_value("Stopping...", "Have a nice day")
            self.end_clear()
Exemple #8
0
	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")
Exemple #9
0
    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))
Exemple #10
0
    def __init__(self):
        self.window = Tk()
        self.window.title("Sample Manager")
        self.window.geometry("1920x1080")
        #self.window.resizable(0, 0)

        self.samplePlayer = MusicPlayer.Teste()

        self.treeRowValue = []
        self.selectedSample = None

        self.loopMode = False
        self.isPausedStatus = False

        directory = 'D:\\'

        self.factQuery = []
        self.tagQuery = []

        self.t = StringVar()
        self.t.set("00:00")

        self.label = tk.Label(text="")
        #self.label.place(x=300 + indexs.xPlayerGrid,y=300 + indexs.yPlayerGrid)
        self.update_clock()


        self._buildMenuBar()

        self._buildSampleSpace()

        self._buildTagSpace()

        self._buildPlayerSpace()

        self.window.mainloop()
Exemple #11
0
 def pause(self):
     MusicPlayer.pause()
Exemple #12
0
from distanceCalculation import *
from cameraOpen import *
from landmarks import *
from tkinter.messagebox import *

mood = camera()
if not mood:
    showerror("EBMP", "No mood has been detected")
else:
    import MusicPlayer
    MusicPlayer.call(mood, "normal")
 def remaining(self):
     return MusicPlayer.minutesRemaining()
 def pause(self):
     MusicPlayer.pause()
 def play(self):
     MusicPlayer.play(MusicLibrary.looking)
Exemple #16
0
def animate():
    for c in itertools.cycle(['|', '/', '-', '\\']):
        if done:
            break
        GUI.window["_INFO_"].update('\rloading ' + c)
        time.sleep(0.1)


#Runs the window in a loop
while True:
    event, values = GUI.window.read()
    if event is None:  # always,  always give a way out!
        break
    if event == "Play Music":
        if values["_SONG_"] == "FitGirl":
            MusicPlayer.setSong1()
        elif values["_SONG_"] == "Eye Of The Tiger":
            MusicPlayer.setSong2()
        elif values["_SONG_"] == "Push It To The Limit":
            MusicPlayer.setSong3()
        elif values["_SONG_"] == "Eye Of The Tiger":
            MusicPlayer.setSong3()
    elif event == "Stop Music":
        MusicPlayer.stopMusic()
    elif event == "+":
        MusicPlayer.volumeUP()
    elif event == "-":
        MusicPlayer.volumeDOWN()
    elif event == "IP Config":  #This will do stuff if button named "IP Config" button is pressed
        ipconfigFunc()
        threading.Timer(0.5, animate).start(
Exemple #17
0
class Tunz:

	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"


	#A method to change directories to the main Tünz directory. It will first check if it is in that directory, and if it's not it cds into it
	def mainDir(self):
		print ""+os.getcwd()
		print self.dir
		if os.cwdir() == self.dir:
			print "in directory"
		else:
			print "changing"
			os.chdir('..')

	#A method to change directories to the Tünz Library directory. It will first check if it is in that directory, and if it's not it cds into it
	def libDir(self):
		print ""+os.getcwd()
		print self.dir
		if os.getcwd() != self.dir:
			print "in directory"
		else:
			print "changing"
			os.chdir('Tünz Library')

	#loads all the songs in your library into an array to be used for playing the songs and displaying them
	def updateLibrary(self):
		self.library = []
		for song in next(os.walk('.'))[1]:
			self.library.append(song)
		self.library.sort()

	def queueSongs(self):
		i = self.library.index(self.currentSong)
		for song in self.library[i:]:
			mixer.music.queue(song+"/"+song+".mp3")

	def queueSong(self,song):
		mixer.music.queue(song+"/"+song+".mp3")

	#download a song based by the name given in the command
	def download(self,command):
		#NOTE check input
		currentDL = Download(command,self.library) #passes reference to library so it can check if things are already in the library and stop the process
		if currentDL.downloadedSuccessfully():
			self.library.addSong(currentDL.getSong())
			print "[!] DONE!"
		else:
			print "[!] ERROR WHILE DOWNLOADING"

	def goto(self,command):
		if len(command) == 2:
			if self.playing:
				mixer.music.play(0,(int(command[1])))
			else:
				print "[x] Nothing playing!"
		else:
			print "[x] format of 'goto' is goto (time)"

	def play(self,command):
		self.musicPlayer.play(command)

	def add(self,command):
		if self.manualQueue:
			if len(command) == 1:
				print ("[x] Syntax for add - 'add (song)")
			else:
				command.remove(command[0])
				command = "_".join(command)
				if command in self.library:
					#try:
					#mixer.music.load(command+"/"+command+".mp3")
					self.queueSong(command)
					print "[+] Song queued!"
					#except:
				else:
					print "[x] Song isn't in your library"
		else:
			print "[x] manual queue is not on. Use 'queue manual' to switch"

	def pause(self):
		self.musicPlayer.pause()

	def stop(self):
		self.musicPlayer.stop()

	def list(self,command):
		if len(command) == 2:
			if command[1] == "songs":
				self.library.listSongs()
			elif command[1] == "playlists":
				self.library.listPlaylists()
			else:
				print "[x] format for 'list' - list (song/playlist) [start/contains]"
		elif len(command) == 3 and len(command[2]) == 1:
			if command[1] == "songs":
				self.library.listSongs(command[2])
			elif command[1] == "playlists":
				self.library.listPlaylists(command[2])
			else:
				print "[x] format for 'list' - list (song/playlist) [start/contains]"
		elif len(command) >= 3:
			if command[1] == "songs":
				self.library.listSongs(" ".join(command[2:len(command)]))
			elif command[1] == "playlists":
				self.library.listPlaylists(" ".join(command[2:len(command)]))
			else:
				print "[x] format for 'list' - list (song/playlist) [start/contains]"
		else:
			print "[x] format for 'list' - list (song/playlist) [start/contains]"


	def start(self):
		while True:
			command = raw_input("[♫] ").split(" ")

			if command[0] == "help": #HELP -----------
				print self.commandList

			elif command[0] == "download": #DOWNLOAD -----------
				self.download(command)

			elif command[0] == "list": #LIST ----------
				self.list(command)

			elif command[0] == "add":
				self.add(command)

			elif command[0] == "goto":
				self.goto(command)

			elif command[0] == "play":
				self.play(command)

			elif command[0] == "pause":
				self.pause()

			elif command[0] == "stop":
				self.stop()

			elif command[0] == "create":
				if len(command) == 2:
					if command[1] == "create playlist":
						print "create it yourself"

			elif command[0] == "queue":
				if len(command) == 2:
					if command[1] == "manual":
						self.stop()
						self.manualQueue = True
						print "[+] Now on manual queue"
					elif command[0] == "auto":
						self.stop()
						self.manualQueue = False
						print "[+] Now on auto queue"
					else:
						print "[x] format for queue - 'queue (manual/auto)'"
				else:
					print "[x] format for queue - 'queue (manual/auto)'"

			elif command[0] == "current":
				if len(command) == 1:
					if self.currentSong != "No Song Selected":
						print "[+] Current Song is "+self.currentSong.replace("_"," ")+" ("+str(datetime.timedelta(seconds=mixer.music.get_pos()/1000))+")"
					else:
						print "[x]"+self.currentSong
				elif len(command) == 2 and command[1] == "playlist":
					if self.currentPlaylist != "No Playlist Selected":
						print "[+] Current playlist is "+self.currentPlaylist
					else:
						print "[x] No Playlist Selected"

			elif command[0] == "exit" or command[0] == "quit": #EXIT -----------
				print "Stopping music player thread..."
				#may need to have a method call to musicPlayer here
				self.musicPlayer.join()
				print "Exiting..."
				sys.exit(0)    
Exemple #18
0
 def remaining(self):
     return MusicPlayer.minutesRemaining()
from MusicPlayer import *
from SimpleMelodies import *

# open simple synth
# output 1
m = MusicPlayer(1)
m.printDevices()
m.playMusic(row)
m.playMusic(yankee)
m.close()
Exemple #20
0
 def play(self):
     MusicPlayer.play(MusicLibrary.looking)
Exemple #21
0
                    s.send(str(brew_status))
                if "LightOff" == datagram:
                    print "Turning light off"
                    LightController.off()
                    s.send("OFF")
                if "LightOn" == datagram:
                    print "Turning light on"
                    LightController.on_remote()
                    s.send("ON")
                if "Sunrise" == datagram:
                    print "Beginning sunrise"
                    LightController.sunrise()
                    s.send("SUNRISE")
                if "MusicSources" == datagram:
                    print "Music sources list requested"
                    music_sources = MusicPlayer.list_sources()
                    pickled_sources = pickle.dumps(music_sources)
                    s.send(pickled_sources)
                if "MusicStop" == datagram:
                    print "Music stop requested"
                    MusicPlayer.stop()
                    s.send("MUSICSTOP")
                if "MusicPlay" == datagram[0:9]:
                    print "Music play requested"
                    pickled_source = datagram[9:]
                    new_source = pickle.loads(pickled_source)
                    MusicPlayer.stop()  # kill any existing music
                    MusicPlayer.play_source(new_source)
                    s.send("MUSICPLAY")

                if "SetAlarm" == datagram[0:8]: