Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add write option to bpm plugin #1992

Merged
merged 6 commits into from
Jan 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion beetsplug/bpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def commands(self):
return [cmd]

def command(self, lib, opts, args):
self.get_bpm(lib.items(ui.decargs(args)))
items = lib.items(ui.decargs(args))
write = ui.should_write()
self.get_bpm(items, write)

def get_bpm(self, items, write=False):
overwrite = self.config['overwrite'].get(bool)
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ New features:
source in a flexible field; for a usecase see the documentation.
* :doc:`/plugins/export`: A new plugin to export the data from queries to a
json format. Thanks to :user:`GuilhermeHideki`.
* :doc:`/plugins/bpm`: Now uses ``import.write`` option to write tracks after
updating their BPM.
* :doc:`/reference/pathformat`: new functions: %first{} and %ifdef{}
* :doc:`/reference/config`: option ``terminal_encoding`` now works for some
inputs
Expand Down
15 changes: 15 additions & 0 deletions docs/plugins/bpm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ for instance, with ``mpc`` you can do something like::

beet bpm $(mpc |head -1|tr -d "-")

If :ref:`import.write <config-import-write>` is ``yes``, the song's tags are
written to disk.

Configuration
-------------

To configure the plugin, make a ``bpm:`` section in your configuration file.
The available options are:

- **max_strokes**: The maximum number of strokes to accept when tapping out the
BPM.
Default: 3.
- **overwrite**: Overwrite the track's existing BPM.
Default: ``yes``.

Credit
------

Expand Down
2 changes: 2 additions & 0 deletions docs/reference/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ file that looks like this::

These options are available in this section:

.. _config-import-write:

write
~~~~~

Expand Down