Skip to content

Commit 64c94f6

Browse files
authored
Metadata option (beetbox#6041)
My usecase needs the `convert` to not write tags so I can write my own APEv2 tags. This PR adds a write_metadata option to disable the `convert` plugin writing metadata to the converted files.
2 parents 5e0e898 + 699e0a1 commit 64c94f6

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

beetsplug/convert.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def __init__(self):
122122
"threads": os.cpu_count(),
123123
"format": "mp3",
124124
"id3v23": "inherit",
125+
"write_metadata": True,
125126
"formats": {
126127
"aac": {
127128
"command": (
@@ -446,8 +447,9 @@ def convert_item(
446447
if id3v23 == "inherit":
447448
id3v23 = None
448449

449-
# Write tags from the database to the converted file.
450-
item.try_write(path=converted, id3v23=id3v23)
450+
# Write tags from the database to the file if requested
451+
if self.config["write_metadata"].get(bool):
452+
item.try_write(path=converted, id3v23=id3v23)
451453

452454
if keep_new:
453455
# If we're keeping the transcoded file, read it again (after

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ New features:
1111

1212
- :doc:`plugins/lastgenre`: Add a ``--pretend`` option to preview genre changes
1313
without storing or writing them.
14+
- :doc:`plugins/convert`: Add a config option to disable writing metadata to
15+
converted files.
1416
- :doc:`plugins/discogs`: New config option `strip_disambiguation` to toggle
1517
stripping discogs numeric disambiguation on artist and label fields.
1618

docs/plugins/convert.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ The available options are:
9797
- **embed**: Embed album art in converted items. Default: ``yes``.
9898
- **id3v23**: Can be used to override the global ``id3v23`` option. Default:
9999
``inherit``.
100+
- **write_metadata**: Can be used to disable writing metadata to converted
101+
files. Default: ``true``.
100102
- **max_bitrate**: By default, the plugin does not transcode files that are
101103
already in the destination format. This option instead also transcodes files
102104
with high bitrates, even if they are already in the same format as the output.

0 commit comments

Comments
 (0)