示例#1
0
文件: xorg.py 项目: mjem/carrie
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
文件: server.py 项目: mjem/carrie
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
文件: xorg.py 项目: mjem/carrie
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
文件: server.py 项目: mjem/carrie
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
文件: server.py 项目: mjem/carrie
def forward(seconds):
	"""Send a skip forwards to mplayer only."""
	logging.info('forward ' + str(seconds) + 's')
	return fifo.send("seek " + str(seconds))
示例#8
0
文件: server.py 项目: mjem/carrie
def audlang():
	"""Tell mplayer to switch between audio languages."""
	return fifo.send("switch_audio")
示例#9
0
文件: server.py 项目: mjem/carrie
def sublang():
	"""Tell mplayer to switch between subtitle languages."""
	return fifo.send("sub_select")
示例#10
0
文件: server.py 项目: mjem/carrie
def sub():
	"""Tell mplayer to toggle subtitle visibility."""
	logging.debug('sending subvisibility')
	return fifo.send("sub_visibility")
示例#11
0
文件: server.py 项目: mjem/carrie
def osdoff():
	"""Tell mplayer to switch off on screen display."""
	return fifo.send("osd 1")
示例#12
0
文件: server.py 项目: mjem/carrie
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
文件: server.py 项目: mjem/carrie
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")