本文整理汇总了Python中resources.lib.settings.Settings.getThemeFileRegEx方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.getThemeFileRegEx方法的具体用法?Python Settings.getThemeFileRegEx怎么用?Python Settings.getThemeFileRegEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类resources.lib.settings.Settings
的用法示例。
在下文中一共展示了Settings.getThemeFileRegEx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _moveToThemeFolder
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import getThemeFileRegEx [as 别名]
def _moveToThemeFolder(self, directory):
log("moveToThemeFolder: path = %s" % directory)
# Handle the case where we have a disk image
if (os_path_split(directory)[1] == 'VIDEO_TS') or (os_path_split(directory)[1] == 'BDMV'):
directory = os_path_split(directory)[0]
dirs, files = list_dir(directory)
for aFile in files:
m = re.search(Settings.getThemeFileRegEx(directory), aFile, re.IGNORECASE)
if m:
srcpath = os_path_join(directory, aFile)
log("fetchAllMissingThemes: Found match: %s" % srcpath)
targetpath = os_path_join(directory, Settings.getThemeDirectory())
# Make sure the theme directory exists
if not dir_exists(targetpath):
try:
xbmcvfs.mkdir(targetpath)
except:
log("fetchAllMissingThemes: Failed to create directory: %s" % targetpath, True, xbmc.LOGERROR)
break
else:
log("moveToThemeFolder: directory already exists %s" % targetpath)
# Add the filename to the path
targetpath = os_path_join(targetpath, aFile)
if not xbmcvfs.rename(srcpath, targetpath):
log("moveToThemeFolder: Failed to move file from %s to %s" % (srcpath, targetpath))
示例2: _doesThemeExist
# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import getThemeFileRegEx [as 别名]
def _doesThemeExist(self, directory, checkParent=False, incAudioThemes=True, incVideoThemes=True):
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 to see if we need to check the parent directory
if checkParent:
directory = os_path_split(directory)[0]
# check if the directory exists before searching
if dir_exists(directory):
# Generate the regex
audioOnly = False
videoOnly = False
if not incAudioThemes:
videoOnly = True
if not incVideoThemes:
audioOnly = True
themeFileRegEx = Settings.getThemeFileRegEx(audioOnly=audioOnly, videoOnly=videoOnly)
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
# Check if an NFO file exists
nfoFileName = os_path_join(directory, "tvtunes.nfo")
if xbmcvfs.exists(nfoFileName):
log("doesThemeExist: Found match: " + nfoFileName)
return True
return False