diff --git a/ucsinfer/__main__.py b/ucsinfer/__main__.py index 345b7c4..9c98514 100644 --- a/ucsinfer/__main__.py +++ b/ucsinfer/__main__.py @@ -34,7 +34,10 @@ def ucsinfer(): help="After processing each path in , 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)