This commit is contained in:
Jamie Hardt
2024-10-16 14:19:15 -07:00
parent ac00f93a8d
commit 4ec028b51b

View File

@@ -42,15 +42,15 @@ def create_batch_list(command_file: str, recursive=True, sort_mode='path'):
f.write("# mfbatch\n\n") f.write("# mfbatch\n\n")
metadatums = {} metadatums = {}
flac_files = glob('./**/*.flac', recursive=recursive) flac_files = glob('./**/*.flac', recursive=recursive)
if sort_mode == 'path': if sort_mode == 'path':
flac_files = sorted(flac_files) flac_files = sorted(flac_files)
elif sort_mode == 'mtime': elif sort_mode == 'mtime':
flac_files = sorted(flac_files, key=lambda f: os.path.getmtime(f)) flac_files = sorted(flac_files, key=os.path.getmtime)
elif sort_mode == 'ctime': elif sort_mode == 'ctime':
flac_files = sorted(flac_files, key=lambda f: os.path.getctime(f)) flac_files = sorted(flac_files, key=os.path.getctime)
elif sort_mode == 'name': elif sort_mode == 'name':
flac_files = sorted(flac_files, key=lambda f: os.path.basename(f)) flac_files = sorted(flac_files, key=os.path.basename)
for path in tqdm(flac_files, unit='File', desc='Scanning FLAC files'): for path in tqdm(flac_files, unit='File', desc='Scanning FLAC files'):
try: try:
@@ -100,10 +100,10 @@ def main():
op.add_argument('-p', '--path', metavar='DIR', op.add_argument('-p', '--path', metavar='DIR',
help='chdir to DIR before running', help='chdir to DIR before running',
default=None) default=None)
op.add_argument('-s', '--sort', metavar='MODE', action='store', op.add_argument('-s', '--sort', metavar='MODE', action='store',
default='path', help="when creating, Set mode to sort " default='path', help="when creating, Set mode to sort "
"files by. Default is 'path'. 'ctime, 'mtime' and 'name' " "files by. Default is 'path'. 'ctime, 'mtime' and 'name' "
"are also options.") "are also options.")
op.add_argument('-n', '--dry-run', action='store_true', op.add_argument('-n', '--dry-run', action='store_true',
help="dry-run -W.") help="dry-run -W.")
op.add_argument('-f', '--batchfile', metavar='FILE', op.add_argument('-f', '--batchfile', metavar='FILE',