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

Added a terminal bell if interaction from the user is required, according to this issue: https://github.com/beetbox/beets/issues/2366 #2495

Merged
merged 7 commits into from
Mar 28, 2017

Conversation

SpirosChadoulos
Copy link
Contributor

@SpirosChadoulos SpirosChadoulos commented Mar 26, 2017

Fixes #2366.

@mention-bot
Copy link

@SpirosChadoulos, thanks for your PR! By analyzing the history of the files in this pull request, we identified @sampsyo, @pkess and @geigerzaehler to be potential reviewers.

Copy link
Member

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this started, and congratulations on your first beets PR!

Even though this is a small change, I have a couple of requests:

  • This method isn't quite the right place to emit the bell. This method just generates the list of choices to emit; it doesn't actually display the prompt. The bell should definitely be printed right next to the code that actually emits the prompt. Namely, this happens with a call to ui.input_options in the choose_candidate function in the same file.
  • Please put this new functionality behind a configuration option. (I, personally, don't want a bell ringing on every prompt.)

@@ -823,6 +823,8 @@ def _get_choices(self, task):
Returns a list of `PromptChoice`s.
"""
# Standard, built-in choices.
#Bell ring to alert the user that he has to interfere with the cmd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Travis report: https://travis-ci.org/beetbox/beets/jobs/215295136#L885

is telling you to put a space after the # character in your comments. In addition, please use complete sentences in comments that end with periods—and there's no need to use abbreviations like "cmd".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I'll work on it. Thank you.

@SpirosChadoulos
Copy link
Contributor Author

I put the command in the right place and I fixed my comment. Could you give me some instractions on how to put this new functionality behind a configuration option?

@sampsyo
Copy link
Member

sampsyo commented Mar 26, 2017

Sure! You might try looking around how other boolean operations are implemented. For example, this conditional implements the import.quiet config option. You'll want to add something like:

if config['import']['bell']:
    ...

and then add a default value to config_default.yaml. You'll also need to add an entry to the documentation, in config.rst.

@SpirosChadoulos
Copy link
Contributor Author

SpirosChadoulos commented Mar 27, 2017

@sampsyo I made tha changes you requested..Is my branch ready to be marged to the main beets repo?

Copy link
Member

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I requested a few small changes above. After that, we'll also need an entry in the changelog describing what's new. With all that in place, this will be ready to merge! ✨

@@ -25,6 +25,7 @@ import:
pretend: false
search_ids: []
duplicate_action: ask
bell: yes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's have this default to "no" (to avoid surprising people who upgrade).

bell
~~~~~~~~~~~~~~~~

Whether the importer ui should ring a bell when user interaction is needed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested simpler wording:

Ring the terminal bell to get your attention when the importer needs your input.


Whether the importer ui should ring a bell when user interaction is needed.

Default: ``yes``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(If the default is changed, this needs changing too.)

@@ -613,6 +613,9 @@ def choose_candidate(candidates, singleton, rec, cur_artist=None,
})
if default is None:
require = True
# Bell ring when user interaction is needed.
if config['import']['bell']:
print('\a')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to add an extra newline, in addition to ringing the bell. Perhaps you mean print('\a', end='')?

Also, all output from the commands needs to go through our custom ui.print_ function instead of the built-in print for dumb encoding reasons. Could you please use that function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get the changelog describing part..What sould I do?

@SpirosChadoulos
Copy link
Contributor Author

@sampsyo I did the new changes you told me. Is everything okay?

Copy link
Member

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thank you again! ✨ I added a changelog entry.

@sampsyo sampsyo merged commit ae42ea6 into beetbox:master Mar 28, 2017
@SpirosChadoulos
Copy link
Contributor Author

@sampsyo Thanks a lot. Why next to the pull request there is a red x?

@sampsyo
Copy link
Member

sampsyo commented Mar 28, 2017

Hmm… which "x" are you referring to? If you mean the one next to the commit hash for the latest commit, it looks like that's because the AppVeyor build was canceled when I merged the PR. (You can hover over the "x" to see the details.)

@SpirosChadoulos
Copy link
Contributor Author

Isn't it a problem that AppVeyor didnt' complete?

@sampsyo
Copy link
Member

sampsyo commented Mar 28, 2017

In this case, no. I merged the PR before the build had a chance to complete (because I already new it would succeed); AppVeyor then canceled the build. No harm, no foul. (If you like, you can see on the main branch commit history that things are still passing.)

@SpirosChadoulos
Copy link
Contributor Author

Okay thanks a lot.

sampsyo added a commit that referenced this pull request Apr 30, 2017
antlarr pushed a commit to antlarr/beets that referenced this pull request May 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants