本文整理汇总了Python中sickbeard.helpers.chmodAsParent函数的典型用法代码示例。如果您正苦于以下问题:Python chmodAsParent函数的具体用法?Python chmodAsParent怎么用?Python chmodAsParent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了chmodAsParent函数的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: 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
示例3: update_show_indexer_metadata
def update_show_indexer_metadata(self, show_obj):
if self.show_metadata and show_obj and self._has_show_metadata(show_obj):
logger.log(
u"Metadata provider " + self.name + " updating show indexer info metadata file for " + show_obj.name,
logger.DEBUG,
)
nfo_file_path = self.get_show_file_path(show_obj)
try:
with ek.ek(open, nfo_file_path, "r") as xmlFileObj:
showXML = etree.ElementTree(file=xmlFileObj)
indexerid = showXML.find("id")
root = showXML.getroot()
if indexerid:
indexerid.text = show_obj.indexerid
else:
etree.SubElement(root, "id").text = str(show_obj.indexerid)
# Make it purdy
helpers.indentXML(root)
showXML.write(nfo_file_path)
helpers.chmodAsParent(nfo_file_path)
return True
except IOError, e:
logger.log(
u"Unable to write file to " + nfo_file_path + " - are you sure the folder is writable? " + ex(e),
logger.ERROR,
)
开发者ID:Goeny,项目名称:SickRage,代码行数:33,代码来源:generic.py
示例4: 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
示例5: downloadResult
def downloadResult(self, result):
"""
Save the result to disk.
"""
logger.log(u"Downloading a result from " + self.name + " at " + result.url)
data = self.getURL(result.url)
if data is None:
return False
# use the appropriate watch folder
if self.providerType == GenericProvider.NZB:
saveDir = sickbeard.NZB_DIR
writeMode = 'w'
elif self.providerType == GenericProvider.TORRENT:
saveDir = sickbeard.TORRENT_DIR
writeMode = 'wb'
else:
return False
# use the result name as the filename
file_name = ek.ek(os.path.join, saveDir, helpers.sanitizeFileName(result.name) + '.' + self.providerType)
logger.log(u"Saving to " + file_name, logger.DEBUG)
try:
with open(file_name, writeMode) as fileOut:
fileOut.write(data)
helpers.chmodAsParent(file_name)
except EnvironmentError, e:
logger.log("Unable to save the file: " + ex(e), logger.ERROR)
return False
开发者ID:achlee,项目名称:SickRage,代码行数:34,代码来源:generic.py
示例6: update_show_indexer_metadata
def update_show_indexer_metadata(self, show_obj):
if self.show_metadata and show_obj and self._has_show_metadata(show_obj):
logger.log(
u"Metadata provider " + self.name + " updating show indexer info metadata file for " + show_obj.name,
logger.DEBUG)
nfo_file_path = self.get_show_file_path(show_obj)
assert isinstance(nfo_file_path, unicode)
try:
with io.open(nfo_file_path, 'rb') as xmlFileObj:
showXML = etree.ElementTree(file=xmlFileObj)
indexerid = showXML.find('id')
root = showXML.getroot()
if indexerid is not None:
indexerid.text = str(show_obj.indexerid)
else:
etree.SubElement(root, "id").text = str(show_obj.indexerid)
# Make it purdy
helpers.indentXML(root)
showXML.write(nfo_file_path, encoding='UTF-8')
helpers.chmodAsParent(nfo_file_path)
return True
except IOError, e:
logger.log(
u"Unable to write file to " + nfo_file_path + " - are you sure the folder is writable? " + ex(e),
logger.ERROR)
开发者ID:feld,项目名称:SickRage,代码行数:32,代码来源:generic.py
示例7: _write_image
def _write_image(self, image_data, image_path):
"""
Saves the data in image_data to the location image_path. Returns True/False
to represent success or failure.
image_data: binary image data to write to file
image_path: file location to save the image to
"""
# don't bother overwriting it
if ek.ek(os.path.isfile, image_path):
logger.log(u"Image already exists, not downloading", logger.DEBUG)
return False
if not image_data:
logger.log(u"Unable to retrieve image, skipping", logger.WARNING)
return False
image_dir = ek.ek(os.path.dirname, image_path)
try:
if not ek.ek(os.path.isdir, image_dir):
logger.log("Metadata dir didn't exist, creating it at "+image_dir, logger.DEBUG)
ek.ek(os.makedirs, image_dir)
helpers.chmodAsParent(image_dir)
outFile = ek.ek(open, image_path, 'wb')
outFile.write(image_data)
outFile.close()
helpers.chmodAsParent(image_path)
except IOError, e:
logger.log(u"Unable to write image to "+image_path+" - are you sure the show folder is writable? "+ex(e), logger.ERROR)
return False
开发者ID:Araldwenn,项目名称:Sick-Beard,代码行数:33,代码来源:generic.py
示例8: _int_hard_link
def _int_hard_link(cur_file_path, new_file_path, success_tmpl=u' %s to %s'):
try:
helpers.hardlinkFile(cur_file_path, new_file_path)
helpers.chmodAsParent(new_file_path)
self._log(u'Hard linked file from' + (success_tmpl % (cur_file_path, new_file_path)), logger.DEBUG)
except (IOError, OSError), e:
self._log(u'Unable to link file %s<br />.. %s' % (success_tmpl % (cur_file_path, new_file_path), str(e)), logger.ERROR)
raise e
开发者ID:Koernia,项目名称:SickGear,代码行数:9,代码来源:postProcessor.py
示例9: _int_hard_link
def _int_hard_link(cur_file_path, new_file_path):
self._log(u"Hard linking file from " + cur_file_path + " to " + new_file_path, logger.DEBUG)
try:
helpers.hardlinkFile(cur_file_path, new_file_path)
helpers.chmodAsParent(new_file_path)
except (IOError, OSError), e:
self._log("Unable to link file " + cur_file_path + " to " + new_file_path + ": "+ex(e), logger.ERROR)
raise e
开发者ID:brinbois,项目名称:Sick-Beard,代码行数:9,代码来源:postProcessor.py
示例10: _int_move_and_sym_link
def _int_move_and_sym_link(cur_file_path, new_file_path):
self._log(u"Moving then symbolic linking file from " + cur_file_path + " to " + new_file_path, logger.DEBUG)
try:
helpers.moveAndSymlinkFile(cur_file_path, new_file_path)
helpers.chmodAsParent(new_file_path)
except (IOError, OSError), e:
self._log("Unable to link file " + cur_file_path + " to " + new_file_path + ": " + ex(e), logger.ERROR)
raise e
开发者ID:brinbois,项目名称:Sick-Beard,代码行数:9,代码来源:postProcessor.py
示例11: _int_copy
def _int_copy(cur_file_path, new_file_path, success_tmpl=u' %s to %s'):
try:
helpers.copyFile(cur_file_path, new_file_path)
helpers.chmodAsParent(new_file_path)
self._log(u'Copied file from' + (success_tmpl % (cur_file_path, new_file_path)), logger.DEBUG)
except (IOError, OSError), e:
self._log(u'Unable to copy %s<br />.. %s' % (success_tmpl % (cur_file_path, new_file_path), str(e)), logger.ERROR)
raise e
开发者ID:Koernia,项目名称:SickGear,代码行数:9,代码来源:postProcessor.py
示例12: _int_move_and_sym_link
def _int_move_and_sym_link(cur_file_path, new_file_path, success_tmpl=u' %s to %s'):
try:
helpers.moveAndSymlinkFile(cur_file_path, new_file_path)
helpers.chmodAsParent(new_file_path)
self._log(u'Moved then symbolic linked file from' + (success_tmpl % (cur_file_path, new_file_path)),
logger.DEBUG)
except (IOError, OSError), e:
self._log(u'Unable to link file %s<br />.. %s' % (success_tmpl % (cur_file_path, new_file_path), str(e)), logger.ERROR)
raise e
开发者ID:Koernia,项目名称:SickGear,代码行数:10,代码来源:postProcessor.py
示例13: _int_copy
def _int_copy (cur_file_path, new_file_path):
self._log(u"Copying file from "+cur_file_path+" to "+new_file_path, logger.DEBUG)
try:
helpers.copyFile(cur_file_path, new_file_path)
helpers.chmodAsParent(new_file_path)
if sickbeard.UPDATE_DIRECTORY_TIMESTAMP: helpers.touchPath(helpers.getParentDirectory(new_file_path))
except (IOError, OSError), e:
logger.log("Unable to copy file "+cur_file_path+" to "+new_file_path+": "+ex(e), logger.ERROR)
raise e
开发者ID:aforty,项目名称:Sick-Beard,代码行数:10,代码来源:postProcessor.py
示例14: dumpHTML
def dumpHTML(data):
dumpName = ek(os.path.join, sickbeard.CACHE_DIR, 'custom_torrent.html')
try:
fileOut = io.open(dumpName, 'wb')
fileOut.write(data)
fileOut.close()
helpers.chmodAsParent(dumpName)
except IOError, e:
logger.log(u"Unable to save the file: %s " % repr(e), logger.ERROR)
return False
开发者ID:TagForce,项目名称:SickRage,代码行数:11,代码来源:rsstorrent.py
示例15: dumpHTML
def dumpHTML(self, data):
dumpName = ek.ek(os.path.join, sickbeard.CACHE_DIR, "custom_torrent.html")
try:
fileOut = open(dumpName, "wb")
fileOut.write(data)
fileOut.close()
helpers.chmodAsParent(dumpName)
except IOError, e:
logger.log("Unable to save the file: " + ex(e), logger.ERROR)
return False
开发者ID:Wizkidje,项目名称:SickBeard-TVRage,代码行数:12,代码来源:rsstorrent.py
示例16: dumpHTML
def dumpHTML(data):
dumpName = ek(os.path.join, sickbeard.CACHE_DIR, 'custom_torrent.html')
try:
fileOut = ek(io.open, dumpName, 'wb')
fileOut.write(data)
fileOut.close()
helpers.chmodAsParent(dumpName)
except IOError as e:
logging.error("Unable to save the file: %s " % repr(e))
return False
logging.info("Saved custom_torrent html dump %s " % dumpName)
return True
开发者ID:coderbone,项目名称:SickRage,代码行数:13,代码来源:rsstorrent.py
示例17: dumpHTML
def dumpHTML(data):
dumpName = ek(os.path.join, sickbeard.CACHE_DIR, "custom_torrent.html")
try:
fileOut = io.open(dumpName, "wb")
fileOut.write(data)
fileOut.close()
helpers.chmodAsParent(dumpName)
except IOError as e:
logger.log(u"Unable to save the file: %s " % repr(e), logger.ERROR)
return False
logger.log(u"Saved custom_torrent html dump %s " % dumpName, logger.INFO)
return True
开发者ID:madtrix74,项目名称:SickRage,代码行数:13,代码来源:rsstorrent.py
示例18: _int_link
def _int_link (cur_file_path, new_file_path):
self._log(u"Linking file from "+cur_file_path+" to "+new_file_path, logger.DEBUG)
est = eec.set(self._link, cur_file_path)
try:
helpers.moveFile(cur_file_path, new_file_path)
helpers.linkFile(cur_file_path, new_file_path)
helpers.chmodAsParent(new_file_path)
except (IOError, OSError), e:
logger.log("Unable to link file "+cur_file_path+" to "+new_file_path+": "+ex(e), logger.ERROR)
logger.log(str(e), logger.ERROR);
eec.clock(est, False)
raise e
开发者ID:fuzeman,项目名称:Sick-Beard-Ex,代码行数:13,代码来源:postProcessor.py
示例19: dumpHTML
def dumpHTML(data):
dumpName = ek(os.path.join, sickbeard.CACHE_DIR, 'custom_torrent.html')
try:
fileOut = io.open(dumpName, 'wb')
fileOut.write(data)
fileOut.close()
helpers.chmodAsParent(dumpName)
except IOError as error:
logger.log('Unable to save the file: {0}'.format(ex(error)), logger.ERROR)
return False
logger.log('Saved custom_torrent html dump {0} '.format(dumpName), logger.INFO)
return True
开发者ID:Elettronik,项目名称:SickRage,代码行数:14,代码来源:rsstorrent.py
示例20: execute
def execute(self):
generic_queue.QueueItem.execute(self)
ep_obj = self.ep_obj
force = self.force
random.shuffle(SUBTITLE_SERVICES)
logger.log("Searching subtitles for " + ep_obj.prettyName())
if not ek.ek(os.path.isfile, ep_obj.location):
logger.log("Can't download subtitles for " + ep_obj.prettyName() + ". Episode file doesn't exist.", logger.DEBUG)
return
epName = ep_obj.location.rpartition(".")[0]
subLanguages = []
if sickbeard.SUBTITLE_LANGUAGES <> '':
subLanguages = sickbeard.SUBTITLE_LANGUAGES.split(",")
if len(subLanguages) < 1 and ep_obj.show.lang:
subLanguages.append(ep_obj.show.lang)
if len(subLanguages) < 1:
logger.log("Can't download subtitles for " + ep_obj.prettyName() + ". Configure the language to search at post processing options.", logger.DEBUG)
return
#for lang in subLanguages:
#langS = lang.split("-")
#if len(langS) > 1:
#subLanguages.append(langS[0])
try:
sublimLangs = set()
for sub in subLanguages:
bLang = Language.fromietf(sub)
sublimLangs.add(bLang)
sublimEpisode = set()
sublimEpisode.add(Episode.fromname(ep_obj.location))
downloadedSubs = subliminal.download_best_subtitles(
videos=sublimEpisode,
languages=sublimLangs,
providers=SUBTITLE_SERVICES)
subliminal.save_subtitles(downloadedSubs, directory = os.path.dirname(ep_obj.location))
subCount = 0
for video, video_subtitles in downloadedSubs.items():
for sub in video_subtitles:
subPath = subliminal.subtitle.get_subtitle_path(ep_obj.location, sub.language)
helpers.chmodAsParent(subPath)
subCount += 1
except Exception, e:
logger.log("Error while downloading subtitles for %s: %s" % (ep_obj.prettyName(), str(e)), logger.ERROR)
traceback.print_exc()
return False
开发者ID:KazroFox,项目名称:sickbeard,代码行数:50,代码来源:subtitle_queue.py
注:本文中的sickbeard.helpers.chmodAsParent函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论