本文整理汇总了Python中sickbeard.helpers.isRarFile函数的典型用法代码示例。如果您正苦于以下问题:Python isRarFile函数的具体用法?Python isRarFile怎么用?Python isRarFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isRarFile函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: validateDir
def validateDir(
path, dirName, nzbNameOriginal, failed, result
): # pylint: disable=too-many-locals,too-many-branches,too-many-return-statements
"""
Check if directory is valid for processing
:param path: Path to use
:param dirName: Directory to check
:param nzbNameOriginal: Original NZB name
:param failed: Previously failed objects
:param result: Previous results
:return: True if dir is valid for processing, False if not
"""
dirName = ss(dirName)
IGNORED_FOLDERS = [u".AppleDouble", u"[email protected]__thumb", u"@eaDir"]
folder_name = ek(os.path.basename, dirName)
if folder_name in IGNORED_FOLDERS:
return False
result.output += logHelper(u"Processing folder " + dirName, logger.DEBUG)
if folder_name.startswith(u"_FAILED_"):
result.output += logHelper(u"The directory name indicates it failed to extract.", logger.DEBUG)
failed = True
elif folder_name.startswith(u"_UNDERSIZED_"):
result.output += logHelper(
u"The directory name indicates that it was previously rejected for being undersized.", logger.DEBUG
)
failed = True
elif folder_name.upper().startswith(u"_UNPACK"):
result.output += logHelper(
u"The directory name indicates that this release is in the process of being unpacked.", logger.DEBUG
)
result.missedfiles.append(u"%s : Being unpacked" % dirName)
return False
if failed:
process_failed(ek(os.path.join, path, dirName), nzbNameOriginal, result)
result.missedfiles.append(u"%s : Failed download" % dirName)
return False
if helpers.is_hidden_folder(ek(os.path.join, path, dirName)):
result.output += logHelper(u"Ignoring hidden folder: %s" % dirName, logger.DEBUG)
result.missedfiles.append(u"%s : Hidden folder" % dirName)
return False
# make sure the dir isn't inside a show dir
main_db_con = db.DBConnection()
sql_results = main_db_con.select("SELECT location FROM tv_shows")
for sqlShow in sql_results:
if (
dirName.lower().startswith(ek(os.path.realpath, sqlShow["location"]).lower() + os.sep)
or dirName.lower() == ek(os.path.realpath, sqlShow["location"]).lower()
):
result.output += logHelper(
u"Cannot process an episode that's already been moved to its show dir, skipping " + dirName,
logger.WARNING,
)
return False
# Get the videofile list for the next checks
allFiles = []
allDirs = []
for _, processdir, fileList in ek(os.walk, ek(os.path.join, path, dirName), topdown=False):
allDirs += processdir
allFiles += fileList
videoFiles = [x for x in allFiles if helpers.isMediaFile(x)]
allDirs.append(dirName)
# check if the dir have at least one tv video file
for video in videoFiles:
try:
NameParser().parse(video, cache_result=False)
return True
except (InvalidNameException, InvalidShowException):
pass
for proc_dir in allDirs:
try:
NameParser().parse(proc_dir, cache_result=False)
return True
except (InvalidNameException, InvalidShowException):
pass
if sickbeard.UNPACK:
# Search for packed release
packedFiles = [x for x in allFiles if helpers.isRarFile(x)]
for packed in packedFiles:
try:
NameParser().parse(packed, cache_result=False)
return True
except (InvalidNameException, InvalidShowException):
pass
#.........这里部分代码省略.........
开发者ID:lastdevonearth,项目名称:SickRage,代码行数:101,代码来源:processTV.py
示例2: processDir
def processDir(
dirName,
nzbName=None,
process_method=None,
force=False,
is_priority=None,
delete_on=False,
failed=False,
proc_type="auto",
):
"""
Scans through the files in dirName and processes whatever media files it finds
:param dirName: The folder name to look in
:param nzbName: The NZB name which resulted in this folder being downloaded
:param force: True to postprocess already postprocessed files
:param failed: Boolean for whether or not the download failed
:param proc_type: Type of postprocessing auto or manual
"""
result = ProcessResult()
# if they passed us a real dir then assume it's the one we want
if ek(os.path.isdir, dirName):
dirName = ek(os.path.realpath, dirName)
result.output += logHelper(u"Processing folder %s" % dirName, logger.DEBUG)
# if the client and SickRage are not on the same machine translate the directory into a network directory
elif all(
[
sickbeard.TV_DOWNLOAD_DIR,
ek(os.path.isdir, sickbeard.TV_DOWNLOAD_DIR),
ek(os.path.normpath, dirName) == ek(os.path.normpath, sickbeard.TV_DOWNLOAD_DIR),
]
):
dirName = ek(os.path.join, sickbeard.TV_DOWNLOAD_DIR, ek(os.path.abspath, dirName).split(os.path.sep)[-1])
result.output += logHelper(u"Trying to use folder: %s " % dirName, logger.DEBUG)
# if we didn't find a real dir then quit
if not ek(os.path.isdir, dirName):
result.output += logHelper(
u"Unable to figure out what folder to process. "
u"If your downloader and SickRage aren't on the same PC "
u"make sure you fill out your TV download dir in the config.",
logger.DEBUG,
)
return result.output
path, dirs, files = get_path_dir_files(dirName, nzbName, proc_type)
files = [x for x in files if not is_torrent_or_nzb_file(x)]
SyncFiles = [x for x in files if is_sync_file(x)]
nzbNameOriginal = nzbName
# Don't post process if files are still being synced and option is activated
postpone = SyncFiles and sickbeard.POSTPONE_IF_SYNC_FILES
if not postpone:
result.output += logHelper(u"PostProcessing Path: %s" % path, logger.INFO)
result.output += logHelper(u"PostProcessing Dirs: %s" % str(dirs), logger.DEBUG)
rarFiles = [x for x in files if helpers.isRarFile(x)]
rarContent = unRAR(path, rarFiles, force, result)
files += rarContent
videoFiles = [x for x in files if helpers.isMediaFile(x)]
videoInRar = [x for x in rarContent if helpers.isMediaFile(x)]
result.output += logHelper(u"PostProcessing Files: %s" % files, logger.DEBUG)
result.output += logHelper(u"PostProcessing VideoFiles: %s" % videoFiles, logger.DEBUG)
result.output += logHelper(u"PostProcessing RarContent: %s" % rarContent, logger.DEBUG)
result.output += logHelper(u"PostProcessing VideoInRar: %s" % videoInRar, logger.DEBUG)
# If nzbName is set and there's more than one videofile in the folder, files will be lost (overwritten).
nzbName = None if len(videoFiles) >= 2 else nzbName
process_method = process_method if process_method else sickbeard.PROCESS_METHOD
result.result = True
# Don't Link media when the media is extracted from a rar in the same path
if process_method in (u"hardlink", u"symlink") and videoInRar:
process_media(path, videoInRar, nzbName, u"move", force, is_priority, result)
delete_files(path, rarContent, result)
for video in set(videoFiles) - set(videoInRar):
process_media(path, [video], nzbName, process_method, force, is_priority, result)
elif sickbeard.DELRARCONTENTS and videoInRar:
process_media(path, videoInRar, nzbName, process_method, force, is_priority, result)
delete_files(path, rarContent, result, True)
for video in set(videoFiles) - set(videoInRar):
process_media(path, [video], nzbName, process_method, force, is_priority, result)
else:
for video in videoFiles:
process_media(path, [video], nzbName, process_method, force, is_priority, result)
else:
result.output += logHelper(u"Found temporary sync files: %s in path: %s" % (SyncFiles, path))
result.output += logHelper(u"Skipping post processing for folder: %s" % path)
result.missedfiles.append(u"%s : Syncfiles found" % path)
# Process Video File in all TV Subdir
for curDir in [x for x in dirs if validateDir(path, x, nzbNameOriginal, failed, result)]:
#.........这里部分代码省略.........
开发者ID:lastdevonearth,项目名称:SickRage,代码行数:101,代码来源:processTV.py
示例3: subtitles_download_in_pp
def subtitles_download_in_pp(): # pylint: disable=too-many-locals, too-many-branches
logger.log(u'Checking for needed subtitles in Post-Process folder', logger.INFO)
providers = enabled_service_list()
provider_configs = {'addic7ed': {'username': sickbeard.ADDIC7ED_USER,
'password': sickbeard.ADDIC7ED_PASS},
'legendastv': {'username': sickbeard.LEGENDASTV_USER,
'password': sickbeard.LEGENDASTV_PASS},
'opensubtitles': {'username': sickbeard.OPENSUBTITLES_USER,
'password': sickbeard.OPENSUBTITLES_PASS}}
pool = ProviderPool(providers=providers, provider_configs=provider_configs)
# Search for all wanted languages
languages = {from_code(language) for language in wanted_languages()}
if not languages:
return
run_post_process = False
# Check if PP folder is set
if sickbeard.TV_DOWNLOAD_DIR and os.path.isdir(sickbeard.TV_DOWNLOAD_DIR):
for root, _, files in os.walk(sickbeard.TV_DOWNLOAD_DIR, topdown=False):
rar_files = [x for x in files if isRarFile(x)]
if rar_files and sickbeard.UNPACK:
video_files = [x for x in files if isMediaFile(x)]
if u'_UNPACK' not in root and (not video_files or root == sickbeard.TV_DOWNLOAD_DIR):
logger.log(u'Found rar files in post-process folder: {}'.format(rar_files), logger.DEBUG)
result = processTV.ProcessResult()
processTV.unRAR(root, rar_files, False, result)
elif rar_files and not sickbeard.UNPACK:
logger.log(u'Unpack is disabled. Skipping: {}'.format(rar_files), logger.WARNING)
for root, _, files in os.walk(sickbeard.TV_DOWNLOAD_DIR, topdown=False):
for video_filename in sorted(files):
try:
# Remove non release groups from video file. Needed to match subtitles
new_video_filename = remove_non_release_groups(video_filename)
if new_video_filename != video_filename:
os.rename(video_filename, new_video_filename)
video_filename = new_video_filename
except Exception as error:
logger.log(u'Couldn\'t remove non release groups from video file. Error: {}'.format
(ex(error)), logger.DEBUG)
if isMediaFile(video_filename):
try:
video = subliminal.scan_video(os.path.join(root, video_filename),
subtitles=False, embedded_subtitles=False)
subtitles_list = pool.list_subtitles(video, languages)
for provider in providers:
if provider in pool.discarded_providers:
logger.log(u'Could not search in {} provider. Discarding for now'.format(provider), logger.DEBUG)
if not subtitles_list:
logger.log(u'No subtitles found for {}'.format
(os.path.join(root, video_filename)), logger.DEBUG)
continue
logger.log(u'Found subtitle(s) canditate(s) for {}'.format(video_filename), logger.INFO)
hearing_impaired = sickbeard.SUBTITLES_HEARING_IMPAIRED
user_score = 213 if sickbeard.SUBTITLES_PERFECT_MATCH else 204
found_subtitles = pool.download_best_subtitles(subtitles_list, video, languages=languages,
hearing_impaired=hearing_impaired,
min_score=user_score,
only_one=not sickbeard.SUBTITLES_MULTI)
for subtitle in subtitles_list:
score = subliminal.score.compute_score(subtitle, video, hearing_impaired=sickbeard.SUBTITLES_HEARING_IMPAIRED)
logger.log(u'[{}] Subtitle score for {} is: {} (min={})'.format
(subtitle.provider_name, subtitle.id, score, user_score), logger.DEBUG)
downloaded_languages = set()
for subtitle in found_subtitles:
logger.log(u'Found subtitle for {} in {} provider with language {}'.format
(os.path.join(root, video_filename), subtitle.provider_name,
subtitle.language.opensubtitles), logger.DEBUG)
subliminal.save_subtitles(video, found_subtitles, directory=root,
single=not sickbeard.SUBTITLES_MULTI)
subtitles_multi = not sickbeard.SUBTITLES_MULTI
subtitle_path = subliminal.subtitle.get_subtitle_path(video.name,
None if subtitles_multi else
subtitle.language)
if root is not None:
subtitle_path = os.path.join(root, os.path.split(subtitle_path)[1])
sickbeard.helpers.chmodAsParent(subtitle_path)
sickbeard.helpers.fixSetGroupID(subtitle_path)
downloaded_languages.add(subtitle.language.opensubtitles)
# Don't run post processor unless at least one file has all of the needed subtitles
if not needs_subtitles(downloaded_languages):
run_post_process = True
except Exception as error:
logger.log(u'Error occurred when downloading subtitles for: {}. Error: {}'.format
(os.path.join(root, video_filename), ex(error)))
if run_post_process:
logger.log(u'Starting post-process with default settings now that we found subtitles')
processTV.processDir(sickbeard.TV_DOWNLOAD_DIR)
开发者ID:pedro2d10,项目名称:SickRage-FR,代码行数:100,代码来源:subtitles.py
示例4: subtitles_download_in_pp
def subtitles_download_in_pp(): # pylint: disable=too-many-locals, too-many-branches, too-many-statements
logger.log(u'Checking for needed subtitles in Post-Process folder', logger.INFO)
providers = enabled_service_list()
pool = SubtitleProviderPool()
# Search for all wanted languages
languages = {from_code(language) for language in wanted_languages()}
if not languages:
return
# Dict of language exceptions to use with subliminal
language_exceptions = {'pt-br': 'pob'}
run_post_process = False
# Check if PP folder is set
if sickbeard.TV_DOWNLOAD_DIR and os.path.isdir(sickbeard.TV_DOWNLOAD_DIR):
for dirpath, dirnames_, files in os.walk(sickbeard.TV_DOWNLOAD_DIR, topdown=False):
rar_files = [rar_file for rar_file in files if isRarFile(rar_file)]
if rar_files and sickbeard.UNPACK:
video_files = [video_file for video_file in files if isMediaFile(video_file)]
if u'_UNPACK' not in dirpath and (not video_files or dirpath == sickbeard.TV_DOWNLOAD_DIR):
logger.log(u'Found rar files in post-process folder: {0}'.format(rar_files), logger.DEBUG)
result = processTV.ProcessResult()
processTV.unRAR(dirpath, rar_files, False, result)
elif rar_files and not sickbeard.UNPACK:
logger.log(u'Unpack is disabled. Skipping: {0}'.format(rar_files), logger.WARNING)
for dirpath, dirnames_, files in os.walk(sickbeard.TV_DOWNLOAD_DIR, topdown=False):
for filename in sorted(files):
try:
# Remove non release groups from video file. Needed to match subtitles
new_filename = remove_non_release_groups(filename)
if new_filename != filename:
os.rename(filename, new_filename)
filename = new_filename
except Exception as error:
logger.log(u"Couldn't remove non release groups from video file. Error: {0}".format
(ex(error)), logger.DEBUG)
# Delete unwanted subtitles before downloading new ones
if sickbeard.SUBTITLES_MULTI and sickbeard.SUBTITLES_KEEP_ONLY_WANTED and filename.rpartition('.')[2] in subtitle_extensions:
subtitle_language = filename.rsplit('.', 2)[1].lower()
if len(subtitle_language) == 2 and subtitle_language in language_converters['opensubtitles'].codes:
subtitle_language = Language.fromcode(subtitle_language, 'alpha2').opensubtitles
elif subtitle_language in language_exceptions:
subtitle_language = language_exceptions.get(subtitle_language, subtitle_language)
elif subtitle_language not in language_converters['opensubtitles'].codes:
subtitle_language = 'unknown'
if subtitle_language not in sickbeard.SUBTITLES_LANGUAGES:
try:
os.remove(os.path.join(dirpath, filename))
logger.log(u"Deleted '{0}' because we don't want subtitle language '{1}'. We only want '{2}' language(s)".format
(filename, subtitle_language, ','.join(sickbeard.SUBTITLES_LANGUAGES)), logger.DEBUG)
except Exception as error:
logger.log(u"Couldn't delete subtitle: {0}. Error: {1}".format(filename, ex(error)), logger.DEBUG)
if isMediaFile(filename) and processTV.subtitles_enabled(filename):
try:
video = get_video(os.path.join(dirpath, filename), subtitles=False, embedded_subtitles=False)
subtitles_list = pool.list_subtitles(video, languages)
for provider in providers:
if provider in pool.discarded_providers:
logger.log(u'Could not search in {0} provider. Discarding for now'.format(provider), logger.DEBUG)
if not subtitles_list:
logger.log(u'No subtitles found for {0}'.format
(os.path.join(dirpath, filename)), logger.DEBUG)
continue
logger.log(u'Found subtitle(s) canditate(s) for {0}'.format(filename), logger.INFO)
hearing_impaired = sickbeard.SUBTITLES_HEARING_IMPAIRED
user_score = 213 if sickbeard.SUBTITLES_PERFECT_MATCH else 198
found_subtitles = pool.download_best_subtitles(subtitles_list, video, languages=languages,
hearing_impaired=hearing_impaired,
min_score=user_score,
only_one=not sickbeard.SUBTITLES_MULTI)
for subtitle in subtitles_list:
score = subliminal.score.compute_score(subtitle, video, hearing_impaired=sickbeard.SUBTITLES_HEARING_IMPAIRED)
logger.log(u'[{0}] Subtitle score for {1} is: {2} (min={3})'.format
(subtitle.provider_name, subtitle.id, score, user_score), logger.DEBUG)
downloaded_languages = set()
for subtitle in found_subtitles:
logger.log(u'Found subtitle for {0} in {1} provider with language {2}'.format
(os.path.join(dirpath, filename), subtitle.provider_name,
subtitle.language.opensubtitles), logger.INFO)
subliminal.save_subtitles(video, found_subtitles, directory=dirpath,
single=not sickbeard.SUBTITLES_MULTI)
subtitles_multi = not sickbeard.SUBTITLES_MULTI
subtitle_path = subliminal.subtitle.get_subtitle_path(video.name,
None if subtitles_multi else
subtitle.language)
if dirpath is not None:
subtitle_path = os.path.join(dirpath, os.path.split(subtitle_path)[1])
sickbeard.helpers.chmodAsParent(subtitle_path)
#.........这里部分代码省略.........
开发者ID:guilhermebruzzi,项目名称:SickRage,代码行数:101,代码来源:subtitles.py
示例5: processDir
def processDir(dirName, nzbName=None, process_method=None, force=False, is_priority=None, delete_on=False, failed=False, proc_type="auto"):
"""
Scans through the files in dirName and processes whatever media files it finds
dirName: The folder name to look in
nzbName: The NZB or torrent which resulted in a folder/file being downloaded
dirName/nzbName == file: Single file torrent downloaded content
dirName == dir : Directory with Torrent or NZB downloaded content
WARNING: Always make sure downloaded content exists, even if failed = true.
'Delete failed' option and 'Move' process method are otherwise not
save to use and may recursively remove source directories. Before
calling *always* make sure dirName exists, and in case of singe
torrents that the file dirName/nzbName exists. An API change is
required to improve on this. For now it remains backwards compatible
and therefore inherits existing issues.
force : True to postprocess already postprocessed files
failed : Boolean for whether or not the download failed
type : Type of postprocessing
- manual: Recursively post-process all file(s)/dir(s) in dirName
(Automatically selected when post-processing TV_DOWNLOAD_DIR.)
- auto : Non-recursively post-process file(s) in dirName. Support for single-file
torrents included.
"""
result = ProcessResult()
result.output += logHelper(u"Processing folder %s" % dirName, logger.DEBUG)
result.output += logHelper(u"TV_DOWNLOAD_DIR: %s" % sickbeard.TV_DOWNLOAD_DIR, logger.DEBUG)
result.output += logHelper(u"Torrent-/NZB-name: " + str(nzbName) , logger.DEBUG)
result.output += logHelper(u"Process method : " + str(process_method), logger.DEBUG)
result.output += logHelper(u"Process type : " + str(type) , logger.DEBUG)
result.output += logHelper(u"Failed download : " + str(failed) , logger.DEBUG)
# Determine torrent type (False if not a torrent)
torrent_type = get_torrent_type(dirName, nzbName)
result.output += logHelper(u"Torrent-type : " + str(torrent_type) , logger.DEBUG)
postpone = False
# if they passed us a real dir then assume it's the one we want
if ek(os.path.isdir,dirName):
dirName = ek(os.path.realpath, dirName)
# if the client and SickRage are not on the same machine translate the Dir in a network dir
elif sickbeard.TV_DOWNLOAD_DIR and ek(os.path.isdir,sickbeard.TV_DOWNLOAD_DIR) \
and ek(os.path.normpath, dirName) != ek(os.path.normpath, sickbeard.TV_DOWNLOAD_DIR):
dirName = ek(os.path.join, sickbeard.TV_DOWNLOAD_DIR, ek(os.path.abspath, dirName).split(os.path.sep)[-1])
result.output += logHelper(u"Trying to use folder %s" % dirName, logger.DEBUG)
# if we didn't find a real dir then quit
if not ek(os.path.isdir,dirName):
result.output += logHelper(
u"Unable to figure out what folder to process. If your downloader and SickRage aren't on the same PC make sure you fill out your TV download dir in the config.",
logger.DEBUG)
return result.output
# Handle failed torrent
if nzbname_is_torrent(nzbName) and failed:
# Mark torrent as failed
process_failed(dirName, nzbName, result)
if result.result:
result.output += logHelper(u"Successfully processed")
else:
result.output += logHelper(u"Problem(s) during processing", logger.WARNING)
return result.output
path, dirs, files = get_path_dir_files(dirName, nzbName, proc_type)
files = [x for x in files if helpers.notTorNZBFile(x)]
SyncFiles = [x for x in files if helpers.isSyncFile(x)]
# Don't post process if files are still being synced and option is activated
if SyncFiles and sickbeard.POSTPONE_IF_SYNC_FILES:
postpone = True
nzbNameOriginal = nzbName
if not postpone:
result.output += logHelper(u"PostProcessing Path: %s" % path, logger.INFO)
result.output += logHelper(u"PostProcessing Dirs: [%s]" % dirs, logger.DEBUG)
rarFiles = [x for x in files if helpers.isRarFile(x)]
rarContent = unRAR(path, rarFiles, force, result)
files += rarContent
videoFiles = [x for x in files if helpers.isMediaFile(x)]
videoInRar = [x for x in rarContent if helpers.isMediaFile(x)]
result.output += logHelper(u"PostProcessing Files: [%s]" % u", ".join(files), logger.DEBUG)
result.output += logHelper(u"PostProcessing VideoFiles: [%s]" % u", ".join(videoFiles), logger.DEBUG)
result.output += logHelper(u"PostProcessing RarContent: [%s]" % u", ".join(rarContent), logger.DEBUG)
result.output += logHelper(u"PostProcessing VideoInRar: [%s]" % u", ".join(videoInRar), logger.DEBUG)
# If nzbName is set and there's more than one videofile in the folder, files will be lost (overwritten).
#.........这里部分代码省略.........
开发者ID:fabiankaeser,项目名称:SickRage,代码行数:101,代码来源:processTV.py
示例6: processDir
def processDir(dirName, nzbName=None, process_method=None, force=False, is_priority=None, delete_on=False, failed=False, proc_type="auto"): # pylint: disable=too-many-arguments,too-many-branches,too-many-statements,too-many-locals
"""
Scans through the files in dirName and processes whatever media files it finds
:param dirName: The folder name to look in
:param nzbName: The NZB name which resulted in this folder being downloaded
:param force: True to postprocess already postprocessed files
:param failed: Boolean for whether or not the download failed
:param proc_type: Type of postprocessing auto or manual
"""
result = ProcessResult()
result.output += logHelper(u"Processing folder " + dirName, logger.DEBUG)
result.output += logHelper(u"TV_DOWNLOAD_DIR: " + sickbeard.TV_DOWNLOAD_DIR, logger.DEBUG)
postpone = False
# if they passed us a real dir then assume it's the one we want
if ek(os.path.isdir, dirName):
dirName = ek(os.path.realpath, dirName)
# if the client and SickRage are not on the same machine translate the Dir in a network dir
elif sickbeard.TV_DOWNLOAD_DIR and ek(os.path.isdir, sickbeard.TV_DOWNLOAD_DIR) \
and ek(os.path.normpath, dirName) != ek(os.path.normpath, sickbeard.TV_DOWNLOAD_DIR):
dirName = ek(os.path.join, sickbeard.TV_DOWNLOAD_DIR, ek(os.path.abspath, dirName).split(os.path.sep)[-1])
result.output += logHelper(u"Trying to use folder " + dirName, logger.DEBUG)
# if we didn't find a real dir then quit
if not ek(os.path.isdir, dirName):
result.output += logHelper(
u"Unable to figure out what folder to process. If your downloader and SickRage aren't on the same PC make sure you fill out your TV download dir in the config.",
logger.DEBUG)
return result.output
path, dirs, files = get_path_dir_files(dirName, nzbName, proc_type)
files = [x for x in files if not is_torrent_or_nzb_file(x)]
SyncFiles = [x for x in files if is_sync_file(x)]
# Don't post process if files are still being synced and option is activated
if SyncFiles and sickbeard.POSTPONE_IF_SYNC_FILES:
postpone = True
nzbNameOriginal = nzbName
if not postpone:
result.output += logHelper(u"PostProcessing Path: " + path, logger.INFO)
result.output += logHelper(u"PostProcessing Dirs: " + str(dirs), logger.DEBUG)
rarFiles = [x for x in files if helpers.isRarFile(x)]
rarContent = unRAR(path, rarFiles, force, result)
files += rarContent
videoFiles = [x for x in files if helpers.isMediaFile(x)]
videoInRar = [x for x in rarContent if helpers.isMediaFile(x)]
result.output += logHelper(u"PostProcessing Files: " + str(files), logger.DEBUG)
result.output += logHelper(u"PostProcessing VideoFiles: " + str(videoFiles), logger.DEBUG)
result.output += logHelper(u"PostProcessing RarContent: " + str(rarContent), logger.DEBUG)
result.output += logHelper(u"PostProcessing VideoInRar: " + str(videoInRar), logger.DEBUG)
# If nzbName is set and there's more than one videofile in the folder, files will be lost (overwritten).
if len(videoFiles) >= 2:
nzbName = None
if not process_method:
process_method = sickbeard.PROCESS_METHOD
result.result = True
# Don't Link media when the media is extracted from a rar in the same path
if process_method in ('hardlink', 'symlink') and videoInRar:
process_media(path, videoInRar, nzbName, 'move', force, is_priority, result)
delete_files(path, rarContent, result)
for video in set(videoFiles) - set(videoInRar):
process_media(path, [video], nzbName, process_method, force, is_priority, result)
elif sickbeard.DELRARCONTENTS and videoInRar:
process_media(path, videoInRar, nzbName, process_method, force, is_priority, result)
delete_files(path, rarContent, result, True)
for video in set(videoFiles) - set(videoInRar):
process_media(path, [video], nzbName, process_method, force, is_priority, result)
else:
for video in videoFiles:
process_media(path, [video], nzbName, process_method, force, is_priority, result)
else:
result.output += logHelper(u"Found temporary sync files, skipping post processing for folder " + str(path))
result.output += logHelper(u"Sync Files: " + str(SyncFiles) + " in path: " + path)
result.missedfiles.append(path + " : Syncfiles found")
# Process Video File in all TV Subdir
for curDir in [x for x in dirs if validateDir(path, x, nzbNameOriginal, failed, result)]:
result.result = True
for processPath, _, fileList in ek(os.walk, ek(os.path.join, path, curDir), topdown=False):
if not validateDir(path, processPath, nzbNameOriginal, failed, result):
continue
postpone = False
#.........这里部分代码省略.........
开发者ID:yenoiwesa,项目名称:SickRage,代码行数:101,代码来源:processTV.py
注:本文中的sickbeard.helpers.isRarFile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论