本文整理汇总了Python中resources.lib.settings.Settings.isYouTubeSearchSupportEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.isYouTubeSearchSupportEnabled方法的具体用法?Python Settings.isYouTubeSearchSupportEnabled怎么用?Python Settings.isYouTubeSearchSupportEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类resources.lib.settings.Settings
的用法示例。
在下文中一共展示了Settings.isYouTubeSearchSupportEnabled方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onInit
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import isYouTubeSearchSupportEnabled [as 别名]
def onInit(self):
# Need to clear the list of the default items
self.clearList()
# Start by adding an option to Play All
if len(self.files) > 0:
anItem = xbmcgui.ListItem(ADDON.getLocalizedString(32101), path=SourceDetails.getFilenameAndPath())
# Get the first items fanart for the play all option
anItem.setProperty("Fanart_Image", self.files[0].getFanArt())
if SourceDetails.getTvShowTitle() != "":
anItem.setInfo('video', {'TvShowTitle': SourceDetails.getTvShowTitle()})
if SourceDetails.getTitle() != "":
anItem.setInfo('video', {'Title': SourceDetails.getTitle()})
self.addItem(anItem)
# Check if we want to have YouTube Extra Support
if Settings.isYouTubeSearchSupportEnabled():
# Create the message to the YouTube Plugin
li = xbmcgui.ListItem(ADDON.getLocalizedString(32116))
# Need to set the title to get it in the header
if SourceDetails.getTvShowTitle() != "":
li.setInfo('video', {'TvShowTitle': SourceDetails.getTvShowTitle()})
if SourceDetails.getTitle() != "":
li.setInfo('video', {'Title': SourceDetails.getTitle()})
li.setProperty("Fanart_Image", SourceDetails.getFanArt())
li.setProperty("search", "/search/?q=%s+Extras" % urllib.quote_plus(SourceDetails.getTitle().encode('utf8')))
self.addItem(li)
# Check if we want to have Vimeo Extra Support
if Settings.isVimeoSearchSupportEnabled():
# Create the message to the Vimeo Plugin
li = xbmcgui.ListItem(ADDON.getLocalizedString(32122))
# Need to set the title to get it in the header
if SourceDetails.getTvShowTitle() != "":
li.setInfo('video', {'TvShowTitle': SourceDetails.getTvShowTitle()})
if SourceDetails.getTitle() != "":
li.setInfo('video', {'Title': SourceDetails.getTitle()})
li.setProperty("Fanart_Image", SourceDetails.getFanArt())
li.setProperty("search", "/search/?q=%s+Extras" % urllib.quote_plus(SourceDetails.getTitle().encode('utf8')))
self.addItem(li)
for anExtra in self.files:
log("VideoExtrasWindow: filename: %s" % anExtra.getFilename())
# Create the list item
anItem = anExtra.createListItem(path=SourceDetails.getFilenameAndPath(), parentTitle=SourceDetails.getTitle(), tvShowTitle=SourceDetails.getTvShowTitle())
self.addItem(anItem)
# Before we return, set back the selected on screen item to the one just watched
# This is in the case of a reload
if self.lastRecordedListPosition > 0:
self.setCurrentListPosition(self.lastRecordedListPosition)
xbmcgui.WindowXML.onInit(self)
示例2: onClick
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import isYouTubeSearchSupportEnabled [as 别名]
def onClick(self, control):
WINDOW_LIST_ID = 51
# Check to make sure that this click was for the extras list
if control != WINDOW_LIST_ID:
return
# Check the YouTube Search first, as if there are no Extras on disk
# There will not be a PlayAll button and it will just be the YouTube Link
youtubePosition = 0
vimeoPosition = 0
if len(self.files) > 0:
youtubePosition = youtubePosition + 1
vimeoPosition = vimeoPosition + 1
if Settings.isYouTubeSearchSupportEnabled():
vimeoPosition = vimeoPosition + 1
if self.getCurrentListPosition() == youtubePosition:
anItem = self.getListItem(youtubePosition)
searchDetails = anItem.getProperty("search")
log("VideoExtras: Running YouTube Addon/Plugin with search %s" % searchDetails)
xbmc.executebuiltin("RunAddon(plugin.video.youtube,%s)" % searchDetails)
return
if Settings.isVimeoSearchSupportEnabled() and self.getCurrentListPosition() == vimeoPosition:
anItem = self.getListItem(vimeoPosition)
searchDetails = anItem.getProperty("search")
log("VideoExtras: Running Vimeo Addon/Plugin with search %s" % searchDetails)
xbmc.executebuiltin("RunAddon(plugin.video.vimeo,%s)" % searchDetails)
return
# Check for the Play All case
if self.getCurrentListPosition() == 0:
ExtrasPlayer.playAll(self.files, SourceDetails.getTitle())
return
# Get the item that was clicked on
extraItem = self._getCurrentSelection()
if extraItem is None:
# Something has gone very wrong, there is no longer the item that was selected
log("VideoExtrasWindow: Unable to match item to current selection")
return
# If part way viewed prompt the user for resume or play from beginning
if extraItem.getResumePoint() > 0:
resumeWindow = VideoExtrasResumeWindow.createVideoExtrasResumeWindow(extraItem.getDisplayResumePoint())
resumeWindow.doModal()
# Check the return value, if exit, then we play nothing
if resumeWindow.isExit():
return
# If requested to restart from beginning, reset the resume point before playing
if resumeWindow.isRestart():
extraItem.setResumePoint(0)
# Default is to actually resume
del resumeWindow
ExtrasPlayer.performPlayAction(extraItem, SourceDetails.getTitle())
示例3: setVideoList
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import isYouTubeSearchSupportEnabled [as 别名]
def setVideoList(self, jsonGet, target, dbid):
videoItems = self.getVideos(jsonGet, target, dbid)
for videoItem in videoItems:
# Create the list-item for this video
li = xbmcgui.ListItem(videoItem['title'], iconImage=videoItem['thumbnail'])
if not self.hasVideoExtras(target, videoItem['dbid'], videoItem['file'], videoItem['title']):
# Check if we are supporting YouTube Searches, if so it doesn't matter
# If we do not have any Extras yet
if not Settings.isYouTubeSearchSupportEnabled():
continue
else:
# There are extras, if so then we should check to see if we are actually
# showing all the Videos, as if we are and YouTube is being used, we
# should flag the ones with physical extras
if Settings.isYouTubeSearchSupportEnabled():
li.setInfo('video', {'PlayCount': 1})
# Remove the default context menu
li.addContextMenuItems([], replaceItems=True)
# Get the title of the video owning the extras
parentTitle = ""
try:
parentTitle = videoItem['title'].encode("utf-8")
except:
log("setVideoList: failed to encode parent title %s" % parentTitle)
# Set the background image
if videoItem['fanart'] is not None:
li.setProperty("Fanart_Image", videoItem['fanart'])
else:
videoItem['fanart'] = ""
url = self._build_url({'mode': 'listextras', 'foldername': target, 'path': videoItem['file'].encode("utf-8"), 'parentTitle': parentTitle, 'defaultFanArt': videoItem['fanart'], 'defaultIconImage': videoItem['thumbnail']})
xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True)
xbmcplugin.endOfDirectory(self.addon_handle)
示例4: checkYouTubeSettings
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import isYouTubeSearchSupportEnabled [as 别名]
def checkYouTubeSettings():
# Check to see if the YouTube support is enabled
if Settings.isYouTubeSearchSupportEnabled():
# It is enabled in settings, but we should check to ensure that the
# YouTube addon is actually installed
youtubeInstalled = False
try:
youtubeAddon = xbmcaddon.Addon(id='plugin.video.youtube')
if youtubeAddon not in [None, ""]:
youtubeInstalled = True
except:
# We will get an exception if we can not find the YouTube addon
youtubeInstalled = False
if not youtubeInstalled:
# There is no YouTube addon installed, so disable this option in settings
log("VideoExtrasService: Disabling YouTube support as addon not installed")
Settings.disableYouTubeSearchSupport()
示例5: checkButtonEnabled
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import isYouTubeSearchSupportEnabled [as 别名]
def checkButtonEnabled(self):
# See if the option to force the extras button is enabled,
# if which case just make sure the hide option is cleared
# Also if we are using YouTube, we want to always display the button
if Settings.isForceButtonDisplay() or Settings.isYouTubeSearchSupportEnabled() or Settings.isVimeoSearchSupportEnabled():
xbmcgui.Window(12003).clearProperty("HideVideoExtrasButton")
log("VideoExtras: Force VideoExtras Button Enabled")
else:
# Search for the extras, stopping when the first is found
# only want to find out if the button should be available
# No need for DB or default fanart, as just checking for existence
files = self.findExtras(True)
if files:
# Set a flag on the window so we know there is data
xbmcgui.Window(12003).clearProperty("HideVideoExtrasButton")
log("VideoExtras: Button Enabled")
else:
# Hide the extras button, there are no extras
xbmcgui.Window(12003).setProperty("HideVideoExtrasButton", "true")
log("VideoExtras: Button disabled")
示例6: onAction
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import isYouTubeSearchSupportEnabled [as 别名]
def onAction(self, action):
# actioncodes from https://github.com/xbmc/xbmc/blob/master/xbmc/guilib/Key.h
ACTION_PREVIOUS_MENU = 10
ACTION_NAV_BACK = 92
ACTION_CONTEXT_MENU = 117
if (action == ACTION_PREVIOUS_MENU) or (action == ACTION_NAV_BACK):
log("VideoExtrasWindow: Close Action received: %s" % str(action.getId()))
self.close()
elif action == ACTION_CONTEXT_MENU:
youtubePosition = 0
vimeoPosition = 0
if len(self.files) > 0:
youtubePosition = youtubePosition + 1
vimeoPosition = vimeoPosition + 1
if Settings.isYouTubeSearchSupportEnabled():
vimeoPosition = vimeoPosition + 1
# Check to see if the context menu has been called up for the You Tube option
if self.getCurrentListPosition() == youtubePosition:
contextWindow = VideoPluginContextMenu.createYouTubeContextMenu(SourceDetails.getTitle())
contextWindow.doModal()
del contextWindow
return
if Settings.isVimeoSearchSupportEnabled() and self.getCurrentListPosition() == vimeoPosition:
contextWindow = VideoPluginContextMenu.createVimeoContextMenu(SourceDetails.getTitle())
contextWindow.doModal()
del contextWindow
return
# Check for the Play All case
if self.getCurrentListPosition() == 0:
return
# Get the item that was clicked on
extraItem = self._getCurrentSelection()
# create the context window
contextWindow = VideoExtrasContextMenu.createVideoExtrasContextMenu(extraItem)
contextWindow.doModal()
# Check the return value, if exit, then we play nothing
if contextWindow.isExit():
return
# If requested to restart from beginning, reset the resume point before playing
if contextWindow.isRestart():
extraItem.setResumePoint(0)
ExtrasPlayer.performPlayAction(extraItem, SourceDetails.getTitle())
if contextWindow.isResume():
ExtrasPlayer.performPlayAction(extraItem, SourceDetails.getTitle())
if contextWindow.isMarkUnwatched():
# Need to remove the row from the database
if Settings.isDatabaseEnabled():
# Refresh the screen now that we have change the flag
extraItem.setResumePoint(0)
extraItem.saveState()
self.onInit()
if contextWindow.isMarkWatched():
# If marking as watched we need to set the resume time so it doesn't
# start in the middle the next time it starts
if Settings.isDatabaseEnabled():
extraItem.setResumePoint(extraItem.getTotalDuration())
extraItem.saveState()
self.onInit()
if contextWindow.isEditTitle():
# Prompt the user for the new name
keyboard = xbmc.Keyboard()
keyboard.setDefault(extraItem.getDisplayName())
keyboard.doModal()
if keyboard.isConfirmed():
try:
newtitle = keyboard.getText().decode("utf-8")
except:
newtitle = keyboard.getText()
# Only set the title if it has changed
if (newtitle != extraItem.getDisplayName()) and (len(newtitle) > 0):
result = extraItem.setTitle(newtitle, isTV=SourceDetails.isTv())
if not result:
xbmcgui.Dialog().ok(ADDON.getLocalizedString(32102), ADDON.getLocalizedString(32109))
else:
self.onInit()
if contextWindow.isEditPlot():
# Prompt the user for the new plot description
keyboard = xbmc.Keyboard()
keyboard.setDefault(extraItem.getPlot())
keyboard.doModal()
if keyboard.isConfirmed():
try:
newplot = keyboard.getText().decode("utf-8")
except:
newplot = keyboard.getText()
#.........这里部分代码省略.........
示例7: run
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import isYouTubeSearchSupportEnabled [as 别名]
def run(self, files):
# All the files have been retrieved, now need to display them
if not files and not Settings.isYouTubeSearchSupportEnabled() and not Settings.isVimeoSearchSupportEnabled():
# "Info", "No extras found"
xbmcgui.Dialog().ok(ADDON.getLocalizedString(32102), ADDON.getLocalizedString(32103))
else:
isTvTunesAlreadySet = True
needsWindowReset = True
# Make sure we don't leave global variables set
try:
# Check which listing format to use
if Settings.isDetailedListScreen():
# Check if TV Tunes override is already set
isTvTunesAlreadySet = (xbmcgui.Window(12000).getProperty("TvTunesContinuePlaying").lower() == "true")
# If TV Tunes is running we want to ensure that we still keep the theme going
# so set this variable on the home screen
if not isTvTunesAlreadySet:
log("VideoExtras: Setting TV Tunes override")
xbmcgui.Window(12000).setProperty("TvTunesContinuePlaying", "True")
else:
log("VideoExtras: TV Tunes override already set")
extrasWindow = VideoExtrasWindow.createVideoExtrasWindow(files=files)
xbmc.executebuiltin("Dialog.Close(movieinformation)", True)
extrasWindow.doModal()
del extrasWindow
else:
extrasWindow = VideoExtrasDialog()
needsWindowReset = extrasWindow.showList(files)
del extrasWindow
# The video selection will be the default return location
if (not Settings.isMenuReturnVideoSelection()) and needsWindowReset:
if Settings.isMenuReturnHome():
xbmc.executebuiltin("ActivateWindow(home)", True)
else:
infoDialogId = 12003
# Put the information dialog back up
xbmc.executebuiltin("ActivateWindow(movieinformation)")
if Settings.isMenuReturnExtras():
# Wait for the Info window to open, it can take a while
# this is to avoid the case where the exList dialog displays
# behind the info dialog
counter = 0
while (xbmcgui.getCurrentWindowDialogId() != infoDialogId) and (counter < 30):
xbmc.sleep(100)
counter = counter + 1
# Allow time for the screen to load - this could result in an
# action such as starting TvTunes
xbmc.sleep(1000)
# Before showing the list, check if someone has quickly
# closed the info screen while it was opening and we were waiting
if xbmcgui.getCurrentWindowDialogId() == infoDialogId:
# Reshow the exList that was previously generated
self.run(files)
except:
log("VideoExtras: %s" % traceback.format_exc(), xbmc.LOGERROR)
# Tidy up the TV Tunes flag if we set it
if not isTvTunesAlreadySet:
log("VideoExtras: Clearing TV Tunes override")
xbmcgui.Window(12000).clearProperty("TvTunesContinuePlaying")
示例8: showList
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import isYouTubeSearchSupportEnabled [as 别名]
def showList(self, exList):
# Get the list of display names
displayNameList = []
for anExtra in exList:
log("VideoExtrasDialog: filename: %s" % anExtra.getFilename())
displayNameList.append(anExtra.getDisplayName())
# Check if we are supporting YouTube Search
vimeoPosition = -4
if Settings.isVimeoSearchSupportEnabled():
vimeoPosition = 0
displayNameList.insert(0, ADDON.getLocalizedString(32122))
# Check if we are supporting YouTube Search
youtubePosition = -3
if Settings.isYouTubeSearchSupportEnabled():
youtubePosition = 0
vimeoPosition = vimeoPosition + 1
displayNameList.insert(0, ADDON.getLocalizedString(32116))
addPlayAll = (len(exList) > 1)
if addPlayAll:
youtubePosition = youtubePosition + 1
vimeoPosition = vimeoPosition + 1
# Play All Selection Option
displayNameList.insert(0, ADDON.getLocalizedString(32101))
# Show the list to the user
select = xbmcgui.Dialog().select(ADDON.getLocalizedString(32001), displayNameList)
# User has made a selection, -1 is exit
if select != -1:
xbmc.executebuiltin("Dialog.Close(all, true)", True)
waitLoop = 0
while xbmc.Player().isPlaying() and waitLoop < 10:
xbmc.sleep(100)
waitLoop = waitLoop + 1
xbmc.Player().stop()
# Give anything that was already playing time to stop
while xbmc.Player().isPlaying():
xbmc.sleep(100)
if (select == 0) and (addPlayAll is True):
ExtrasPlayer.playAll(exList, SourceDetails.getTitle())
elif select == youtubePosition:
searchDetails = "/search/?q=%s+Extras" % urllib.quote_plus(SourceDetails.getTitle().encode('utf8'))
log("VideoExtras: Running YouTube Addon/Plugin with search %s" % searchDetails)
xbmc.executebuiltin("RunAddon(plugin.video.youtube,%s)" % searchDetails)
elif select == vimeoPosition:
searchDetails = "/search/?q=%s+Extras" % urllib.quote_plus(SourceDetails.getTitle().encode('utf8'))
log("VideoExtras: Running Vimeo Addon/Plugin with search %s" % searchDetails)
xbmc.executebuiltin("RunAddon(plugin.video.vimeo,%s)" % searchDetails)
else:
itemToPlay = select
# If we added the PlayAll option to the list need to allow for it
# in the selection, so add one
if addPlayAll is True:
itemToPlay = itemToPlay - 1
if vimeoPosition >= 0:
itemToPlay = itemToPlay - 1
if youtubePosition >= 0:
itemToPlay = itemToPlay - 1
log("VideoExtrasDialog: Start playing %s" % exList[itemToPlay].getFilename())
ExtrasPlayer.performPlayAction(exList[itemToPlay], SourceDetails.getTitle())
else:
return False
return True
示例9: showExtras
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import isYouTubeSearchSupportEnabled [as 别名]
def showExtras(self, path, target, extrasParentTitle="", extrasDefaultFanArt="", extrasDefaultIconImage=""):
# Check if the use database setting is enabled
extrasDb = None
if Settings.isDatabaseEnabled():
extrasDb = ExtrasDB()
# Create the extras class that will be used to process the extras
videoExtras = VideoExtrasBase(path, target, extrasParentTitle)
# Perform the search command
files = videoExtras.findExtras(extrasDb=extrasDb, defaultFanArt=extrasDefaultFanArt)
del videoExtras
tvShowTitle = ""
if target == MenuNavigator.TVSHOWS:
tvShowTitle = extrasParentTitle
if len(files) > 0:
# Start by adding an option to Play All
anItem = xbmcgui.ListItem(ADDON.getLocalizedString(32101), path=path)
# Get the first items fanart for the play all option
anItem.setProperty("Fanart_Image", files[0].getFanArt())
if tvShowTitle != "":
anItem.setInfo('video', {'TvShowTitle': tvShowTitle})
if extrasParentTitle != "":
anItem.setInfo('video', {'Title': extrasParentTitle})
if extrasDefaultIconImage != "":
anItem.setIconImage(extrasDefaultIconImage)
anItem.addContextMenuItems([], replaceItems=True)
url = self._build_url({'mode': 'playallextras', 'foldername': target, 'path': path, 'parentTitle': extrasParentTitle})
xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=anItem, isFolder=False)
# Check if we want to have YouTube Extra Support
if Settings.isYouTubeSearchSupportEnabled():
self._getVideoPluginLink(extrasParentTitle, 'plugin.video.youtube', 32116, extrasDefaultIconImage, extrasDefaultFanArt)
# Check if we want to have Vimeo Extra Support
if Settings.isVimeoSearchSupportEnabled():
self._getVideoPluginLink(extrasParentTitle, 'plugin.video.vimeo', 32122, extrasDefaultIconImage, extrasDefaultFanArt)
# Add each of the extras to the list to display
for anExtra in files:
# Create the list item
li = anExtra.createListItem(parentTitle=extrasParentTitle, tvShowTitle=tvShowTitle, defaultIconImage=extrasDefaultIconImage)
# Hack, if the "TotalTime" and "ResumeTime" are set on the list item
# and it is partially watched, then Kodi will display the continue dialog
# However we can not get what the user selects from this dialog, so it
# will always continue. Found out that we can hack this by clearing
# the "TotalTime" property
# http://forum.xbmc.org/showthread.php?tid=192627
li.setProperty("TotalTime", "")
li.addContextMenuItems([], replaceItems=True)
li.addContextMenuItems(self._getContextMenu(anExtra, target, path, extrasParentTitle), replaceItems=True)
url = self._build_url({'mode': 'playextra', 'foldername': target, 'path': path, 'filename': anExtra.getFilename().encode("utf-8"), 'parentTitle': extrasParentTitle})
xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=False)
xbmcplugin.endOfDirectory(self.addon_handle)