Progressbar during parsing of scanned videos no longer shows the filename because it created newline per element. Scanning videos for a given path shows progressbar based on the number of outer folders walked throught
This commit is contained in:
11
src/core.py
11
src/core.py
@@ -111,6 +111,9 @@ def scan_videos(path):
|
|||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
raise ValueError('Path is not a directory')
|
raise ValueError('Path is not a directory')
|
||||||
|
|
||||||
|
# setup progress bar
|
||||||
|
with click.progressbar(length=len(os.listdir(path)), label='Searching for videos') as bar:
|
||||||
|
|
||||||
# walk the path
|
# walk the path
|
||||||
videos = []
|
videos = []
|
||||||
for dirpath, dirnames, filenames in os.walk(path):
|
for dirpath, dirnames, filenames in os.walk(path):
|
||||||
@@ -154,6 +157,8 @@ def scan_videos(path):
|
|||||||
|
|
||||||
videos.append(video)
|
videos.append(video)
|
||||||
|
|
||||||
|
bar.update(1)
|
||||||
|
|
||||||
return videos
|
return videos
|
||||||
|
|
||||||
|
|
||||||
@@ -220,10 +225,6 @@ def scan_folder(path):
|
|||||||
errored_paths = []
|
errored_paths = []
|
||||||
logging.debug('Collecting path %s', path)
|
logging.debug('Collecting path %s', path)
|
||||||
|
|
||||||
content_count = 0
|
|
||||||
for _ in os.listdir(path):
|
|
||||||
content_count += 1
|
|
||||||
|
|
||||||
# non-existing
|
# non-existing
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
try:
|
try:
|
||||||
@@ -247,7 +248,7 @@ def scan_folder(path):
|
|||||||
logging.exception('Unexpected error while collecting directory path %s', path)
|
logging.exception('Unexpected error while collecting directory path %s', path)
|
||||||
errored_paths.append(path)
|
errored_paths.append(path)
|
||||||
|
|
||||||
with click.progressbar(scanned_videos, label='Parsing found videos', item_show_function=lambda v: os.path.split(v.name)[1] if v is not None else '') as bar:
|
with click.progressbar(scanned_videos, label='Parsing found videos') as bar:
|
||||||
for v in bar:
|
for v in bar:
|
||||||
v.subtitle_languages |= set(search_external_subtitles(v.name,
|
v.subtitle_languages |= set(search_external_subtitles(v.name,
|
||||||
directory=path).values())
|
directory=path).values())
|
||||||
|
|||||||
Reference in New Issue
Block a user