def setupApps(): # some apps will require startup methods to init certain things SpotifyControl.setup() WindowsVolumeMixerControl.updateDevices() WindowsProgramControl.setup() LaunchApplication.setup() Twitch.setup()
def skipToNextItem(Program): WindowsProgramControl.switchFocus(Program) keyboard = Controller() keyboard.press(Key.shift) keyboard.press(Key.right) keyboard.release(Key.shift) keyboard.release(Key.right) keyboard.press(Key.shift) keyboard.press("n") keyboard.release(Key.shift) keyboard.release("n")
def getCurrentlyPlaying(): global sp global cached_currently_playing global deviceIDs cached_currently_playing = sp.currently_playing() try: while cached_currently_playing == None: if len(deviceIDs) == 0: WindowsProgramControl.openProgram( "Spotify.exe") # takes a looong time to open while deviceIDs == None or len(deviceIDs) == 0: deviceIDs = getDeviceIds() WindowsProgramControl.minimizeProgByName("Spotify") sp.transfer_playback(deviceIDs[0]) sp.pause_playback(device_id=deviceIDs[0]) cached_currently_playing = sp.currently_playing() cached_currently_playing['volume'] = getVolume( ) # appends volume also (it's not included in the original data) return cached_currently_playing except Exception as e: print(e) return None
def pressNum7(Program): WindowsProgramControl.switchFocus(Program) keyboard = Controller() key = "7" keyboard.press(key) keyboard.release(key)
def Fullscreen(Program): WindowsProgramControl.switchFocus(Program) keyboard = Controller() key = "f" keyboard.press(key) keyboard.release(key)
def pressDownArrow(Program): WindowsProgramControl.switchFocus(Program) keyboard = Controller() keyboard.press(Key.down) keyboard.release(Key.down)
def pressRightArrow(Program): WindowsProgramControl.switchFocus(Program) keyboard = Controller() keyboard.press(Key.right) keyboard.release(Key.right)
def miniplayer(Program): WindowsProgramControl.switchFocus(Program) keyboard = Controller() key = "i" keyboard.press(key) keyboard.release(key)
def pressESC(Program): WindowsProgramControl.switchFocus(Program) keyboard = Controller() keyboard.press(Key.esc) keyboard.release(Key.esc)
def theaterMode(Program): WindowsProgramControl.switchFocus(Program) keyboard = Controller() key = "t" keyboard.press(key) keyboard.release(key)
def mute(Program): WindowsProgramControl.switchFocus(Program) keyboard = Controller() key = "m" keyboard.press(key) keyboard.release(key)
def closePlayer(Program): WindowsProgramControl.switchFocus(Program) keyboard = Controller() key = "x" keyboard.press(key) keyboard.release(key)
def pressSpacebar(Program): WindowsProgramControl.switchFocus(Program) keyboard = Controller() keyboard.press(Key.space) keyboard.release(Key.space)