本文整理汇总了Python中common.XBMCInterfaceUtils.isPlaying方法的典型用法代码示例。如果您正苦于以下问题:Python XBMCInterfaceUtils.isPlaying方法的具体用法?Python XBMCInterfaceUtils.isPlaying怎么用?Python XBMCInterfaceUtils.isPlaying使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.XBMCInterfaceUtils
的用法示例。
在下文中一共展示了XBMCInterfaceUtils.isPlaying方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: playRawAudio
# 需要导入模块: from common import XBMCInterfaceUtils [as 别名]
# 或者: from common.XBMCInterfaceUtils import isPlaying [as 别名]
def playRawAudio(request_obj, response_obj):
pbType = int(Container().getAddonContext().addon.getSetting('playbacktype'))
Container().ga_client.reportAction('audio')
if XBMCInterfaceUtils.isPlayingVideo():
response_obj.addServiceResponseParam("status", "error")
response_obj.addServiceResponseParam("title", "Stop active video!")
response_obj.addServiceResponseParam("message", "Note: XBMC cannot play audio when video playback is in progress.")
item = ListItem()
item.set_next_action_name('respond')
response_obj.addListItem(item)
elif pbType == 2 and XBMCInterfaceUtils.isPlaying():
response_obj.addServiceResponseParam("status", "error")
response_obj.addServiceResponseParam("title", "XBMC is already playing.")
response_obj.addServiceResponseParam("message", "Check PlayIt Service add-on settings. Your this request is ignored.")
item = ListItem()
item.set_next_action_name('respond')
response_obj.addListItem(item)
else:
if pbType == 0:
XBMCInterfaceUtils.stopPlayer()
if not XBMCInterfaceUtils.isPlaying():
XBMCInterfaceUtils.clearPlayList(list_type="audio")
response_obj.addServiceResponseParam("message", "Enjoy your music!")
else:
response_obj.addServiceResponseParam("title", "Request Enqueued!")
response_obj.addServiceResponseParam("message", "Your request has been added to player queue.")
item = ListItem()
item.get_moving_data()['audioStreamUrl'] = request_obj.get_data()['track_link']
item.set_next_action_name('Play')
xbmcListItem = xbmcgui.ListItem(label=request_obj.get_data()['track_title'], iconImage=request_obj.get_data()['track_artwork_url'], thumbnailImage=request_obj.get_data()['track_artwork_url'])
xbmcListItem.setInfo('music', {'title':request_obj.get_data()['track_title']})
item.set_xbmc_list_item_obj(xbmcListItem)
response_obj.addListItem(item)
response_obj.addServiceResponseParam("status", "success")
示例2: judgeTurtleNextAction
# 需要导入模块: from common import XBMCInterfaceUtils [as 别名]
# 或者: from common.XBMCInterfaceUtils import isPlaying [as 别名]
def judgeTurtleNextAction(self, actionObj):
ProgressDisplayer().displayMessage(80, line1='Preparing items for display or play', line2='Total items: ' + str(len(self.response_obj.get_item_list())))
if self.response_obj.get_redirect_action_name() is None:
isAnyPlayableItem = False
isItemsList = False
playlist_type = None
for item in self.response_obj.get_item_list():
nextActionId = actionObj.get_next_action_map()[item.get_next_action_name()]
if nextActionId == '__play__':
if item.get_moving_data().has_key('pluginUrl'):
XBMCInterfaceUtils.executePlugin(item.get_moving_data()['pluginUrl'])
else:
if not isAnyPlayableItem and not XBMCInterfaceUtils.isPlaying():
XBMCInterfaceUtils.clearPlayList() # Clear playlist item only when at least one video item is found.
playlist_type = XBMCInterfaceUtils.addPlayListItem(item)
isAnyPlayableItem = True
elif nextActionId == '__service_response__':
# Do Nothing , get response object from container for parameters to be returned
pass
elif nextActionId == '__download__':
downloadPath = self.addon_context.addon.getSetting('downloadPath')
if downloadPath is None or downloadPath == '':
XBMCInterfaceUtils.displayDialogMessage("Download path not provided", "Please provide download path in add-on settings.", "The download path should be a local directory.")
self.addon_context.addon.openSettings(sys.argv[ 0 ])
downloadPath = self.addon_context.addon.getSetting('downloadPath')
if downloadPath is not None and downloadPath != '':
XBMCInterfaceUtils.downloadVideo(item, downloadPath)
elif nextActionId == '__resolved__':
XBMCInterfaceUtils.setResolvedMediaUrl(item)
else:
isItemsList = True
is_Folder = self.addon_context.isNextActionFolder(actionObj.get_action_id(), item.get_next_action_name())
downloadAction = self.addon_context.getDownloadActionIfDownloadable(actionObj.get_action_id(), item.get_next_action_name())
if(downloadAction is not None):
XBMCInterfaceUtils.addContextMenuItem(item, 'Download Video', downloadAction)
XBMCInterfaceUtils.addFolderItem(item, nextActionId, is_Folder)
del item # deletes item
if isAnyPlayableItem == True:
ProgressDisplayer().end()
try:
if playlist_type is not None:
XBMCInterfaceUtils.play(list_type=playlist_type)
else:
XBMCInterfaceUtils.play()
except Exception, e:
Logger.logFatal(e)
elif isItemsList:
if self.response_obj.get_xbmc_sort_method() is not None:
XBMCInterfaceUtils.sortMethod(self.response_obj.get_xbmc_sort_method())
if self.response_obj.get_xbmc_content_type() is not None:
XBMCInterfaceUtils.setContentType(self.response_obj.get_xbmc_content_type())
XBMCInterfaceUtils.setSortMethods()
示例3: playHostedVideo
# 需要导入模块: from common import XBMCInterfaceUtils [as 别名]
# 或者: from common.XBMCInterfaceUtils import isPlaying [as 别名]
def playHostedVideo(request_obj, response_obj):
pbType = int(Container().getAddonContext().addon.getSetting('playbacktype'))
Container().getAddonContext().addon.setSetting('ga_video_title', 'false')
if pbType == 2 and XBMCInterfaceUtils.isPlaying():
response_obj.addServiceResponseParam("status", "error")
response_obj.addServiceResponseParam("title", "XBMC is already playing.")
response_obj.addServiceResponseParam("message", "Check PlayIt Service add-on settings. Your this request is ignored.")
item = ListItem()
item.set_next_action_name('respond')
response_obj.addListItem(item)
else:
if pbType == 0:
XBMCInterfaceUtils.stopPlayer()
video_url = request_obj.get_data()['videoLink']
if video_url.startswith('http://goo.gl/'):
Logger.logDebug('Found google short URL = ' + video_url)
video_url = HttpUtils.getRedirectedUrl(video_url)
Logger.logDebug('After finding out redirected URL = ' + video_url)
request_obj.get_data()['videoLink'] = video_url
if __is_valid_url(video_url):
contentType = __check_media_url(video_url)
if contentType is not None:
if contentType == 'audio':
response_obj.set_redirect_action_name('play_direct_audio')
request_obj.get_data()['track_title'] = ''
request_obj.get_data()['track_link'] = video_url
request_obj.get_data()['track_artwork_url'] = ''
else:
response_obj.set_redirect_action_name('play_direct_video')
else:
if XBMCInterfaceUtils.isPlayingAudio():
response_obj.addServiceResponseParam("status", "error")
response_obj.addServiceResponseParam("title", "Stop active music!")
response_obj.addServiceResponseParam("message", "Note: XBMC cannot play video when audio playback is in progress.")
item = ListItem()
item.set_next_action_name('respond')
response_obj.addListItem(item)
else:
video_hosting_info = SnapVideo.findVideoHostingInfo(video_url)
if video_hosting_info is None:
response_obj.addServiceResponseParam("status", "error")
response_obj.addServiceResponseParam("title", "URL not supported")
response_obj.addServiceResponseParam("message", "Video URL is currently not supported by PlayIt. Please check if URL selected is correct.")
item = ListItem()
item.set_next_action_name('respond')
response_obj.addListItem(item)
else:
Container().ga_client.reportContentUsage('hostedvideo', video_hosting_info.get_video_hosting_name())
response_obj.addServiceResponseParam("status", "success")
if not XBMCInterfaceUtils.isPlaying():
XBMCInterfaceUtils.clearPlayList(list_type="video")
response_obj.addServiceResponseParam("message", "Enjoy your video!")
else:
response_obj.addServiceResponseParam("title", "Request Enqueued!")
response_obj.addServiceResponseParam("message", "Your request has been added to player queue.")
response_obj.set_redirect_action_name('play_it')
request_obj.get_data()['videoTitle'] = 'PlayIt Video'
else:
Logger.logError('video_url = ' + str(video_url))
response_obj.addServiceResponseParam("status", "error")
response_obj.addServiceResponseParam("title", "Invalid URL")
response_obj.addServiceResponseParam("message", "Video URL is not valid one! Please check and try again.")
item = ListItem()
item.set_next_action_name('respond')
response_obj.addListItem(item)