コード例 #1
0
def CreateListItem(id, mtype):
    item = UIListItem()
    if mtype == 'movie':
       y = json.VideoLibrary.GetMovieDetails(movieid=id, properties=['tagline', 'year', 'rating'])['moviedetails']
       m = [int(id), y['label'], y['year'], y['rating'], y['tagline']]
       item.selectionResponse = "%s (%s)\n\n'%s'" %(m[1], m[2], m[4])
    if mtype == 'album':
       y = json.AudioLibrary.GetAlbumDetails(albumid=id, properties=['title', 'description', 'artist', 'genre', 'year'])['albumdetails']
       m = [int(id), y['title'], y['artist'], y['year'], y['description']]
       item.selectionResponse = "%s (%s)\n\n'%s'" %(m[1], m[3], m[4])
    item.title = "%s (%s)" %(m[1], m[2])
    return item        
コード例 #2
0
ファイル: __init__.py プロジェクト: imclab/SiriServerPlugins
 def presentPossibleUsers(self, persons, language):
     root = UIAddViews(self.refId)
     root.dialogPhase = root.DialogPhaseClarificationValue
     utterance = UIAssistantUtteranceView()
     utterance.dialogIdentifier = "ContactDataResolutionDucs#disambiguateContact"
     utterance.text = responses['select'][language]
     utterance.speakableText = responses['select'][language]
     utterance.listenAfterSpeaking = True
     root.views = [utterance]
     # create a list with all the possibilities
     lst = UIDisambiguationList()
     lst.items = []
     lst.speakableSelectionResponse = "OK!"
     lst.listenAfterSpeaking = True
     lst.selectionResponse = "OK"
     root.views.append(lst)
     for person in persons:
         item = UIListItem()
         item.object = person
         item.selectionResponse = person.fullName
         item.selectionText = person.fullName
         item.title = person.fullName
         item.commands = [
             SendCommands([
                 StartRequest(
                     False, "^phoneCallContactId^=^urn:ace:{0}".format(
                         person.identifier))
             ])
         ]
         lst.items.append(item)
     return root
コード例 #3
0
 def presentPossibleUsers(self, persons, language):
     root = UIAddViews(self.refId)
     root.dialogPhase = root.DialogPhaseClarificationValue
     utterance = UIAssistantUtteranceView()
     utterance.dialogIdentifier = "ContactDataResolutionDucs#disambiguateContact"
     utterance.text = responses['select'][language]
     utterance.speakableText = responses['select'][language] 
     utterance.listenAfterSpeaking = True
     root.views = [utterance]
     # create a list with all the possibilities 
     lst = UIDisambiguationList()
     lst.items = []
     lst.speakableSelectionResponse = "OK!"
     lst.listenAfterSpeaking = True
     lst.selectionResponse = "OK"
     root.views.append(lst)
     for person in persons:
         item = UIListItem()
         item.object = person 
         item.selectionResponse = person.fullName
         item.selectionText = person.fullName
         item.title = person.fullName
         item.commands = [SendCommands([StartRequest(False, "^phoneCallContactId^=^urn:ace:{0}".format(person.identifier))])]
         lst.items.append(item)
     return root
コード例 #4
0
ファイル: __init__.py プロジェクト: castvoid/SiriServerCore
	def st_deadbody(self, speech, language):
		if language == 'en-GB':
			root = UIAddViews(self.refId)
			root.dialogPhase = root.DialogPhaseClarificationValue
			utterance = UIAssistantUtteranceView()
			utterance.text = "What kind of place were you looking for?"
			utterance.speakableText = "What kind of place were you looking for?"
			utterance.listenAfterSpeaking = True
			root.views = [utterance]
			# create a list with all the possibilities 
			lst = UIDisambiguationList()
			lst.items = []
			lst.speakableSelectionResponse = "OK!"
			lst.listenAfterSpeaking = True
			lst.selectionResponse = "OK"
			listPlaces = ['Swamps', 'Reservoirs', 'Lakes', 'Dumps', 'Mines', 'Metal Foundries']
			root.views.append(lst)
			for gPlac in listPlaces:
				item = UIListItem()
				item.selectionResponse = gPlac
				item.selectionText = gPlac
				item.title = gPlac
				item.commands = [SendCommands(commands=[StartRequest(handsFree=False, utterance=gPlac)])]
				lst.items.append(item)
			self.sendRequestWithoutAnswer(root)
		self.complete_request()
コード例 #5
0
ファイル: __init__.py プロジェクト: iron85/SiriServerCore
 def googleplaces_body(self, speech, language, regex):
     root = UIAddViews(self.refId)
     root.dialogPhase = root.DialogPhaseClarificationValue
     utterance = UIAssistantUtteranceView()
     utterance.text = responses['select'][language]
     utterance.speakableText = responses['select'][language] 
     utterance.listenAfterSpeaking = True
     root.views = [utterance]
     # create a list with all the possibilities 
     lst = UIDisambiguationList()
     lst.items = []
     lst.speakableSelectionResponse = "OK!"
     lst.listenAfterSpeaking = True
     lst.selectionResponse = "OK"
     listPlaces = ['Swamps', 'Reservoirs', 'Lakes', 'Dumps', 'Mines', 'Churches']
     root.views.append(lst)
     for gPlac in listPlaces:
         item = UIListItem()
         item.selectionResponse = gPlac
         item.selectionText = gPlac
         item.title = gPlac
         item.commands = [SendCommands(commands=[StartRequest(handsFree=False, utterance=gPlac)])]
         lst.items.append(item)
     answer = self.getResponseForRequest(root)
     print answer
     if answer == listPlaces[0]:
         Title = listPlaces[0]
     if answer == listPlaces[1]:
         Title = listPlaces[1]            
     if answer == listPlaces[2]:
         Title = listPlaces[2]
     if answer == listPlaces[3]:
         Title = listPlaces[3]
     if answer == listPlaces[4]:
         Title = listPlaces[4]
     self.GooglePlaceSearch(speech, language, Title)