Implemented '--skip-ucs' option for 'recommend'

This commit is contained in:
Jamie Hardt
2025-08-30 23:45:36 -07:00
parent 1a42d7d9f1
commit 33619d2ae2

View File

@@ -34,7 +34,10 @@ def ucsinfer():
help="After processing each path in <paths>, prompt for a "
"recommendation to accept, and then prepend the selection to "
"the file name.")
def recommend(text, paths, model, interactive):
@click.option('-s', '--skip-ucs', flag_value=True, default=False,
help="Skip files that already have a UCS category in their "
"name.")
def recommend(text, paths, model, interactive, skip_ucs):
"""
Infer a UCS category for a text description
@@ -50,7 +53,13 @@ def recommend(text, paths, model, interactive):
if text is not None:
print_recommendation(None, text, ctx, interactive_rename=False)
catlist = [x.catid for x in ctx.catlist]
for path in paths:
basename = os.path.basename(path)
if skip_ucs and parse_ucs(basename, catlist):
continue
text = ffmpeg_description(path)
if not text:
text = os.path.basename(path)