def _build(inputs):
paths = []
for f in inputs:
if os.path.isdir(f):
# Walk through the directory and get all PDF files
# Credit: https://stackoverflow.com/a/2186565/4856091
for root, dirnames, filenames in os.walk(f):
for filename in fnmatch.filter(filenames, "*.pdf"):
paths.append(os.path.join(root, filename))
elif f.endswith(".pdf"):
paths.append(f)
else:
# Get the contents as list of files
_files = [line.strip() for line in open(f).readlines()]
_files = [_f for _f in _files
if (not _f.startswith("#")) and (_f != "")]
paths += _files
return paths
评论列表
文章目录