From a9ba25439f15f502b5b4947ee3c896ab9fa6594a Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Fri, 18 Sep 2020 15:48:14 +0100 Subject: [PATCH 01/16] Add --plugins flag --- .github/ISSUE_TEMPLATE/bug-report.md | 6 ++++++ beets/ui/__init__.py | 17 +++++++++++++---- docs/changelog.rst | 1 + docs/reference/cli.rst | 4 ++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 646243812..6fae156b1 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -35,6 +35,12 @@ Here's a link to the music files that trigger the bug (if relevant): * beets version: * Turning off plugins made problem go away (yes/no): + + My configuration (output of `beet config`) is: ```yaml diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index d882e06fb..28879a731 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -1102,8 +1102,8 @@ optparse.Option.ALWAYS_TYPED_ACTIONS += ('callback',) # The main entry point and bootstrapping. -def _load_plugins(config): - """Load the plugins specified in the configuration. +def _load_plugins(options, config): + """Load the plugins specified on the command line or in the configuration. """ paths = config['pluginpath'].as_str_seq(split=False) paths = [util.normpath(p) for p in paths] @@ -1120,7 +1120,14 @@ def _load_plugins(config): # *contain* a `beetsplug` package. sys.path += paths - plugins.load_plugins(config['plugins'].as_str_seq()) + # If we were given any plugins on the command line, use those. + if options.plugins is not None: + plugin_list = (options.plugins.split(',') + if len(options.plugins) > 0 else []) + else: + plugin_list = config['plugins'].as_str_seq() + + plugins.load_plugins(plugin_list) plugins.send("pluginload") return plugins @@ -1135,7 +1142,7 @@ def _setup(options, lib=None): config = _configure(options) - plugins = _load_plugins(config) + plugins = _load_plugins(options, config) # Get the default subcommands. from beets.ui.commands import default_commands @@ -1233,6 +1240,8 @@ def _raw_main(args, lib=None): help=u'log more details (use twice for even more)') parser.add_option('-c', '--config', dest='config', help=u'path to configuration file') + parser.add_option('-p', '--plugins', dest='plugins', + help=u'a comma-separated list of plugins to load') parser.add_option('-h', '--help', dest='help', action='store_true', help=u'show this help message and exit') parser.add_option('--version', dest='version', action='store_true', diff --git a/docs/changelog.rst b/docs/changelog.rst index e33299fab..1a1c30ce5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -154,6 +154,7 @@ New features: similar to ``beet modify`` * :doc:`/plugins/web`: add DELETE and PATCH methods for modifying items * :doc:`/plugins/lyrics`: Removed LyricWiki source (shut down on 21/09/2020). +* Added a ``--plugins`` (or ``-p``) flag to specify a list of plugins at startup. Fixes: diff --git a/docs/reference/cli.rst b/docs/reference/cli.rst index 2062193ab..5d2b834b7 100644 --- a/docs/reference/cli.rst +++ b/docs/reference/cli.rst @@ -440,6 +440,10 @@ import ...``. configuration options entirely, the two are merged. Any individual options set in this config file will override the corresponding settings in your base configuration. +* ``-p plugins``: specify a comma-separated list of plugins to enable. If + specified, the plugin list in your configuration is ignored. The long form + of this argument also allows specifying no plugins, effectively disabling + all plugins: ``--plugins=``. Beets also uses the ``BEETSDIR`` environment variable to look for configuration and data. From 7621cdfeb9f085f6634ea00592d111fef9988139 Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Thu, 22 Oct 2020 00:02:55 +0100 Subject: [PATCH 02/16] Fix GitHub user page regex --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 018ef5397..0066c3f82 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -30,7 +30,7 @@ extlinks = { linkcheck_ignore = [ r'https://github.com/beetbox/beets/issues/', - r'https://github.com/\w+$', # ignore user pages + r'https://github.com/[^/]+$', # ignore user pages r'.*localhost.*', r'https://www.musixmatch.com/', # blocks requests ] From 14a56303815573666b69f3e60fdbeb940a0bf11e Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Thu, 22 Oct 2020 00:03:18 +0100 Subject: [PATCH 03/16] Add genius to linkcheck ignore list --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index 0066c3f82..f77838e81 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -33,6 +33,7 @@ linkcheck_ignore = [ r'https://github.com/[^/]+$', # ignore user pages r'.*localhost.*', r'https://www.musixmatch.com/', # blocks requests + r'https://genius.com/', # blocks requests ] # Options for HTML output From 950dbe3b9f5a3a4c5ff6689c6312e1862d93cada Mon Sep 17 00:00:00 2001 From: "Kyle R. Conway" Date: Fri, 23 Oct 2020 00:41:58 -0500 Subject: [PATCH 04/16] Update faq.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A couple of suggested modifications primarily to clarify that this unordered list is of **options** to install the latest version―not a series of commands to complete a single install. Also suggested a layout change to explain the series of commands in option b. --- docs/faq.rst | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index eeab6c1ef..8af404fce 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -137,13 +137,16 @@ it's helpful to run on the "bleeding edge". To run the latest source: ``pip uninstall beets``. 2. Install from source. There are a few easy ways to do this: - - Use ``pip`` to install the latest snapshot tarball: just type - ``pip install https://github.com/beetbox/beets/tarball/master``. - - Grab the source using Git: - ``git clone https://github.com/beetbox/beets.git``. Then - ``cd beets`` and type ``python setup.py install``. - - Use ``pip`` to install an "editable" version of beets based on an - automatic source checkout. For example, run + - **Option 1** - Use ``pip`` to install the latest snapshot tarball: + just type: ``pip install https://github.com/beetbox/beets/tarball/master``. + - **Option 2** - Grab the source using Git: + + 1. First clone the repository ``git clone https://github.com/beetbox/beets.git``. + 2. Then enter the beets directory ``cd beets`` + 3. Finally install ``python setup.py install``. + + - **Option 3** - Use ``pip`` to install an "editable" version of beets based on an + automatic source checkout. For example, run: ``pip install -e git+https://github.com/beetbox/beets#egg=beets`` to clone beets and install it, allowing you to modify the source in-place to try out changes. From d0cbf098c60ca27f3e75cf899026979f19dcca00 Mon Sep 17 00:00:00 2001 From: "Kyle R. Conway" Date: Fri, 23 Oct 2020 11:06:16 -0500 Subject: [PATCH 05/16] Update faq.rst Thanks for the feedback! That's a lot clearer. I made the headers bold to ensure they still stood out as clear options if that's okay. Let me know if there are any other recommendations here. I hit this issue -- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=964245 -- while testing for another user and found the helpful guide but misread it a couple of times. Thanks! --- docs/faq.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index 8af404fce..deecfabcf 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -135,18 +135,20 @@ it's helpful to run on the "bleeding edge". To run the latest source: 1. Uninstall beets. If you installed using ``pip``, you can just run ``pip uninstall beets``. -2. Install from source. There are a few easy ways to do this: +2. Install from source. Choose **one** of the following methods: - - **Option 1** - Use ``pip`` to install the latest snapshot tarball: + - **Use ``pip`` to install the latest snapshot tarball:** just type: ``pip install https://github.com/beetbox/beets/tarball/master``. - - **Option 2** - Grab the source using Git: + - **Grab the source using Git:** 1. First clone the repository ``git clone https://github.com/beetbox/beets.git``. 2. Then enter the beets directory ``cd beets`` 3. Finally install ``python setup.py install``. - - **Option 3** - Use ``pip`` to install an "editable" version of beets based on an - automatic source checkout. For example, run: + - **Use ``pip`` to install an "editable" version of beets based on an + automatic source checkout.** + + For example, run: ``pip install -e git+https://github.com/beetbox/beets#egg=beets`` to clone beets and install it, allowing you to modify the source in-place to try out changes. From 013155a9d89df454e4e2ab535489b51513b0f62a Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Fri, 23 Oct 2020 20:33:22 -0400 Subject: [PATCH 06/16] Simplifications to #3778 --- docs/faq.rst | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index deecfabcf..f47233430 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -135,20 +135,15 @@ it's helpful to run on the "bleeding edge". To run the latest source: 1. Uninstall beets. If you installed using ``pip``, you can just run ``pip uninstall beets``. -2. Install from source. Choose **one** of the following methods: +2. Install from source. Choose one of these methods: - - **Use ``pip`` to install the latest snapshot tarball:** - just type: ``pip install https://github.com/beetbox/beets/tarball/master``. - - **Grab the source using Git:** - - 1. First clone the repository ``git clone https://github.com/beetbox/beets.git``. - 2. Then enter the beets directory ``cd beets`` - 3. Finally install ``python setup.py install``. - - - **Use ``pip`` to install an "editable" version of beets based on an - automatic source checkout.** - - For example, run: + - Use ``pip`` to install the latest snapshot tarball. Type: + ``pip install https://github.com/beetbox/beets/tarball/master`` + - Grab the source using git. First, clone the repository: + ``git clone https://github.com/beetbox/beets.git``. + Then, ``cd beets`` and ``python setup.py install``. + - Use ``pip`` to install an "editable" version of beets based on an + automatic source checkout. For example, run ``pip install -e git+https://github.com/beetbox/beets#egg=beets`` to clone beets and install it, allowing you to modify the source in-place to try out changes. From 8e17d445ff3b814d6d3c4fba66efd020539ba5f1 Mon Sep 17 00:00:00 2001 From: Georg Schwitalla Date: Sat, 24 Oct 2020 12:47:59 +0200 Subject: [PATCH 07/16] Added a check if config_out was empty --- beets/ui/commands.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 49c4b4dc6..2962362a1 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1691,8 +1691,10 @@ def config_func(lib, opts, args): # Dump configuration. else: config_out = config.dump(full=opts.defaults, redact=opts.redact) - print_(util.text_string(config_out)) - + if config_out != '{}\n': + print_(util.text_string(config_out)) + else: + print("Empty Configuration") def config_edit(): """Open a program to edit the user configuration. From 9c1b39a96e96faffd030f04f43539f39dc1a8e00 Mon Sep 17 00:00:00 2001 From: Georg Schwitalla Date: Sat, 24 Oct 2020 12:56:37 +0200 Subject: [PATCH 08/16] had a slight typo --- beets/ui/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 2962362a1..5df0b0c4b 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1694,7 +1694,7 @@ def config_func(lib, opts, args): if config_out != '{}\n': print_(util.text_string(config_out)) else: - print("Empty Configuration") + print("Empty configuration") def config_edit(): """Open a program to edit the user configuration. From 3c8afd9a0e3ea684e2b99c4ac03358ced4711f18 Mon Sep 17 00:00:00 2001 From: Georg Schwitalla Date: Sat, 24 Oct 2020 13:07:27 +0200 Subject: [PATCH 09/16] Added the changelog entry --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index e33299fab..c752f204b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -6,6 +6,7 @@ Changelog New features: +* When config is printed with no available configuration a new message is printed. * :doc:`/plugins/chroma`: Update file metadata after generating fingerprints through the `submit` command. * :doc:`/plugins/lastgenre`: Added more heavy metal genres: https://en.wikipedia.org/wiki/Heavy_metal_genres to genres.txt and genres-tree.yaml * :doc:`/plugins/subsonicplaylist`: import playlist from a subsonic server. From e898f4396e1dd762602c659dddce305e6347e08e Mon Sep 17 00:00:00 2001 From: Georg Schwitalla Date: Sat, 24 Oct 2020 13:19:29 +0200 Subject: [PATCH 10/16] forgot the second blank line --- beets/ui/commands.py | 1 + 1 file changed, 1 insertion(+) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 5df0b0c4b..efa6e2e16 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1696,6 +1696,7 @@ def config_func(lib, opts, args): else: print("Empty configuration") + def config_edit(): """Open a program to edit the user configuration. An empty config file is created if no existing config file exists. From d51e44b9e65dd802b607e8a2b40530dab1316549 Mon Sep 17 00:00:00 2001 From: Georg Schwitalla Date: Sat, 24 Oct 2020 13:29:44 +0200 Subject: [PATCH 11/16] Issue #3569 changed the the text from Keep both to keep all --- beets/ui/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 49c4b4dc6..f8c2decab 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -807,7 +807,7 @@ class TerminalImportSession(importer.ImportSession): )) sel = ui.input_options( - (u'Skip new', u'Keep both', u'Remove old', u'Merge all') + (u'Skip new', u'Keep all', u'Remove old', u'Merge all') ) if sel == u's': From e7013f9f6ff1cccbf752c33489686254173ec70d Mon Sep 17 00:00:00 2001 From: Georg Schwitalla Date: Sat, 24 Oct 2020 13:34:23 +0200 Subject: [PATCH 12/16] Added the changelog --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index e33299fab..0de5fda95 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -6,6 +6,7 @@ Changelog New features: +* When importing a duplicate album it ask if it should "Keep all" instead of "Keep both". * :doc:`/plugins/chroma`: Update file metadata after generating fingerprints through the `submit` command. * :doc:`/plugins/lastgenre`: Added more heavy metal genres: https://en.wikipedia.org/wiki/Heavy_metal_genres to genres.txt and genres-tree.yaml * :doc:`/plugins/subsonicplaylist`: import playlist from a subsonic server. From e49ee7c6867227c809ba2cea5f5e05c3b629bc3c Mon Sep 17 00:00:00 2001 From: Sudo-kun Date: Sun, 25 Oct 2020 11:02:12 +0100 Subject: [PATCH 13/16] Removed white-space sensitivity in the if-clause --- beets/ui/commands.py | 2 +- docs/changelog.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index efa6e2e16..f86984350 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1691,7 +1691,7 @@ def config_func(lib, opts, args): # Dump configuration. else: config_out = config.dump(full=opts.defaults, redact=opts.redact) - if config_out != '{}\n': + if config_out.strip() != '{}': print_(util.text_string(config_out)) else: print("Empty configuration") diff --git a/docs/changelog.rst b/docs/changelog.rst index c752f204b..cc86b0292 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,6 +7,7 @@ Changelog New features: * When config is printed with no available configuration a new message is printed. + :bug: `3779` * :doc:`/plugins/chroma`: Update file metadata after generating fingerprints through the `submit` command. * :doc:`/plugins/lastgenre`: Added more heavy metal genres: https://en.wikipedia.org/wiki/Heavy_metal_genres to genres.txt and genres-tree.yaml * :doc:`/plugins/subsonicplaylist`: import playlist from a subsonic server. From 272463aa4a26f0680f721eb2d13be32f3bc223db Mon Sep 17 00:00:00 2001 From: Sudo-kun Date: Sun, 25 Oct 2020 11:06:00 +0100 Subject: [PATCH 14/16] Edited the changelog entry to contain the Issue number --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 0de5fda95..ac7435abc 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,6 +7,7 @@ Changelog New features: * When importing a duplicate album it ask if it should "Keep all" instead of "Keep both". + :bug:`3569` * :doc:`/plugins/chroma`: Update file metadata after generating fingerprints through the `submit` command. * :doc:`/plugins/lastgenre`: Added more heavy metal genres: https://en.wikipedia.org/wiki/Heavy_metal_genres to genres.txt and genres-tree.yaml * :doc:`/plugins/subsonicplaylist`: import playlist from a subsonic server. From 829d08d9b8e800701ac4d9dd26aad6aae128c07c Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 25 Oct 2020 06:55:30 -0400 Subject: [PATCH 15/16] Fix some ReST syntax --- docs/changelog.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index cc86b0292..ea5a19fae 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,7 +7,7 @@ Changelog New features: * When config is printed with no available configuration a new message is printed. - :bug: `3779` + :bug:`3779` * :doc:`/plugins/chroma`: Update file metadata after generating fingerprints through the `submit` command. * :doc:`/plugins/lastgenre`: Added more heavy metal genres: https://en.wikipedia.org/wiki/Heavy_metal_genres to genres.txt and genres-tree.yaml * :doc:`/plugins/subsonicplaylist`: import playlist from a subsonic server. @@ -22,10 +22,10 @@ New features: * :doc:`plugins/fetchart`: Added a new ``high_resolution`` config option to allow downloading of higher resolution iTunes artwork (at the expense of file size). - :bug: `3391` + :bug:`3391` * :doc:`plugins/discogs` now adds two extra fields: `discogs_labelid` and `discogs_artistid` - :bug: `3413` + :bug:`3413` * :doc:`/plugins/export`: Added new ``-f`` (``--format``) flag; which allows for the ability to export in json, jsonlines, csv and xml. Thanks to :user:`austinmm`. From 6e4bb3d4ed25b312a3e7164a8a1684d908442f0c Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 25 Oct 2020 06:57:46 -0400 Subject: [PATCH 16/16] Update docs for #3783 --- docs/guides/tagger.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/tagger.rst b/docs/guides/tagger.rst index 467d605a4..d890f5c08 100644 --- a/docs/guides/tagger.rst +++ b/docs/guides/tagger.rst @@ -234,7 +234,7 @@ If beets finds an album or item in your library that seems to be the same as the one you're importing, you may see a prompt like this:: This album is already in the library! - [S]kip new, Keep both, Remove old, Merge all? + [S]kip new, Keep all, Remove old, Merge all? Beets wants to keep you safe from duplicates, which can be a real pain, so you have four choices in this situation. You can skip importing the new music,