(self, input)
| 82 | music_stt_engine) |
| 83 | |
| 84 | def delegateInput(self, input): |
| 85 | |
| 86 | command = input.upper() |
| 87 | |
| 88 | # check if input is meant to start the music module |
| 89 | if "PLAYLIST" in command: |
| 90 | command = command.replace("PLAYLIST", "") |
| 91 | elif "STOP" in command: |
| 92 | self.mic.say("Stopping music") |
| 93 | self.music.stop() |
| 94 | return |
| 95 | elif "PLAY" in command: |
| 96 | self.mic.say("Playing %s" % self.music.current_song()) |
| 97 | self.music.play() |
| 98 | return |
| 99 | elif "PAUSE" in command: |
| 100 | self.mic.say("Pausing music") |
| 101 | # not pause because would need a way to keep track of pause/play |
| 102 | # state |
| 103 | self.music.stop() |
| 104 | return |
| 105 | elif any(ext in command for ext in ["LOUDER", "HIGHER"]): |
| 106 | self.mic.say("Louder") |
| 107 | self.music.volume(interval=10) |
| 108 | self.music.play() |
| 109 | return |
| 110 | elif any(ext in command for ext in ["SOFTER", "LOWER"]): |
| 111 | self.mic.say("Softer") |
| 112 | self.music.volume(interval=-10) |
| 113 | self.music.play() |
| 114 | return |
| 115 | elif "NEXT" in command: |
| 116 | self.mic.say("Next song") |
| 117 | self.music.play() # backwards necessary to get mopidy to work |
| 118 | self.music.next() |
| 119 | self.mic.say("Playing %s" % self.music.current_song()) |
| 120 | return |
| 121 | elif "PREVIOUS" in command: |
| 122 | self.mic.say("Previous song") |
| 123 | self.music.play() # backwards necessary to get mopidy to work |
| 124 | self.music.previous() |
| 125 | self.mic.say("Playing %s" % self.music.current_song()) |
| 126 | return |
| 127 | |
| 128 | # SONG SELECTION... requires long-loading dictionary and language model |
| 129 | # songs = self.music.fuzzy_songs(query = command.replace("PLAY", "")) |
| 130 | # if songs: |
| 131 | # self.mic.say("Found songs") |
| 132 | # self.music.play(songs = songs) |
| 133 | |
| 134 | # print("SONG RESULTS") |
| 135 | # print("============") |
| 136 | # for song in songs: |
| 137 | # print("Song: %s Artist: %s" % (song.title, song.artist)) |
| 138 | |
| 139 | # self.mic.say("Playing %s" % self.music.current_song()) |
| 140 | |
| 141 | # else: |
no test coverage detected