Conversation
Add a new `no_clobber` config option that contains a list of "miscellaneous" metadata fields not to be overwritten by empty values. I'm not entirely happy with the `no_clobber` name. Suggestions welcome.
sampsyo
left a comment
There was a problem hiding this comment.
Looks good! I just have a couple of small concerns about the name and the role this plays:
- Putting a field on this list doesn't prevent clobbering altogether—it only prevents clobbering when the new value would be empty. So the name could mislead people into thinking that putting a field there "protects" it completely (i.e., never overwrites that field with anything).
- There are other fields that have
is not Nonechecks in this function that aren't in the miscellaneous metadata list. For example,disctitlegets handled separately (for some reason), as do many other fields. So putting that field in this list won't have the intended effect.
beets/autotag/__init__.py
Outdated
| 'data_source',): | ||
| # Don't overwrite fields with empty values unless the | ||
| # field is explicitly allowed to be overwritten | ||
| clobber = field not in config['no_clobber'].get() |
There was a problem hiding this comment.
A type assertion here might be useful: .as_str_seq() instead of .get().
Great point. I'm open to any suggestions for a better name.
Also a good point. Should all these fields be moved into the |
|
Hmm... I’m not sure what the best course of action is. Maybe it would be simplest to invert the sense of the option (overwrite_null?), leave it empty by default, and possibly leave it undocumented for now because of its hard-to-explain limitations? |
- Rename config option to overwrite_null - Leave overwrite_null empty by default - Handle more potentially null fields for both album and tracks - Remove documentation and changelog entries for now
|
Updated the code to handle the track-level fields and inverted the logic as asked. Also removed the documentation and changelog entries for now. And it looks like Travis is having a bad day. |
|
Looking good; thanks! Travis seems like it's pointing out a very very nitpicky style complaint: |
|
All green 👍 |
|
Awesome! This looks like it will be useful to build on, and it made the code for that function simpler. Thanks for your help with this!! ✨ |
Add a new
no_clobberconfig option that contains a list of "miscellaneous" metadata fields not to be overwritten by empty values.I'm not entirely happy with the
no_clobbername. Suggestions welcome.