From 2fbc7f0e70ed458708c8c5b5425d1f35ddf4ee9b Mon Sep 17 00:00:00 2001 From: SpirosChadoulos Date: Sun, 26 Mar 2017 13:40:40 +0300 Subject: [PATCH 1/7] Added a terminal bell if interaction from the user is required --- beets/ui/commands.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 8a07f6147..029a6d8f3 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -823,6 +823,8 @@ class TerminalImportSession(importer.ImportSession): Returns a list of `PromptChoice`s. """ # Standard, built-in choices. + #Bell ring to alert the user that he has to interfere with the cmd + print('\a') choices = [ PromptChoice(u's', u'Skip', lambda s, t: importer.action.SKIP), From 5128b9567c052850e68a76f941d0bd0ae0d127b6 Mon Sep 17 00:00:00 2001 From: SpirosChadoulos Date: Mon, 27 Mar 2017 01:02:18 +0300 Subject: [PATCH 2/7] Added bell when user interaction is needed --- beets/ui/commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 029a6d8f3..9c6683bfe 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -613,6 +613,8 @@ def choose_candidate(candidates, singleton, rec, cur_artist=None, }) if default is None: require = True + # Bell ring when interaction with the user is needed. + print('\a') sel = ui.input_options((u'Apply', u'More candidates') + choice_opts, require=require, default=default) if sel == u'a': @@ -823,8 +825,6 @@ class TerminalImportSession(importer.ImportSession): Returns a list of `PromptChoice`s. """ # Standard, built-in choices. - #Bell ring to alert the user that he has to interfere with the cmd - print('\a') choices = [ PromptChoice(u's', u'Skip', lambda s, t: importer.action.SKIP), From 28c423b527abf7c14c78c6bf7e3e0e1537da9b66 Mon Sep 17 00:00:00 2001 From: SpirosChadoulos Date: Mon, 27 Mar 2017 01:06:30 +0300 Subject: [PATCH 3/7] Added bell when user interaction is needed --- 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 9c6683bfe..a5b50a704 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -613,7 +613,7 @@ def choose_candidate(candidates, singleton, rec, cur_artist=None, }) if default is None: require = True - # Bell ring when interaction with the user is needed. + # Bell ring when user interaction is needed. print('\a') sel = ui.input_options((u'Apply', u'More candidates') + choice_opts, require=require, default=default) From c605a918c8168650cbc3a9a6c3a92629bce2a8ec Mon Sep 17 00:00:00 2001 From: SpirosChadoulos Date: Mon, 27 Mar 2017 20:49:28 +0300 Subject: [PATCH 4/7] Added an if statement that allows the bell ring according to the user's configuration. --- beets/config_default.yaml | 1 + beets/ui/commands.py | 3 ++- docs/reference/config.rst | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/beets/config_default.yaml b/beets/config_default.yaml index 3b0377966..1c6cb8b33 100644 --- a/beets/config_default.yaml +++ b/beets/config_default.yaml @@ -25,6 +25,7 @@ import: pretend: false search_ids: [] duplicate_action: ask + bell: yes clutter: ["Thumbs.DB", ".DS_Store"] ignore: [".*", "*~", "System Volume Information", "lost+found"] diff --git a/beets/ui/commands.py b/beets/ui/commands.py index a5b50a704..d925be008 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -614,7 +614,8 @@ def choose_candidate(candidates, singleton, rec, cur_artist=None, if default is None: require = True # Bell ring when user interaction is needed. - print('\a') + if config['import']['bell']: + print('\a') sel = ui.input_options((u'Apply', u'More candidates') + choice_opts, require=require, default=default) if sel == u'a': diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 094462d2f..84e9bc308 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -576,6 +576,14 @@ skipped; "keep" means keep both old and new items; "remove" means remove old item; "ask" means the user should be prompted for the action each time. The default is ``ask``. +.. _bell: + +bell +~~~~~~~~~~~~~~~~ + +Whether the importer ui should ring a bell when user interaction is needed. + +Default: ``yes``. .. _musicbrainz-config: From 218968235ef75177e31fd16105289256c2c64317 Mon Sep 17 00:00:00 2001 From: SpirosChadoulos Date: Tue, 28 Mar 2017 01:09:14 +0300 Subject: [PATCH 5/7] small changes for the bell issue --- beets/config_default.yaml | 2 +- beets/ui/commands.py | 2 +- docs/reference/config.rst | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/beets/config_default.yaml b/beets/config_default.yaml index 1c6cb8b33..45f13efef 100644 --- a/beets/config_default.yaml +++ b/beets/config_default.yaml @@ -25,7 +25,7 @@ import: pretend: false search_ids: [] duplicate_action: ask - bell: yes + bell: no clutter: ["Thumbs.DB", ".DS_Store"] ignore: [".*", "*~", "System Volume Information", "lost+found"] diff --git a/beets/ui/commands.py b/beets/ui/commands.py index d925be008..06ab6f0a5 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -615,7 +615,7 @@ def choose_candidate(candidates, singleton, rec, cur_artist=None, require = True # Bell ring when user interaction is needed. if config['import']['bell']: - print('\a') + ui.print_('\a', end='') sel = ui.input_options((u'Apply', u'More candidates') + choice_opts, require=require, default=default) if sel == u'a': diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 84e9bc308..6a267d0d6 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -581,9 +581,9 @@ The default is ``ask``. bell ~~~~~~~~~~~~~~~~ -Whether the importer ui should ring a bell when user interaction is needed. +Ring the terminal bell to get your attention when the importer needs your input. -Default: ``yes``. +Default: ``no``. .. _musicbrainz-config: From 70ef6e7df8ed2a5d27392459dde326c128295ce2 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Mon, 27 Mar 2017 23:23:23 -0400 Subject: [PATCH 6/7] Fix heading underline length --- docs/reference/config.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 6a267d0d6..7fb7c96c4 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -579,7 +579,7 @@ The default is ``ask``. .. _bell: bell -~~~~~~~~~~~~~~~~ +~~~~ Ring the terminal bell to get your attention when the importer needs your input. From ffdeb1e20317f2003de999ed6c4538c999bf293a Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Mon, 27 Mar 2017 23:26:22 -0400 Subject: [PATCH 7/7] Changelog/thanks for #2495 --- docs/changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 3a5272a91..013e57846 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -44,6 +44,9 @@ New features: you have in your library. Thanks to :user:`qlyoung`. :bug:`2481` * :doc:`/plugins/web` : Add new `reverse_proxy` config option to allow serving the web plugins under a reverse proxy. +* A new :ref:`bell` configuration option under the ``import`` section enables + a terminal bell when input is required. Thanks to :user:`SpirosChadoulos`. + :bug:`2366` :bug:`2495` Fixes: