diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 69213ea97..fa2fc84af 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1055,7 +1055,8 @@ def update_items(lib, query, album, move, pretend): def update_func(lib, opts, args): - update_items(lib, decargs(args), opts.album, opts.move, opts.pretend) + update_items(lib, decargs(args), opts.album, ui.should_move(opts.move), + opts.pretend) update_cmd = ui.Subcommand( @@ -1064,7 +1065,11 @@ update_cmd = ui.Subcommand( update_cmd.parser.add_album_option() update_cmd.parser.add_format_option() update_cmd.parser.add_option( - '-M', '--nomove', action='store_false', default=True, dest='move', + '-m', '--move', action='store_true', dest='move', + help="move files in the library directory" +) +update_cmd.parser.add_option( + '-M', '--nomove', action='store_false', dest='move', help="don't move files in library" ) update_cmd.parser.add_option( @@ -1294,14 +1299,18 @@ def modify_func(lib, opts, args): if not mods and not dels: raise ui.UserError('no modifications specified') modify_items(lib, mods, dels, query, ui.should_write(opts.write), - opts.move, opts.album, not opts.yes) + ui.should_move(opts.move), opts.album, not opts.yes) modify_cmd = ui.Subcommand( 'modify', help='change metadata fields', aliases=('mod',) ) modify_cmd.parser.add_option( - '-M', '--nomove', action='store_false', default=True, dest='move', + '-m', '--move', action='store_true', dest='move', + help="move files in the library directory" +) +modify_cmd.parser.add_option( + '-M', '--nomove', action='store_false', dest='move', help="don't move files in library" ) modify_cmd.parser.add_option( diff --git a/beetsplug/mbsync.py b/beetsplug/mbsync.py index 03b79a48e..d44f8f773 100644 --- a/beetsplug/mbsync.py +++ b/beetsplug/mbsync.py @@ -45,8 +45,11 @@ class MBSyncPlugin(BeetsPlugin): help='update metadata from musicbrainz') cmd.parser.add_option('-p', '--pretend', action='store_true', help='show all changes but do nothing') + cmd.parser.add_option('-m', '--move', action='store_true', + dest='move', + help="move files in the library directory") cmd.parser.add_option('-M', '--nomove', action='store_false', - default=True, dest='move', + dest='move', help="don't move files in library") cmd.parser.add_option('-W', '--nowrite', action='store_false', default=None, dest='write', @@ -58,7 +61,7 @@ class MBSyncPlugin(BeetsPlugin): def func(self, lib, opts, args): """Command handler for the mbsync function. """ - move = opts.move + move = ui.should_move(opts.move) pretend = opts.pretend write = ui.should_write(opts.write) query = ui.decargs(args) diff --git a/docs/changelog.rst b/docs/changelog.rst index 5864d5c38..1c1fb0db6 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,6 +4,17 @@ Changelog 1.3.16 (in development) ----------------------- +New: + +* Three commands, ``modify``, ``update``, and ``mbsync``, would previously + move files by default after changing their metadata. Now, these commands + will only move files if you have the :ref:`config-import-copy` or + :ref:`config-import-move` options enabled in your importer configuration. + This way, if you configure the importer not to touch your filenames, other + commands will respect that decision by default too. Each command also + sprouted a ``--move`` command-line option to override this default (in + addition to the ``--nomove`` flag they already had). :bug:`1697` + For developers: * :doc:`/dev/plugins`: Two new hooks, ``albuminfo_received`` and diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 2d91bac14..7970d746c 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -370,6 +370,8 @@ Either ``yes`` or ``no``, controlling whether metadata (e.g., ID3) tags are written to files when using ``beet import``. Defaults to ``yes``. The ``-w`` and ``-W`` command-line options override this setting. +.. _config-import-copy: + copy ~~~~ @@ -380,6 +382,8 @@ overridden with the ``-c`` and ``-C`` command-line options. The option is ignored if ``move`` is enabled (i.e., beets can move or copy files but it doesn't make sense to do both). +.. _config-import-move: + move ~~~~