예제 #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")