本文整理汇总了Python中settings.Settings.isThemeDirEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.isThemeDirEnabled方法的具体用法?Python Settings.isThemeDirEnabled怎么用?Python Settings.isThemeDirEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类settings.Settings
的用法示例。
在下文中一共展示了Settings.isThemeDirEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _generateThemeFilelist
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import isThemeDirEnabled [as 别名]
def _generateThemeFilelist(self, rawPath):
# Get the full path with any network alterations
workingPath = self._getUsablePath(rawPath)
themeList = self._getThemeFiles(workingPath)
# If no themes have been found
if len(themeList) < 1:
# TV shows stored as ripped disc folders
if ('VIDEO_TS' in workingPath) or ('BDMV' in workingPath):
log("ThemeFiles: Found VIDEO_TS or BDMV in path: Correcting the path for DVDR tv shows", self.debug_logging_enabled)
workingPath = os_path_split(workingPath)[0]
themeList = self._getThemeFiles(workingPath)
if len(themeList) < 1:
workingPath = os_path_split(workingPath)[0]
themeList = self._getThemeFiles(workingPath)
else:
# If no theme files were found in this path, look at the parent directory
workingPath = os_path_split(workingPath)[0]
# Check for the case where there is the theme forlder settings, we want to
# check the parent folders themes directory
if Settings.isThemeDirEnabled():
themeDir = os_path_join(workingPath, Settings.getThemeDirectory())
themeList = self._getThemeFiles(themeDir)
# If there are still no themes, just check the parent directory
if len(themeList) < 1:
themeList = self._getThemeFiles(workingPath)
log("ThemeFiles: Playlist size = %d" % len(themeList), self.debug_logging_enabled)
log("ThemeFiles: Working Path = %s" % workingPath, self.debug_logging_enabled)
return themeList
示例2: fetchTheme
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import isThemeDirEnabled [as 别名]
def fetchTheme(self, title, path, originaltitle=None, isTvShow=None, year=None, imdb=None):
# If there is already a theme then start playing it
self._startPlayingExistingTheme(path)
if Settings.isThemeDirEnabled() and self._doesThemeExist(path, True):
# Prompt user if we should move themes in the parent
# directory into the theme directory
moveExistingThemes = xbmcgui.Dialog().yesno(__addon__.getLocalizedString(32105), __addon__.getLocalizedString(32206), __addon__.getLocalizedString(32207))
# Check if we need to move a theme file
if moveExistingThemes:
log("fetchAllMissingThemes: Moving theme for %s" % title)
self._moveToThemeFolder(path)
# Stop playing any theme that started
self._stopPlayingTheme()
# Now reload the screen to reflect the change
xbmc.executebuiltin("Container.Refresh")
return
if originaltitle is not None:
originaltitle = normalize_string(originaltitle)
# Perform the fetch
videoList = []
normtitle = normalize_string(title)
videoItem = {'title': normtitle, 'path': path, 'originalTitle': originaltitle, 'isTvShow': isTvShow, 'year': year, 'imdb': imdb}
videoList.append(videoItem)
TvTunesFetcher(videoList)
# Stop playing any theme that started
self._stopPlayingTheme()
# Now reload the screen to reflect the change
xbmc.executebuiltin("Container.Refresh")
示例3: _doesThemeExist
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import isThemeDirEnabled [as 别名]
def _doesThemeExist(self, directory):
log("doesThemeExist: Checking directory: %s" % directory)
# Check for custom theme directory
if Settings.isThemeDirEnabled():
themeDir = os_path_join(directory, Settings.getThemeDirectory())
# Check if this directory exists
if not dir_exists(themeDir):
workingPath = directory
# If the path currently ends in the directory separator
# then we need to clear an extra one
if (workingPath[-1] == os.sep) or (workingPath[-1] == os.altsep):
workingPath = workingPath[:-1]
# If not check to see if we have a DVD VOB
if (os_path_split(workingPath)[1] == 'VIDEO_TS') or (os_path_split(workingPath)[1] == 'BDMV'):
# Check the parent of the DVD Dir
themeDir = os_path_split(workingPath)[0]
themeDir = os_path_join(themeDir, Settings.getThemeDirectory())
directory = themeDir
# check if the directory exists before searching
if dir_exists(directory):
# Generate the regex
themeFileRegEx = Settings.getThemeFileRegEx(audioOnly=True)
dirs, files = list_dir(directory)
for aFile in files:
m = re.search(themeFileRegEx, aFile, re.IGNORECASE)
if m:
log("doesThemeExist: Found match: " + aFile)
return True
return False
示例4: _generateThemeFilelistWithDirs
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import isThemeDirEnabled [as 别名]
def _generateThemeFilelistWithDirs(self, rawPath):
themeFiles = []
# Check the theme directory if it is set up
if Settings.isThemeDirEnabled():
themeDir = self._getUsablePath(rawPath)
themeDir = os_path_join(themeDir, Settings.getThemeDirectory())
themeFiles = self._generateThemeFilelist(themeDir)
# Check for the case where there is a DVD directory and the themes
# directory is above it
if len(themeFiles) < 1:
if ('VIDEO_TS' in rawPath) or ('BDMV' in rawPath):
log("ThemeFiles: Found VIDEO_TS in path: Correcting the path for DVDR tv shows", self.debug_logging_enabled)
themeDir = self._getUsablePath(rawPath)
themeDir = os_path_split(themeDir)[0]
themeDir = os_path_join(themeDir, Settings.getThemeDirectory())
themeFiles = self._generateThemeFilelist(themeDir)
# If no themes were found in the directory then search the normal location
if len(themeFiles) < 1:
themeFiles = self._generateThemeFilelist(rawPath)
return themeFiles
示例5: fetchAllMissingThemes
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import isThemeDirEnabled [as 别名]
def fetchAllMissingThemes(self):
tvShows = self.getVideos('GetTVShows', MenuNavigator.TVSHOWS)
movies = self.getVideos('GetMovies', MenuNavigator.MOVIES)
music = self.getVideos('GetMusicVideos', MenuNavigator.MUSICVIDEOS)
videoList = []
moveExistingThemes = None
for videoItem in (tvShows + movies + music):
# Get the path where the theme should be stored
path = self.getPathForVideoItem(videoItem)
# Skip items that already have themes
if self._doesThemeExist(path):
continue
if Settings.isThemeDirEnabled() and self._doesThemeExist(path, True):
if moveExistingThemes is None:
# Prompt user if we should move themes in the parent
# directory into the theme directory
moveExistingThemes = xbmcgui.Dialog().yesno(__addon__.getLocalizedString(32105), __addon__.getLocalizedString(32206), __addon__.getLocalizedString(32207))
# Check if we need to move a theme file
if moveExistingThemes:
log("fetchAllMissingThemes: Moving theme for %s" % videoItem['title'])
self._moveToThemeFolder(path)
continue
normtitle = normalize_string(videoItem['title']).encode("utf-8")
normOriginalTitle = None
if videoItem['originaltitle'] is not None:
normOriginalTitle = normalize_string(videoItem['originaltitle']).encode("utf-8")
videoItem = {'title': normtitle, 'path': path.encode("utf-8"), 'originalTitle': normOriginalTitle, 'isTvShow': videoItem['isTvShow'], 'year': videoItem['year'], 'imdb': videoItem['imdb']}
videoList.append(videoItem)
if len(videoList) > 0:
TvTunesFetcher(videoList)
示例6: setVideoList
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import isThemeDirEnabled [as 别名]
def setVideoList(self, jsonGet, target):
videoItems = self.getVideos(jsonGet, target)
for videoItem in videoItems:
# Get the path where the theme should be stored
path = self.getPathForVideoItem(videoItem)
# Create the list-item for this video
li = xbmcgui.ListItem(videoItem['title'], iconImage=videoItem['thumbnail'])
# Remove the default context menu
li.addContextMenuItems([], replaceItems=True)
# Set the background image
if videoItem['fanart'] is not None:
li.setProperty("Fanart_Image", videoItem['fanart'])
# If theme already exists flag it using the play count
# This will normally put a tick on the GUI
if self._doesThemeExist(path):
# A theme already exists, see if we are showing only missing themes
if self.missingThemesOnly == 1:
# skip this theme
continue
li.setInfo('video', {'PlayCount': 1})
# Check the parent directory
elif Settings.isThemeDirEnabled() and self._doesThemeExist(path, True):
# The Theme directory is set, there is no theme in there
# but we have a theme that will play, so flag it
li.setProperty("ResumeTime", "50")
if videoItem['originaltitle'] is not None:
url = self._build_url({'mode': 'findtheme', 'foldername': target, 'path': path.encode("utf-8"), 'title': videoItem['title'].encode("utf-8"), 'isTvShow': videoItem['isTvShow'], 'year': videoItem['year'], 'imdb': videoItem['imdb'], 'originaltitle': videoItem['originaltitle'].encode("utf-8")})
else:
url = self._build_url({'mode': 'findtheme', 'foldername': target, 'path': path.encode("utf-8"), 'title': videoItem['title'].encode("utf-8"), 'isTvShow': videoItem['isTvShow'], 'year': videoItem['year'], 'imdb': videoItem['imdb']})
xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=False)
xbmcplugin.endOfDirectory(self.addon_handle)