Пример #1
0
def command_to_player(command, player):
    logging.debug('Sending command {command} to {player}'.format(
        command=command, player=player))
    if player['type'] == 'youtube':
        if command == 'pause':
            return click(player, 0.01, 0.01)

        elif command == 'fullscreen':
            return click(player, 0.99, 0.01)

        else:
            return {'ok': False, 'message': 'command not supported'}

    elif player['type'] == 'youtube-fs':
        if command == 'pause':
            return click(player, 0.5, 0.5)

        elif command == 'fullscreen':
            return keypress('Escape')

        else:
            return {'ok': False, 'message': 'command not supported'}

    elif player['type'] == 'iplayer-fs':
        if command == 'pause':
            return click(player, 0.01, 0.01)

        elif command == 'fullscreen':
            return keypress('Escape')

        else:
            return {'ok': False, 'message': 'command not supported'}

    elif player['type'] == 'iplayer':
        if command == 'pause':
            return click(player, 0.01, 0.01)

        elif command == 'fullscreen':
            return click(player, 0.42, 0.08)

        else:
            return {'ok': False, 'message': 'command not supported'}

    elif player['type'] == 'mplayer':
        if command == 'pause':
            fifo.send('pause')
            return {'ok': True, 'message': 'done'}

        elif command == 'fullscreen':
            shell('xdotool', 'search', '--class', 'mplayer', 'windowactivate')
            fifo.send("vo_fullscreen")
            return {'ok': True, 'message': 'done'}

        else:
            return {'ok': False, 'message': 'command not supported'}

    else:
        logging.error('Type ' + player['type'])
        return {'ok': False, 'message': 'bad player detection'}
Пример #2
0
def voldown():
	"""On volume up request we:
	- Tell the window manager to decrease the volume and
	- Tell mplayer to increase the volume
	"""
	xorg.shell('xdotool', 'key', 'XF86AudioLowerVolume')
	fifo.send("volume -20")
	return 'ok'
Пример #3
0
def voldown():
    """On volume up request we:
	- Tell the window manager to decrease the volume and
	- Tell mplayer to increase the volume
	"""
    xorg.shell('xdotool', 'key', 'XF86AudioLowerVolume')
    fifo.send("volume -20")
    return 'ok'
Пример #4
0
def command_to_player(command, player):
	logging.debug('Sending command {command} to {player}'.format(command=command, player=player))
	if player['type'] == 'youtube':
		if command == 'pause':
			return click(player, 0.01, 0.01)

		elif command == 'fullscreen':
			return click(player, 0.99, 0.01)

		else:
			return {'ok': False, 'message': 'command not supported'}

	elif player['type'] == 'youtube-fs':
		if command == 'pause':
			return click(player, 0.5, 0.5)

		elif command == 'fullscreen':
			return keypress('Escape')

		else:
			return {'ok': False, 'message': 'command not supported'}

	elif player['type'] == 'iplayer-fs':
		if command == 'pause':
			return click(player, 0.01, 0.01)

		elif command == 'fullscreen':
			return keypress('Escape')

		else:
			return {'ok': False, 'message': 'command not supported'}

	elif player['type'] == 'iplayer':
		if command == 'pause':
			return click(player, 0.01, 0.01)

		elif command == 'fullscreen':
			return click(player, 0.42, 0.08)

		else:
			return {'ok': False, 'message': 'command not supported'}

	elif player['type'] == 'mplayer':
		if command == 'pause':
			fifo.send('pause')
			return {'ok': True, 'message': 'done'}

		elif command == 'fullscreen':
			shell('xdotool', 'search', '--class', 'mplayer', 'windowactivate')
			fifo.send("vo_fullscreen")
			return {'ok': True, 'message': 'done'}

		else:
			return {'ok': False, 'message': 'command not supported'}

	else:
		logging.error('Type ' + player['type'])
		return {'ok': False, 'message': 'bad player detection'}
Пример #5
0
def mute():
	"""On mute toggle request we:
	- Tell mplayer to toggle the volume
	- Tell the window manager to toggle the volume and
	"""
	if fifo.send("mute") == 'ok':
		return 'ok'

	else:
		xorg.shell('xdotool', 'key', 'XF86AudioMute')

	return 'ok'
Пример #6
0
def mute():
    """On mute toggle request we:
	- Tell mplayer to toggle the volume
	- Tell the window manager to toggle the volume and
	"""
    if fifo.send("mute") == 'ok':
        return 'ok'

    else:
        xorg.shell('xdotool', 'key', 'XF86AudioMute')

    return 'ok'
Пример #7
0
def forward(seconds):
	"""Send a skip forwards to mplayer only."""
	logging.info('forward ' + str(seconds) + 's')
	return fifo.send("seek " + str(seconds))
Пример #8
0
def audlang():
	"""Tell mplayer to switch between audio languages."""
	return fifo.send("switch_audio")
Пример #9
0
def sublang():
	"""Tell mplayer to switch between subtitle languages."""
	return fifo.send("sub_select")
Пример #10
0
def sub():
	"""Tell mplayer to toggle subtitle visibility."""
	logging.debug('sending subvisibility')
	return fifo.send("sub_visibility")
Пример #11
0
def osdoff():
	"""Tell mplayer to switch off on screen display."""
	return fifo.send("osd 1")
Пример #12
0
def osdon():
	"""Tell mplayer to switch on on screen display."""
	return fifo.send("osd 3")
Пример #13
0
def backward(seconds):
    """Send a skip backwards to mplayer only."""
    logging.info('backward ' + str(seconds) + 's')
    return fifo.send("seek -" + str(seconds))
Пример #14
0
def backward(seconds):
	"""Send a skip backwards to mplayer only."""
	logging.info('backward ' + str(seconds) + 's')
	return fifo.send("seek -" + str(seconds))
Пример #15
0
def forward(seconds):
    """Send a skip forwards to mplayer only."""
    logging.info('forward ' + str(seconds) + 's')
    return fifo.send("seek " + str(seconds))
Пример #16
0
def audlang():
    """Tell mplayer to switch between audio languages."""
    return fifo.send("switch_audio")
Пример #17
0
def sublang():
    """Tell mplayer to switch between subtitle languages."""
    return fifo.send("sub_select")
Пример #18
0
def sub():
    """Tell mplayer to toggle subtitle visibility."""
    logging.debug('sending subvisibility')
    return fifo.send("sub_visibility")
Пример #19
0
def osdoff():
    """Tell mplayer to switch off on screen display."""
    return fifo.send("osd 1")
Пример #20
0
def osdon():
    """Tell mplayer to switch on on screen display."""
    return fifo.send("osd 3")