Closed gfarrell closed 12 years ago
Oh, also migrated PersonSearch to ABPersonSearch
(I hope)
Ok, there's a problem in that if ABPersonSearch / ABPersonSearchCompleted are used, I get these errors
INFO Best matching result: "Call leslie" with a confidence of 56.67%
ERROR Unexpected error during plugin processing
Traceback (most recent call last):
File "/var/Siri/plugin.py", line 103, in run
self.__method(self, self.__speech, self.__lang, self.__method.__dict__[__criteria_key__][self.__lang].match(self.__speech))
File "/var/Siri/plugins/phoneCalls/__init__.py", line 295, in makeCall
self.call(self.findPhoneForNumberType(personToCall, numberType, language), personToCall, language)
File "/var/Siri/plugins/phoneCalls/__init__.py", line 191, in findPhoneForNumberType
favPhones = filter(lambda y: y.favoriteVoice if hasattr(y, "favoriteVoice") else False, person.phones)
AttributeError: 'ServerBoundCommand' object has no attribute 'phones'
Now on line 295 we have the following which matched the signature for findPhoneForNumberType
:
self.call(self.findPhoneForNumberType(personToCall, numberType, language), personToCall, language)
And on 191 we have:
favPhones = filter(lambda y: y.favoriteVoice if hasattr(y, "favoriteVoice") else False, person.phones)
So apparently person
is being passed as a ServerBoundCommand
. This implies that personToCall
on line 295 is a ServerBoundCommand
but I don't see why it should be.
Don't pull this request just yet, it still has a bug, but can we discuss it (unless you want me to move it to the issues section of SiriServerCore?)
this is no problem of core, every incoming packet is treated as ServerBoundCommand and not specific superclass of it. This is because I would need to search through all classes for the matching one and this would reduce performance. What you can do is you can create a new person object and initialize it using a given plist.
One could circumvent this using a one to one mapping, however this must then be maintained very carefully. Okay now I actually have an idea how one may do it.
But for the meantime, why don't you take a look at the sms plugin who things are done there
But this shouldn't have happened should it? The API for PersonSearch should remain the same as for ABPersonSearch (likewise for AB/PersonSearchCompleted) no?
I'll look more closely this evening.
actually yes, and actually you should be able to access the properties that are existing, so it is likely that the iDevice did not send something
It seems to be working again, it's possible that there was a one-off problem...
Cleaned up the code a little and also added en-GB translations