forked from airium/AfterCollation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAR.py
More file actions
42 lines (27 loc) · 1.07 KB
/
AR.py
File metadata and controls
42 lines (27 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from imports import *
def main(root):
logger = initLogger(log_path := root.parent.joinpath(AR_LOG_FILENAME))
logger.info(USING_AR_1.format(AC_VERSION))
logger.info(THE_INPUT_IS_1.format(root))
cds_roots = [d for d in listDir(root) if d.name.lower() == STD_CDS_DIRNAME.lower()]
if not cds_roots:
logger.warning(AR_NOT_FOUND_CDS_DIR_2.format(STD_CDS_DIRNAME, root))
cds_roots = [root]
for cds_root in cds_roots:
if any(p.lower() == STD_BKS_DIRNAME.lower() for p in cds_root.relative_to(root).parts[:-1]): continue
logger.info('')
logger.info(CHECKING_1.format(cds_root))
chkAlbumRoot(cds_root, logger=logger)
logger.info(CHECKED_1.format(cds_root))
logger.info('')
logger.info(AR_ENDING_NOTE_1.format(log_path))
logging.shutdown()
return
def _cli(paths: list[Path]):
n = len(paths)
if (n == 1) and paths[0].is_dir():
main(paths[0])
else:
printUsage(AR_USAGE_1.format(STD_CDS_DIRNAME), paths)
if __name__ == '__main__':
wrapTrackBack(_cli, sys.argv[1:])