Re: a2dp, myth, pulse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sorry guys, you can crash mythtv if you don't drain the socket...

    #***
  #*********************************************************************
#*************************************************************************
#***
#*** GizmoDaemon Config Script
#*** 	AVRCP controls for MythTV
#***
#*****************************************
  #*****************************************
    #***

from GizmoDaemon import *
from GizmoScriptEnableChecker import *
import sys
import telnetlib
import time

ENABLED = True
VERSION_NEEDED = 3.2

class AVRCPMythTV(GizmoScriptEnableChecker):
	"""
	CatchAll Event Mapping for Testing
	"""

	def msend(self, msg):
		telnet = telnetlib.Telnet("localhost", 6546)
		telnet.read_until("# ")
		time.sleep(0.1)
		telnet.write(msg + "\n")
		time.sleep(0.1)
		telnet.read_eager()
		telnet.write("quit\n")
		time.sleep(0.1)
		telnet.read_all()
		telnet.close

	def onEvent(self, Event, Gizmo = None):
		"""
		See GizmodDispatcher.onEvent documention for an explanation of this function
		"""

		if Event.Remote:
			return False

		if Event.Class != GizmoEventClass.Standard:
			return False

		if Event.Type != GizmoEventType.EV_KEY:
			return False

		if Event.Value != 1:
			return False

		name = str(Event.Code)
		if name == "KEY_NEXTSONG":
			self.msend("key right")
			return True
		elif name == "KEY_PLAYCD" or name == "KEY_PAUSECD":
			self.msend("key p")
			return True
		elif name == "KEY_STOPCD":
			self.msend("key escape")
			return True
		elif name == "KEY_PREVIOUSSONG":
			self.msend("key left")
			return True

		return False

	def __init__(self):
		"""
		Default Constructor
		"""

		GizmoScriptEnableChecker.__init__(self, ENABLED, VERSION_NEEDED)

AVRCPMythTV()
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux