Init: Basic project structure and functionality.
This commit is contained in:
commit
8715c69e89
13 changed files with 503 additions and 0 deletions
47
scripts/fck
Executable file
47
scripts/fck
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
+---------------------------------+
|
||||
| CRC32 sum generator CLI utility |
|
||||
+---------------------------------+
|
||||
"""
|
||||
|
||||
import argparse
|
||||
from multiprocessing import Pool
|
||||
from fck import checker, fileutils
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""
|
||||
Main function, should only run when programm gets directly invoked.
|
||||
"""
|
||||
parser = argparse.ArgumentParser(description="Calculate CRC32 of files")
|
||||
parser.add_argument("-b", "--bigfiles",
|
||||
help="parse files that exceed your memory limit",
|
||||
action="store_true")
|
||||
parser.add_argument("-p", "--processes",
|
||||
help="",
|
||||
default=2,
|
||||
type=int)
|
||||
parser.add_argument("-c", "--checksfv",
|
||||
help="",
|
||||
default="",
|
||||
type=str)
|
||||
parser.add_argument("files",
|
||||
help="files and folders to process",
|
||||
nargs='*',
|
||||
default=[])
|
||||
args = parser.parse_args()
|
||||
|
||||
file_list = fileutils.search(args.files)
|
||||
ppool = Pool(processes=args.processes)
|
||||
file_list_checked = ppool.starmap(checker.check, [(x, args.bigfiles)
|
||||
for x in list(file_list)])
|
||||
ppool.close()
|
||||
print(f"[{len([x for x in file_list_checked if x])}/{len(file_list_checked)}] Files passed")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main()
|
||||
except KeyboardInterrupt:
|
||||
print("Exception: KeyboardInterrupt")
|
Loading…
Add table
Add a link
Reference in a new issue