From dd1f49d53b4a7d58641efe619dba581de2a2d528 Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Wed, 17 Oct 2018 19:55:38 +0200 Subject: [PATCH] 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. --- src/core.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/core.py b/src/core.py index 1eeb665..d721319 100755 --- a/src/core.py +++ b/src/core.py @@ -261,22 +261,29 @@ def scan_folder(path): errored_paths = [] logger.debug('Collecting path %s', path) + # non-existing if not os.path.exists(path): - try: - video = Video.fromname(path) - except: - logger.exception('Unexpected error while collecting non-existing path %s', path) - errored_paths.append(path) + errored_paths.append(path) + logger.exception("The path '{}' does not exist".format(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) videos.append(video) - # Increment bar to full ? # directories if os.path.isdir(path): + logger.info('Path is a directory') try: scanned_videos = scan_videos(path) except: