sane-tag-music: remove prefer-path flag to force
This commit is contained in:
@@ -297,9 +297,9 @@ class AudioFile:
|
||||
self.muta.save()
|
||||
|
||||
class Tagger:
|
||||
def __init__(self, dry_run: bool, prefer_path: bool, manual_tags: Tags):
|
||||
def __init__(self, dry_run: bool, force: bool, manual_tags: Tags):
|
||||
self.dry_run = dry_run
|
||||
self.prefer_path = prefer_path
|
||||
self.force = force
|
||||
self.manual_tags = manual_tags
|
||||
|
||||
def tag_file(self, path_: str) -> None:
|
||||
@@ -310,10 +310,11 @@ class Tagger:
|
||||
|
||||
old_tags = file_.tags_on_disk()
|
||||
path_tags = Tags.from_path(path_)
|
||||
if self.prefer_path:
|
||||
new_tags = path_tags
|
||||
additional_tags = self.manual_tags.union(path_tags)
|
||||
if self.force:
|
||||
new_tags = additional_tags.union(old_tags)
|
||||
else:
|
||||
new_tags = old_tags.union(path_tags)
|
||||
new_tags = old_tags.union(additional_tags)
|
||||
new_tags = new_tags.union(self.manual_tags)
|
||||
new_tags.trim_fields()
|
||||
new_tags.expand_shorthands()
|
||||
@@ -368,7 +369,7 @@ def main():
|
||||
parser = argparse.ArgumentParser(description="augment music tags based on library path")
|
||||
parser.add_argument("path", nargs="+", help="relative path to a file to tag")
|
||||
parser.add_argument('--dry-run', action='store_true')
|
||||
parser.add_argument('--prefer-path', action='store_true', help="give higher credence to path-based tags than any existing tags")
|
||||
parser.add_argument('--force', action='store_true', help="give higher credence to path-based and manual tags than any existing tags")
|
||||
parser.add_argument('--verbose', action='store_true')
|
||||
parser.add_argument('--album', help="manually specify the tag")
|
||||
parser.add_argument('--album-artist', help="manually specify the tag")
|
||||
@@ -389,7 +390,7 @@ def main():
|
||||
|
||||
tagger = Tagger(
|
||||
dry_run=args.dry_run,
|
||||
prefer_path=args.prefer_path,
|
||||
force=args.force,
|
||||
manual_tags=manual_tags
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user