Implemented '--skip-ucs' option for 'recommend'
This commit is contained in:
@@ -34,7 +34,10 @@ def ucsinfer():
|
|||||||
help="After processing each path in <paths>, prompt for a "
|
help="After processing each path in <paths>, prompt for a "
|
||||||
"recommendation to accept, and then prepend the selection to "
|
"recommendation to accept, and then prepend the selection to "
|
||||||
"the file name.")
|
"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
|
Infer a UCS category for a text description
|
||||||
|
|
||||||
@@ -50,7 +53,13 @@ def recommend(text, paths, model, interactive):
|
|||||||
if text is not None:
|
if text is not None:
|
||||||
print_recommendation(None, text, ctx, interactive_rename=False)
|
print_recommendation(None, text, ctx, interactive_rename=False)
|
||||||
|
|
||||||
|
catlist = [x.catid for x in ctx.catlist]
|
||||||
|
|
||||||
for path in paths:
|
for path in paths:
|
||||||
|
basename = os.path.basename(path)
|
||||||
|
if skip_ucs and parse_ucs(basename, catlist):
|
||||||
|
continue
|
||||||
|
|
||||||
text = ffmpeg_description(path)
|
text = ffmpeg_description(path)
|
||||||
if not text:
|
if not text:
|
||||||
text = os.path.basename(path)
|
text = os.path.basename(path)
|
||||||
|
Reference in New Issue
Block a user