本文整理汇总了Python中sickbeard.helpers.makeDir函数的典型用法代码示例。如果您正苦于以下问题:Python makeDir函数的具体用法?Python makeDir怎么用?Python makeDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeDir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: add_show
def add_show(indexer, indexer_id, show_name, status):
"""
Adds a new show with the default settings
"""
if not Show.find(sickbeard.showList, int(indexer_id)):
root_dirs = sickbeard.ROOT_DIRS.split('|')
location = root_dirs[int(root_dirs[0]) + 1] if root_dirs else None
if location:
show_path = ek(os.path.join, location, show_name)
logger.log(u"Adding show '{}' with ID: '{}' in location: '{}'".format(show_name, indexer_id, show_path))
dir_exists = helpers.makeDir(show_path)
if not dir_exists:
logger.log(u"Unable to create the folder {}. Unable to add the show {}".format(show_path, show_name), logger.WARNING)
return
else:
logger.log(u"Creating the folder '{}'".format(show_path), logger.DEBUG)
helpers.chmodAsParent(show_path)
sickbeard.showQueueScheduler.action.addShow(indexer, indexer_id, show_path,
default_status=status,
quality=int(sickbeard.QUALITY_DEFAULT),
flatten_folders=int(sickbeard.FLATTEN_FOLDERS_DEFAULT),
paused=sickbeard.TRAKT_START_PAUSED,
default_status_after=status)
else:
logger.log(u"There was an error creating the show, no root directory setting found", logger.WARNING)
return
开发者ID:Thraxis,项目名称:pymedusa,代码行数:30,代码来源:traktChecker.py
示例2: change_LOG_DIR
def change_LOG_DIR(log_dir, web_log):
"""
Change logging directory for application and webserver
:param log_dir: Path to new logging directory
:param web_log: Enable/disable web logging
:return: True on success, False on failure
"""
log_dir_changed = False
abs_log_dir = os.path.normpath(os.path.join(sickbeard.DATA_DIR, log_dir))
web_log_value = checkbox_to_value(web_log)
if os.path.normpath(sickbeard.LOG_DIR) != abs_log_dir:
if helpers.makeDir(abs_log_dir):
sickbeard.ACTUAL_LOG_DIR = os.path.normpath(log_dir)
sickbeard.LOG_DIR = abs_log_dir
logger.initLogging()
logger.log(u"Initialized new log file in " + sickbeard.LOG_DIR)
log_dir_changed = True
else:
return False
if sickbeard.WEB_LOG != web_log_value or log_dir_changed == True:
sickbeard.WEB_LOG = web_log_value
return True
开发者ID:Maximilian-Reuter,项目名称:SickRage,代码行数:28,代码来源:config.py
示例3: change_LOG_DIR
def change_LOG_DIR(log_dir, web_log):
log_dir_changed = False
abs_log_dir = os.path.normpath(os.path.join(sickbeard.DATA_DIR, log_dir))
web_log_value = checkbox_to_value(web_log)
if os.path.normpath(sickbeard.LOG_DIR) != abs_log_dir:
if helpers.makeDir(abs_log_dir):
sickbeard.ACTUAL_LOG_DIR = os.path.normpath(log_dir)
sickbeard.LOG_DIR = abs_log_dir
logger.sb_log_instance.initLogging()
logger.log(u"Initialized new log file in " + sickbeard.LOG_DIR)
log_dir_changed = True
else:
return False
if sickbeard.WEB_LOG != web_log_value or log_dir_changed == True:
sickbeard.WEB_LOG = web_log_value
if sickbeard.WEB_LOG:
cherry_log = os.path.join(sickbeard.LOG_DIR, "cherrypy.log")
logger.log(u"Change cherry log file to " + cherry_log)
else:
cherry_log = None
logger.log(u"Disable cherry logging")
cherrypy.config.update({'log.access_file': cherry_log})
return True
开发者ID:BrendenCA,项目名称:SickRage,代码行数:31,代码来源:config.py
示例4: change_unpack_dir
def change_unpack_dir(unpack_dir):
"""
Change UNPACK directory (used by postprocessor)
:param unpack_dir: New unpack directory
:return: True on success, False on failure
"""
if unpack_dir == '':
sickbeard.UNPACK_DIR = ''
return True
if ek(os.path.normpath, sickbeard.UNPACK_DIR) != ek(os.path.normpath, unpack_dir):
if bool(sickbeard.ROOT_DIRS) and \
any(map(lambda rd: helpers.is_subdirectory(unpack_dir, rd), sickbeard.ROOT_DIRS.split('|')[1:])):
# don't change if it's in any of the TV root directories
logger.log("Unable to change unpack directory to a sub-directory of a TV root dir")
return False
if helpers.makeDir(unpack_dir):
sickbeard.UNPACK_DIR = ek(os.path.normpath, unpack_dir)
logger.log("Changed unpack directory to " + unpack_dir)
else:
logger.log("Unable to create unpack directory " + ek(os.path.normpath, unpack_dir) + ", dir not changed.")
return False
return True
开发者ID:ArthurGarnier,项目名称:SickRage,代码行数:26,代码来源:config.py
示例5: addDefaultShow
def addDefaultShow(self, indexer, indexer_id, name, status):
"""
Adds a new show with the default settings
"""
if not helpers.findCertainShow(sickbeard.showList, int(indexer_id)):
logger.log(u"Adding show " + str(indexer_id))
root_dirs = sickbeard.ROOT_DIRS.split('|')
try:
location = root_dirs[int(root_dirs[0]) + 1]
except:
location = None
if location:
showPath = ek.ek(os.path.join, location, helpers.sanitizeFileName(name))
dir_exists = helpers.makeDir(showPath)
if not dir_exists:
logger.log(u"Unable to create the folder " + showPath + ", can't add the show", logger.ERROR)
return
else:
helpers.chmodAsParent(showPath)
sickbeard.showQueueScheduler.action.addShow(int(indexer), int(indexer_id), showPath, status,
int(sickbeard.QUALITY_DEFAULT),
int(sickbeard.FLATTEN_FOLDERS_DEFAULT),
paused=sickbeard.TRAKT_START_PAUSED)
else:
logger.log(u"There was an error creating the show, no root directory setting found", logger.ERROR)
return
开发者ID:rob356,项目名称:SickRage,代码行数:29,代码来源:traktChecker.py
示例6: addDefaultShow
def addDefaultShow(indexer, indexer_id, name, status):
"""
Adds a new show with the default settings
"""
if not Show.find(sickbeard.showList, int(indexer_id)):
logger.log(u"Adding show " + str(indexer_id))
root_dirs = sickbeard.ROOT_DIRS.split('|')
try:
location = root_dirs[int(root_dirs[0]) + 1]
except Exception:
location = None
if location:
showPath = ek(os.path.join, location, sanitize_filename(name))
dir_exists = helpers.makeDir(showPath)
if not dir_exists:
logger.log(u"Unable to create the folder %s , can't add the show" % showPath, logger.WARNING)
return
else:
helpers.chmodAsParent(showPath)
sickbeard.showQueueScheduler.action.addShow(int(indexer), int(indexer_id), showPath,
default_status=status,
quality=int(sickbeard.QUALITY_DEFAULT),
flatten_folders=int(sickbeard.FLATTEN_FOLDERS_DEFAULT),
paused=sickbeard.TRAKT_START_PAUSED,
default_status_after=status)
else:
logger.log(u"There was an error creating the show, no root directory setting found", logger.WARNING)
return
开发者ID:madtrix74,项目名称:SickRage,代码行数:32,代码来源:traktChecker.py
示例7: _commitSTRM
def _commitSTRM(strmName, strmContents):
# get the final file path to the strm file
destinationPath = ek.ek(os.path.join, sickbeard.TV_DOWNLOAD_DIR, strmName)
helpers.makeDir(destinationPath)
fileName = ek.ek(os.path.join, destinationPath, strmName + ".strm")
logger.log(u"Saving STRM to " + fileName)
# save the data to disk
try:
fileOut = open(fileName, "w")
fileOut.write(strmContents)
fileOut.close()
helpers.chmodAsParent(fileName)
return True
except IOError, e:
logger.log(u"Error trying to save STRM to TV downloader directory: "+ex(e), logger.ERROR)
return False
开发者ID:atmorell,项目名称:Sick-Beard,代码行数:18,代码来源:strm.py
示例8: change_TORRENT_DIR
def change_TORRENT_DIR(torrent_dir):
if torrent_dir == '':
sickbeard.TORRENT_DIR = ''
return True
if os.path.normpath(sickbeard.TORRENT_DIR) != os.path.normpath(torrent_dir):
if helpers.makeDir(torrent_dir):
sickbeard.TORRENT_DIR = os.path.normpath(torrent_dir)
logger.log(u"Changed torrent folder to " + torrent_dir)
else:
return False
return True
开发者ID:Bonekicker,项目名称:SickRage,代码行数:13,代码来源:config.py
示例9: change_NZB_DIR
def change_NZB_DIR(nzb_dir):
if nzb_dir == '':
sickbeard.NZB_DIR = ''
return True
if os.path.normpath(sickbeard.NZB_DIR) != os.path.normpath(nzb_dir):
if helpers.makeDir(nzb_dir):
sickbeard.NZB_DIR = os.path.normpath(nzb_dir)
logger.log(u"Changed NZB folder to " + nzb_dir)
else:
return False
return True
开发者ID:Bonekicker,项目名称:SickRage,代码行数:13,代码来源:config.py
示例10: change_TV_DOWNLOAD_DIR
def change_TV_DOWNLOAD_DIR(tv_download_dir):
if tv_download_dir == '':
sickbeard.TV_DOWNLOAD_DIR = ''
return True
if os.path.normpath(sickbeard.TV_DOWNLOAD_DIR) != os.path.normpath(tv_download_dir):
if helpers.makeDir(tv_download_dir):
sickbeard.TV_DOWNLOAD_DIR = os.path.normpath(tv_download_dir)
logger.log(u"Changed TV download folder to " + tv_download_dir)
else:
return False
return True
开发者ID:Bonekicker,项目名称:SickRage,代码行数:13,代码来源:config.py
示例11: change_HTTPS_KEY
def change_HTTPS_KEY(https_key):
if https_key == '':
sickbeard.HTTPS_KEY = ''
return True
if os.path.normpath(sickbeard.HTTPS_KEY) != os.path.normpath(https_key):
if helpers.makeDir(os.path.dirname(os.path.abspath(https_key))):
sickbeard.HTTPS_KEY = os.path.normpath(https_key)
logger.log(u"Changed https key path to " + https_key)
else:
return False
return True
开发者ID:Bonekicker,项目名称:SickRage,代码行数:13,代码来源:config.py
示例12: change_HTTPS_CERT
def change_HTTPS_CERT(https_cert):
if https_cert == '':
sickbeard.HTTPS_CERT = ''
return True
if os.path.normpath(sickbeard.HTTPS_CERT) != os.path.normpath(https_cert):
if helpers.makeDir(os.path.dirname(os.path.abspath(https_cert))):
sickbeard.HTTPS_CERT = os.path.normpath(https_cert)
logger.log(u"Changed https cert path to " + https_cert)
else:
return False
return True
开发者ID:Bonekicker,项目名称:SickRage,代码行数:13,代码来源:config.py
示例13: change_SCENEEX_DIR
def change_SCENEEX_DIR(sceneex_dir):
if sceneex_dir == '':
sickbeard.SCENEEX_DIR = ''
return True
if os.path.normpath(sickbeard.SCENEEX_DIR) != os.path.normpath(sceneex_dir):
if helpers.makeDir(sceneex_dir):
sickbeard.SCENEEX_DIR = os.path.normpath(sceneex_dir)
logger.log(u"Changed Exceptions to " + sceneex_dir)
else:
return False
return True
开发者ID:poetter,项目名称:Sick-Beard--german-support,代码行数:14,代码来源:config.py
示例14: change_NZB_DIR
def change_NZB_DIR(nzb_dir):
if nzb_dir == '':
sickbeard.NZB_DIR = ''
return True, u"Removed NZB directory"
if os.path.normpath(sickbeard.NZB_DIR) != os.path.normpath(nzb_dir):
if helpers.makeDir(nzb_dir):
sickbeard.NZB_DIR = os.path.normpath(nzb_dir)
logger.log(u"Changed NZB folder to " + nzb_dir)
else:
return False, u"Unable to create NZB directory '" + nzb_dir + "', directory unchanged"
return True, u"Changed NZB directory to " + nzb_dir
开发者ID:mptrs,项目名称:Sick-Beard,代码行数:14,代码来源:config.py
示例15: change_TORRENT_DIR
def change_TORRENT_DIR(torrent_dir):
if torrent_dir == '':
sickbeard.TORRENT_DIR = ''
return True, u"Removed TORRENT directory"
if os.path.normpath(sickbeard.TORRENT_DIR) != os.path.normpath(torrent_dir):
if helpers.makeDir(torrent_dir):
sickbeard.TORRENT_DIR = os.path.normpath(torrent_dir)
logger.log(u"Changed torrent directory to " + torrent_dir)
else:
return False, u"Unable to create TORRENT directory '" + torrent_dir + "', directory unchanged"
return True, u"Changed TORRENT directory to " + torrent_dir
开发者ID:mptrs,项目名称:Sick-Beard,代码行数:14,代码来源:config.py
示例16: change_HTTPS_CHAIN
def change_HTTPS_CHAIN(https_chain):
if https_chain == '':
sickbeard.HTTPS_CHAIN = ''
return True
if os.path.normpath(sickbeard.HTTPS_CHAIN) != os.path.normpath(https_chain):
if helpers.makeDir(os.path.dirname(os.path.abspath(https_chain))):
sickbeard.HTTPS_CHAIN = os.path.normpath(https_chain)
logger.log(u"Changed https chain path to " + https_chain)
else:
return False
return True
开发者ID:nmorey,项目名称:Sick-Beard,代码行数:14,代码来源:config.py
示例17: __init__
def __init__(self, show=None):
self.showDir = show
# if we can't create the dir, bail
if not os.path.isdir(self.showDir):
if not helpers.makeDir(self.showDir):
raise exceptions.NoNFOException("Unable to create the show dir " + self.showDir)
if not os.path.isfile(os.path.join(self.showDir, "tvshow.nfo")):
raise exceptions.NoNFOException("No tvshow.nfo found")
# this will initialize self.show to None
QueueItem.__init__(self, QueueActions.ADD)
self.initialShow = TVShow(self.showDir)
开发者ID:basti1,项目名称:Sick-Beard,代码行数:16,代码来源:queue.py
示例18: change_LOG_DIR
def change_LOG_DIR(log_dir):
if os.path.normpath(sickbeard.LOG_DIR) != os.path.normpath(log_dir):
if helpers.makeDir(log_dir):
sickbeard.LOG_DIR = os.path.normpath(log_dir)
logger.sb_log_instance.initLogging()
logger.log(u"Initialized new log file in " + log_dir)
cherry_log = os.path.join(sickbeard.LOG_DIR, "cherrypy.log")
cherrypy.config.update({'log.access_file': cherry_log})
logger.log(u"Changed cherry log file to " + cherry_log)
else:
return False
return True
开发者ID:mleinart,项目名称:Sick-Beard,代码行数:17,代码来源:config.py
示例19: change_torrent_dir
def change_torrent_dir(torrent_dir):
"""
Change torrent directory
:param torrent_dir: New torrent directory
:return: True on success, False on failure
"""
if torrent_dir == '':
sickbeard.TORRENT_DIR = ''
return True
if ek(os.path.normpath, sickbeard.TORRENT_DIR) != ek(os.path.normpath, torrent_dir):
if helpers.makeDir(torrent_dir):
sickbeard.TORRENT_DIR = ek(os.path.normpath, torrent_dir)
logger.log("Changed torrent folder to " + torrent_dir)
else:
return False
return True
开发者ID:ArthurGarnier,项目名称:SickRage,代码行数:19,代码来源:config.py
示例20: change_HTTPS_KEY
def change_HTTPS_KEY(https_key):
"""
Replace HTTPS Key file path
:param https_key: path to the new key file
:return: True on success, False on failure
"""
if https_key == '':
sickbeard.HTTPS_KEY = ''
return True
if os.path.normpath(sickbeard.HTTPS_KEY) != os.path.normpath(https_key):
if helpers.makeDir(os.path.dirname(os.path.abspath(https_key))):
sickbeard.HTTPS_KEY = os.path.normpath(https_key)
logger.log(u"Changed https key path to " + https_key)
else:
return False
return True
开发者ID:Maximilian-Reuter,项目名称:SickRage,代码行数:19,代码来源:config.py
注:本文中的sickbeard.helpers.makeDir函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论