[tuxdroid-svn] r6011 - software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/execut
Status: Beta
Brought to you by:
ks156
From: jerome <c2m...@c2...> - 2009-12-24 14:02:24
|
Author: jerome Date: 2009-12-24 15:01:51 +0100 (Thu, 24 Dec 2009) New Revision: 6011 Modified: software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/communicator.py software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/utils.py Log: * Fixed audio bug ( Linux ). Modified: software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/communicator.py =================================================================== --- software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/communicator.py 2009-12-22 15:23:13 UTC (rev 6010) +++ software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/communicator.py 2009-12-24 14:01:51 UTC (rev 6011) @@ -41,11 +41,6 @@ connectionObj = None currentUser = None - #Audio card values. - IN = 'default' - OUT = 'default' - RINGER = 'default' - #Online status ONLINE = 'ONLINE' AWAY = 'AWAY' @@ -75,10 +70,6 @@ '''Init procedure. ''' self.connectionObj = Connector - #Updating audio cards values. - self.IN = AudioUtils.getSoundDeviceNameTuxdroidMicro() - self.OUT = AudioUtils.getSoundDeviceNameTuxdroidAudio() - self.RINGER = self.OUT #Getting current user. try: self.currentUser = connectionObj.getSkypeAPI().CurrentUser @@ -91,18 +82,19 @@ def __set_tux_in_out__(self): '''Set Tux Droid as audio card for Skype client. ''' - try: - self.connectionObj.getSkypeAPI().Settings.AudioIn = self.IN - self.connectionObj.getSkypeAPI().Settings.AudioOut = self.OUT - self.connectionObj.getSkypeAPI().Settings.Ringer = self.RINGER + try: + #Updating audio cards values. + self.connectionObj.getSkypeAPI().Settings.AudioIn = AudioUtils.getSoundDeviceNameTuxdroidMicro() + self.connectionObj.getSkypeAPI().Settings.AudioOut = AudioUtils.getSoundDeviceNameTuxdroidAudio() + self.connectionObj.getSkypeAPI().Settings.Ringer = AudioUtils.getSoundDeviceNameTuxdroidAudio() time.sleep(1.0) #Checking if Tux Droid was successfully set as audio card. if self.isTuxDroidAudioCard(): return True + return False + except: return False - except: - #Return False, maybe Tux Droid is not connected. - return False + # -------------------------------------------------------------------------- # Return true if Tux Droid is set as audio card. @@ -110,11 +102,11 @@ def __is_tux_audio__(self): '''Return true if Tux Droid is set as audio card. ''' - if not ( self.connectionObj.getSkypeAPI().Settings.AudioIn == self.IN ): + if not ( self.connectionObj.getSkypeAPI().Settings.AudioIn == AudioUtils.getSoundDeviceNameTuxdroidMicro() ): return False - if not ( self.connectionObj.getSkypeAPI().Settings.AudioOut == self.OUT ): + if not ( self.connectionObj.getSkypeAPI().Settings.AudioOut == AudioUtils.getSoundDeviceNameTuxdroidAudio()): return False - if not ( self.connectionObj.getSkypeAPI().Settings.Ringer == self.RINGER ): + if not ( self.connectionObj.getSkypeAPI().Settings.Ringer == AudioUtils.getSoundDeviceNameTuxdroidAudio() ): return False return True Modified: software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py =================================================================== --- software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py 2009-12-22 15:23:13 UTC (rev 6010) +++ software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py 2009-12-24 14:01:51 UTC (rev 6011) @@ -35,7 +35,7 @@ import connector from communicator import SynchroniousCommands, AsynchroniousCommands from errors import EquipmentException, UnavailableContactException, UserNotFindException -from utils import StringUtils, TuxDroidServerUtils, SkypeClient +from utils import StringUtils, TuxDroidServerUtils, SkypeClient, AudioUtils from IPN.IPNServer import IPNServer from IPN.IPNClient import IPNClient @@ -111,7 +111,7 @@ mutex = threading.Lock() #Used for run command only. - command = "" + command = None canrun = True #Used for outgoing parameter only. @@ -160,10 +160,13 @@ def onPluginStop(self): '''OnPluginStop event. ''' - if self.getCommand() == 'check': - self.serv.stop() - if self.getCommand() == 'run': - self.client.stop() + try: + if self.getCommand() == 'check': + self.serv.stop() + if self.getCommand() == 'run': + self.client.stop() + except: + pass ##---------------------------------------------------------------- @@ -192,6 +195,11 @@ return if eventName == 'head': + #If no commands defined, then quit plugin. + + if self.command is None: + self.client.notify(END) + #Incoming call head button if self.command == COMMAND_INCOMING: self.client.notify(ACCEPT_INCOMING) @@ -506,10 +514,11 @@ time.sleep(1.0) #Setting Tux Droid as audio peripheral. + try: #in try statement to take calls in care. if ( self.synchronious != None ) and ( not self.synchronious.isTuxDroidAudioCard() ): - self.synchronious.setAudioCards() + self.throwTrace(self.synchronious.setAudioCards()) except: pass @@ -596,6 +605,10 @@ elif Message == CALL_CONTACT: thread = threading.Thread(target=self.callCurrentContact) thread.start() + + #Global close request from client. + elif Message == END: + self.serv.notify(END) if __name__ == "__main__": Modified: software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/utils.py =================================================================== --- software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/utils.py 2009-12-22 15:23:13 UTC (rev 6010) +++ software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/utils.py 2009-12-24 14:01:51 UTC (rev 6011) @@ -300,7 +300,7 @@ idx, deviceName = AudioUtils.getSoundDeviceByKeywordWin32("tuxdroid-audio") return deviceName else: - return "plughw:TuxDroid,0" + return "TuxDroid (plughw:TuxDroid,0)" # -------------------------------------------------------------------------- # Get the sound device name of Tux Droid Micro. @@ -324,7 +324,7 @@ pass return None else: - return "plughw:TuxDroid,0" + return "TuxDroid (plughw:TuxDroid,0)" #Static methods declaration. @@ -440,4 +440,4 @@ #Static methods declaration. getServerPort = staticmethod(getServerPort) - sendRequest = staticmethod(sendRequest) \ No newline at end of file + sendRequest = staticmethod(sendRequest) |