mirror of
https://github.com/beetbox/beets.git
synced 2026-02-07 16:07:04 +01:00
First attempt at fixing #3132.
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.
This commit is contained in:
parent
6d020e3d2b
commit
1f356d66a6
4 changed files with 48 additions and 2 deletions
|
|
@ -154,9 +154,14 @@ def apply_metadata(album_info, mapping):
|
|||
'albumdisambig',
|
||||
'releasegroupdisambig',
|
||||
'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()
|
||||
value = getattr(album_info, field)
|
||||
if value is not None:
|
||||
item[field] = value
|
||||
if value is None and not clobber:
|
||||
continue
|
||||
item[field] = value
|
||||
|
||||
if track_info.disctitle is not None:
|
||||
item.disctitle = track_info.disctitle
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,19 @@ import:
|
|||
bell: no
|
||||
set_fields: {}
|
||||
|
||||
no_clobber:
|
||||
- albumtype
|
||||
- label
|
||||
- asin
|
||||
- catalognum
|
||||
- script
|
||||
- language
|
||||
- country
|
||||
- albumstatus
|
||||
- albumdisambig
|
||||
- releasegroupdisambig
|
||||
- data_source
|
||||
|
||||
clutter: ["Thumbs.DB", ".DS_Store"]
|
||||
ignore: [".*", "*~", "System Volume Information", "lost+found"]
|
||||
ignore_hidden: yes
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ New features:
|
|||
provider: you can match tracks and albums using the Spotify database.
|
||||
Thanks to :user:`rhlahuja`.
|
||||
:bug:`3123`
|
||||
* A new ``no_clobber`` configuration option allows setting a list of
|
||||
fields not to be overwritten by empty values upon re-importing items.
|
||||
:bug:`3132`
|
||||
|
||||
|
||||
Changes:
|
||||
|
|
|
|||
|
|
@ -303,6 +303,31 @@ The defaults look like this::
|
|||
|
||||
See :ref:`aunique` for more details.
|
||||
|
||||
|
||||
.. _no_clobber:
|
||||
|
||||
no_clobber
|
||||
~~~~~~~~~~
|
||||
|
||||
A list of fields that should not be overwritten by empty values when
|
||||
re-importing items.
|
||||
|
||||
The default is::
|
||||
|
||||
no_clobber:
|
||||
- albumtype
|
||||
- label
|
||||
- asin
|
||||
- catalognum
|
||||
- script
|
||||
- language
|
||||
- country
|
||||
- albumstatus
|
||||
- albumdisambig
|
||||
- releasegroupdisambig
|
||||
- data_source
|
||||
|
||||
|
||||
.. _terminal_encoding:
|
||||
|
||||
terminal_encoding
|
||||
|
|
|
|||
Loading…
Reference in a new issue