本文整理汇总了Python中sickbeard.show_name_helpers.determineReleaseName函数的典型用法代码示例。如果您正苦于以下问题:Python determineReleaseName函数的具体用法?Python determineReleaseName怎么用?Python determineReleaseName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了determineReleaseName函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
def process(self):
self._log(u"Failed download detected: (" + str(self.nzb_name) + ", " + str(self.dir_name) + ")")
releaseName = show_name_helpers.determineReleaseName(self.dir_name, self.nzb_name)
if releaseName is None:
self._log(u"Warning: unable to find a valid release name.", logger.WARNING)
raise exceptions.FailedProcessingFailed()
try:
parser = NameParser(False, showObj=self.show, convert=True)
parsed = parser.parse(releaseName)
except InvalidNameException:
self._log(u"Error: release name is invalid: " + releaseName, logger.DEBUG)
raise exceptions.FailedProcessingFailed()
except InvalidShowException:
self._log(u"Error: unable to parse release name " + releaseName + " into a valid show", logger.DEBUG)
raise exceptions.FailedProcessingFailed()
logger.log(u"name_parser info: ", logger.DEBUG)
logger.log(u" - " + str(parsed.series_name), logger.DEBUG)
logger.log(u" - " + str(parsed.season_number), logger.DEBUG)
logger.log(u" - " + str(parsed.episode_numbers), logger.DEBUG)
logger.log(u" - " + str(parsed.extra_info), logger.DEBUG)
logger.log(u" - " + str(parsed.release_group), logger.DEBUG)
logger.log(u" - " + str(parsed.air_date), logger.DEBUG)
for episode in parsed.episode_numbers:
segment = parsed.show.getEpisode(parsed.season_number, episode)
cur_failed_queue_item = search_queue.FailedQueueItem(parsed.show, [segment])
sickbeard.searchQueueScheduler.action.add_item(cur_failed_queue_item)
return True
示例2: process
def process(self):
"""
Do the actual work
:return: True
"""
self._log(u"Failed download detected: (" + str(self.nzb_name) + ", " + str(self.dir_name) + ")")
releaseName = show_name_helpers.determineReleaseName(self.dir_name, self.nzb_name)
if not releaseName:
self._log(u"Warning: unable to find a valid release name.", logger.WARNING)
raise FailedPostProcessingFailedException()
try:
parsed = NameParser(False).parse(releaseName)
except (InvalidNameException, InvalidShowException) as error:
self._log(u"{}".format(error), logger.DEBUG)
raise FailedPostProcessingFailedException()
self._log(u"name_parser info: ", logger.DEBUG)
self._log(u" - " + str(parsed.series_name), logger.DEBUG)
self._log(u" - " + str(parsed.season_number), logger.DEBUG)
self._log(u" - " + str(parsed.episode_numbers), logger.DEBUG)
self._log(u" - " + str(parsed.extra_info), logger.DEBUG)
self._log(u" - " + str(parsed.release_group), logger.DEBUG)
self._log(u" - " + str(parsed.air_date), logger.DEBUG)
for episode in parsed.episode_numbers:
segment = parsed.show.getEpisode(parsed.season_number, episode)
cur_failed_queue_item = search_queue.FailedQueueItem(parsed.show, [segment])
sickbeard.forcedSearchQueueScheduler.action.add_item(cur_failed_queue_item)
return True
示例3: process
def process(self):
self._log(u"Failed download detected: (" + str(self.nzb_name) + ", " + str(self.dir_name) + ")")
releaseName = show_name_helpers.determineReleaseName(self.dir_name, self.nzb_name)
if releaseName is None:
self._log(u"Warning: unable to find a valid release name.", logger.WARNING)
raise exceptions.FailedProcessingFailed()
parser = NameParser(False)
try:
parsed = parser.parse(releaseName, True)
except InvalidNameException:
self._log(u"Error: release name is invalid: " + releaseName, logger.WARNING)
raise exceptions.FailedProcessingFailed()
logger.log(u"name_parser info: ", logger.DEBUG)
logger.log(u" - " + str(parsed.series_name), logger.DEBUG)
logger.log(u" - " + str(parsed.season_number), logger.DEBUG)
logger.log(u" - " + str(parsed.episode_numbers), logger.DEBUG)
logger.log(u" - " + str(parsed.extra_info), logger.DEBUG)
logger.log(u" - " + str(parsed.release_group), logger.DEBUG)
logger.log(u" - " + str(parsed.air_date), logger.DEBUG)
show_id = self._get_show_id(parsed.series_name)
if show_id is None:
self._log(u"Warning: couldn't find show ID", logger.WARNING)
raise exceptions.FailedProcessingFailed()
self._log(u"Found show_id: " + str(show_id), logger.DEBUG)
self._show_obj = helpers.findCertainShow(sickbeard.showList, show_id)
if self._show_obj is None:
self._log(u"Could not create show object. Either the show hasn't been added to SickBeard, or it's still loading (if SB was restarted recently)", logger.WARNING)
raise exceptions.FailedProcessingFailed()
# # Revert before fail, as fail alters the history
# self._log(u"Reverting episodes...")
# self.log += failed_history.revertEpisodes(self._show_obj, parsed.season_number, parsed.episode_numbers)
# self._log(u"Marking release as bad: " + releaseName)
# self.log += failed_history.logFailed(releaseName)
self.log += failed_history.markFailed(self._show_obj, parsed.season_number, parsed.episode_numbers)
# self._log(u"Marking release as Failed: " + releaseName)
# self.log += failed_history.logFailed(releaseName)
cur_failed_queue_item = search_queue.FailedQueueItem(self._show_obj, parsed.season_number)
sickbeard.searchQueueScheduler.action.add_item(cur_failed_queue_item)
return True
示例4: process
#.........这里部分代码省略.........
cur_release_name = self.nzb_name
if cur_release_name.lower().endswith('.nzb'):
cur_release_name = cur_release_name.rpartition('.')[0]
elif self.good_results[self.FOLDER_NAME]:
cur_release_name = self.folder_name
elif self.good_results[self.FILE_NAME]:
cur_release_name = self.file_name
# take the extension off the filename, it's not needed
if '.' in self.file_name:
cur_release_name = self.file_name.rpartition('.')[0]
if cur_release_name:
self._log("Found release name " + cur_release_name, logger.DEBUG)
cur_ep.release_name = cur_release_name
else:
logger.log("good results: " + repr(self.good_results), logger.DEBUG)
if ep_obj.status in common.Quality.SNATCHED_BEST:
cur_ep.status = common.Quality.compositeStatus(common.ARCHIVED, new_ep_quality)
else:
cur_ep.status = common.Quality.compositeStatus(common.DOWNLOADED, new_ep_quality)
cur_ep.subtitles = []
cur_ep.subtitles_searchcount = 0
cur_ep.subtitles_lastsearch = '0001-01-01 00:00:00'
cur_ep.is_proper = self.is_proper
cur_ep.saveToDB()
# Just want to keep this consistent for failed handling right now
releaseName = show_name_helpers.determineReleaseName(self.folder_path, self.nzb_name)
if releaseName is not None:
failed_history.logSuccess(releaseName)
else:
self._log(u"Couldn't find release in snatch history", logger.WARNING)
# find the destination folder
try:
proper_path = ep_obj.proper_path()
proper_absolute_path = ek.ek(os.path.join, ep_obj.show.location, proper_path)
dest_path = ek.ek(os.path.dirname, proper_absolute_path)
except exceptions.ShowDirNotFoundException:
raise exceptions.PostProcessingFailed(
u"Unable to post-process an episode if the show dir doesn't exist, quitting")
self._log(u"Destination folder for this episode: " + dest_path, logger.DEBUG)
# create any folders we need
helpers.make_dirs(dest_path)
# figure out the base name of the resulting episode file
if sickbeard.RENAME_EPISODES:
orig_extension = self.file_name.rpartition('.')[-1]
new_base_name = ek.ek(os.path.basename, proper_path)
new_file_name = new_base_name + '.' + orig_extension
else:
# if we're not renaming then there's no new base name, we'll just use the existing name
new_base_name = None
new_file_name = self.file_name
try:
示例5: process
#.........这里部分代码省略.........
if self.release_name:
self._log("Found release name " + self.release_name, logger.DEBUG)
cur_ep.release_name = self.release_name
else:
cur_ep.release_name = ""
if ep_obj.status in common.Quality.SNATCHED_BEST:
cur_ep.status = common.Quality.compositeStatus(common.ARCHIVED, new_ep_quality)
else:
cur_ep.status = common.Quality.compositeStatus(common.DOWNLOADED, new_ep_quality)
cur_ep.subtitles = []
cur_ep.subtitles_searchcount = 0
cur_ep.subtitles_lastsearch = '0001-01-01 00:00:00'
cur_ep.is_proper = self.is_proper
cur_ep.version = new_ep_version
if self.release_group:
cur_ep.release_group = self.release_group
else:
cur_ep.release_group = ""
sql_l.append(cur_ep.get_sql())
if len(sql_l) > 0:
myDB = db.DBConnection()
myDB.mass_action(sql_l)
# Just want to keep this consistent for failed handling right now
releaseName = show_name_helpers.determineReleaseName(self.folder_path, self.nzb_name)
if releaseName is not None:
failed_history.logSuccess(releaseName)
else:
self._log(u"Couldn't find release in snatch history", logger.WARNING)
# find the destination folder
try:
proper_path = ep_obj.proper_path()
proper_absolute_path = ek.ek(os.path.join, ep_obj.show.location, proper_path)
dest_path = ek.ek(os.path.dirname, proper_absolute_path)
except exceptions.ShowDirNotFoundException:
raise exceptions.PostProcessingFailed(
u"Unable to post-process an episode if the show dir doesn't exist, quitting")
self._log(u"Destination folder for this episode: " + dest_path, logger.DEBUG)
# create any folders we need
helpers.make_dirs(dest_path)
# figure out the base name of the resulting episode file
if sickbeard.RENAME_EPISODES:
orig_extension = self.file_name.rpartition('.')[-1]
new_base_name = ek.ek(os.path.basename, proper_path)
new_file_name = new_base_name + '.' + orig_extension
else:
# if we're not renaming then there's no new base name, we'll just use the existing name
new_base_name = None
new_file_name = self.file_name
# add to anidb
示例6: process
#.........这里部分代码省略.........
with cur_ep.lock:
if self.release_name:
self._log(u'Found release name ' + self.release_name, logger.DEBUG)
cur_ep.release_name = self.release_name or ''
cur_ep.status = common.Quality.compositeStatus(
**({'status': common.DOWNLOADED, 'quality': new_ep_quality},
{'status': common.ARCHIVED, 'quality': new_ep_quality})
[ep_obj.status in common.Quality.SNATCHED_BEST])
cur_ep.release_group = self.release_group or ''
cur_ep.is_proper = self.is_proper
cur_ep.version = anime_version
cur_ep.subtitles = []
cur_ep.subtitles_searchcount = 0
cur_ep.subtitles_lastsearch = '0001-01-01 00:00:00'
sql = cur_ep.get_sql()
if None is not sql:
sql_l.append(sql)
if 0 < len(sql_l):
my_db = db.DBConnection()
my_db.mass_action(sql_l)
# Just want to keep this consistent for failed handling right now
release_name = show_name_helpers.determineReleaseName(self.folder_path, self.nzb_name)
if None is not release_name:
failed_history.logSuccess(release_name)
else:
self._log(u'No release found in snatch history', logger.WARNING)
# find the destination folder
try:
proper_path = ep_obj.proper_path()
proper_absolute_path = ek.ek(os.path.join, ep_obj.show.location, proper_path)
dest_path = ek.ek(os.path.dirname, proper_absolute_path)
except exceptions.ShowDirNotFoundException:
raise exceptions.PostProcessingFailed(
u'Unable to post process an episode because the show dir does not exist, quitting')
self._log(u'Destination folder for this episode is ' + dest_path, logger.DEBUG)
# create any folders we need
if not helpers.make_dirs(dest_path):
raise exceptions.PostProcessingFailed(u'Unable to create destination folder: ' + dest_path)
# figure out the base name of the resulting episode file
if sickbeard.RENAME_EPISODES:
new_base_name = ek.ek(os.path.basename, proper_path)
new_file_name = new_base_name + '.' + self.file_name.rpartition('.')[-1]
else:
# if we're not renaming then there's no new base name, we'll just use the existing name
new_base_name = None
new_file_name = self.file_name
# add to anidb
示例7: process
#.........这里部分代码省略.........
# get metadata for the show (but not episode because it hasn't been fully processed)
ep_obj.show.writeMetadata(True)
# update the ep info before we rename so the quality & release name go into the name properly
for cur_ep in [ep_obj] + ep_obj.relatedEps:
with cur_ep.lock:
cur_release_name = None
# use the best possible representation of the release name
if self.good_results[self.NZB_NAME]:
cur_release_name = self.nzb_name
if cur_release_name.lower().endswith('.nzb'):
cur_release_name = cur_release_name.rpartition('.')[0]
elif self.good_results[self.FILE_NAME]:
cur_release_name = self.file_name
# take the extension off the filename, it's not needed
if '.' in self.file_name:
cur_release_name = self.file_name.rpartition('.')[0]
elif self.good_results[self.FOLDER_NAME]:
cur_release_name = self.folder_name
if cur_release_name:
self._log("Found release name " + cur_release_name)
cur_ep.release_name = cur_release_name
else:
logger.log(u"good results: " + repr(self.good_results))
cur_ep.status = common.Quality.compositeStatus(common.DOWNLOADED, new_ep_quality)
cur_ep.saveToDB()
releaseName = show_name_helpers.determineReleaseName(self.folder_path, self.nzb_name)
if releaseName is not None:
failed_history.logSuccess(releaseName)
else:
self._log(u"Couldn't find release in snatch history", logger.WARNING)
# find the destination folder
try:
proper_path = ep_obj.proper_path()
proper_absolute_path = ek.ek(os.path.join, ep_obj.show.location, proper_path)
dest_path = ek.ek(os.path.dirname, proper_absolute_path)
except exceptions.ShowDirNotFoundException:
raise exceptions.PostProcessingFailed(u"Unable to post-process an episode if the show dir doesn't exist, quitting")
self._log(u"Destination folder for this episode: " + dest_path)
# create any folders we need
if not helpers.make_dirs(dest_path):
raise exceptions.PostProcessingFailed(u"Unable to create destination folder: " + dest_path)
# figure out the base name of the resulting episode file
if sickbeard.RENAME_EPISODES:
orig_extension = self.file_name.rpartition('.')[-1]
new_base_name = ek.ek(os.path.basename, proper_path)
new_file_name = new_base_name + '.' + orig_extension
else:
# if we're not renaming then there's no new base name, we'll just use the existing name
new_base_name = None
new_file_name = self.file_name
try:
# move the episode and associated files to the show dir