When path does not exist the user is notified and the path is added to errored_paths. Added info logs for if path is a file or directory.
This commit is contained in:
21
src/core.py
21
src/core.py
@@ -261,22 +261,29 @@ def scan_folder(path):
|
|||||||
errored_paths = []
|
errored_paths = []
|
||||||
logger.debug('Collecting path %s', path)
|
logger.debug('Collecting path %s', path)
|
||||||
|
|
||||||
|
|
||||||
# non-existing
|
# non-existing
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
try:
|
errored_paths.append(path)
|
||||||
video = Video.fromname(path)
|
logger.exception("The path '{}' does not exist".format(path))
|
||||||
except:
|
|
||||||
logger.exception('Unexpected error while collecting non-existing path %s', path)
|
|
||||||
errored_paths.append(path)
|
|
||||||
|
|
||||||
video.subtitles |= set(search_external_subtitles(video.name, directory=path))
|
# file
|
||||||
|
# if path is a file
|
||||||
|
if os.path.isfile(path):
|
||||||
|
logger.info('Path is a file')
|
||||||
|
try:
|
||||||
|
video = scan_video(path)
|
||||||
|
except:
|
||||||
|
logger.exception('Unexpected error while collection file with path {}'.format(path))
|
||||||
|
|
||||||
|
video.subtitles |= set(search_external_subtitles(video.name))
|
||||||
|
|
||||||
refine(video)
|
refine(video)
|
||||||
videos.append(video)
|
videos.append(video)
|
||||||
# Increment bar to full ?
|
|
||||||
|
|
||||||
# directories
|
# directories
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
|
logger.info('Path is a directory')
|
||||||
try:
|
try:
|
||||||
scanned_videos = scan_videos(path)
|
scanned_videos = scan_videos(path)
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in New Issue
Block a user