當前位置: 首頁>>代碼示例>>Python>>正文


Python UIAddViews.callbacks方法代碼示例

本文整理匯總了Python中siriObjects.uiObjects.UIAddViews.callbacks方法的典型用法代碼示例。如果您正苦於以下問題:Python UIAddViews.callbacks方法的具體用法?Python UIAddViews.callbacks怎麽用?Python UIAddViews.callbacks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在siriObjects.uiObjects.UIAddViews的用法示例。


在下文中一共展示了UIAddViews.callbacks方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: play

# 需要導入模塊: from siriObjects.uiObjects import UIAddViews [as 別名]
# 或者: from siriObjects.uiObjects.UIAddViews import callbacks [as 別名]
 def play(self, results, language):
     collection = MPTitleCollection()
     collection.items = []
     for result in results:
         if not hasattr(result, "genre"):
             result.genre = ""
         if not hasattr(result, "trackNumber"):
             result.trackNumber = ""
         if not hasattr(result, "artist"):
             result.artist = ""
         if not hasattr(result, "title"):
             result.title = ""
         if not hasattr(result, "sortTitle"):
             result.sortTitle = ""
         if not hasattr(result, "playCount"):
             result.playCount = ""
         if not hasattr(result, "rating"):
             result.rating = ""
         if not hasattr(result, "album"):
             result.album = ""
         if not hasattr(result, "identifier"):
             result.identifier = ""
         song = MPSong()
         song.album = result.album
         song.artist = result.artist
         song.genre = result.genre
         song.playCount = result.playCount
         song.rating = result.rating
         song.sortTitle = result.sortTitle
         song.title = result.title
         song.trackNumber = result.trackNumber
         song.identifier = result.identifier
         collection.items.append(song)
         collection.sortTitle = result.title
         collection.title = result.sortTitle
     collection.identifier = result.identifier
     complete = MPSetQueue(self.refId)
     complete.mediaItems = collection
     self.getResponseForRequest(complete)
     commands = MPSetState(self.refId)
     commands.state = "Playing"
     commands2 = MPEnableShuffle(self.refId)
     commands2.enable = False
     code = 0
     root = UIAddViews(self.refId)
     root.dialogPhase = "Summary"
     assistant = UIAssistantUtteranceView()
     assistant.dialogIdentifier = "PlayMedia#nowPlayingMediaItemByTitle"
     assistant.speakableText = assistant.text = res["play"][language]
     root.views = [(assistant)]
     root.callbacks = [ResultCallback([commands, commands2], code)]
     callback = [ResultCallback([root], code)]
     self.send_object(RequestCompleted(self.refId, callback))
     self.complete_request()
開發者ID:sm0ker,項目名稱:SiriServerCore,代碼行數:56,代碼來源:__init__.py

示例2: pause

# 需要導入模塊: from siriObjects.uiObjects import UIAddViews [as 別名]
# 或者: from siriObjects.uiObjects.UIAddViews import callbacks [as 別名]
 def pause(self, language):
     commands = MPSetState(self.refId)
     commands.state = "Paused"
     code = 0
     root = UIAddViews(self.refId)
     root.dialogPhase = "Summary"
     assistant = UIAssistantUtteranceView()
     assistant.dialogIdentifier = "PlayMedia#Paused"
     assistant.speakableText = assistant.text = res["pause"][language]
     root.views = [(assistant)]
     root.callbacks = [ResultCallback([commands], code)]
     callback = [ResultCallback([root], code)]
     self.send_object(RequestCompleted(self.refId, callback))
     self.complete_request()
開發者ID:sm0ker,項目名稱:SiriServerCore,代碼行數:16,代碼來源:__init__.py

示例3: beginning

# 需要導入模塊: from siriObjects.uiObjects import UIAddViews [as 別名]
# 或者: from siriObjects.uiObjects.UIAddViews import callbacks [as 別名]
 def beginning(self, language):
     commands = MPSetState(self.refId)
     commands.state = "Playing"
     commands2 = MPSetPlaybackPosition(self.refId)
     commands2.position = "Beginning"
     code = 0
     root = UIAddViews(self.refId)
     root.dialogPhase = "Summary"
     assistant = UIAssistantUtteranceView()
     assistant.dialogIdentifier = "PlayMedia#SkipToBeginning"
     assistant.speakableText = assistant.text = res["beginning"][language]
     root.views = [(assistant)]
     root.callbacks = [ResultCallback([commands, commands2], code)]
     callback = [ResultCallback([root], code)]
     self.send_object(RequestCompleted(self.refId, callback))
     self.complete_request()
開發者ID:sm0ker,項目名稱:SiriServerCore,代碼行數:18,代碼來源:__init__.py


注:本文中的siriObjects.uiObjects.UIAddViews.callbacks方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。