mirror of
https://github.com/beetbox/beets.git
synced 2026-01-08 17:08:12 +01:00
Merge pull request #2521 from tweitzel/master
add --yes argument to play command
This commit is contained in:
commit
78f19db511
4 changed files with 28 additions and 2 deletions
|
|
@ -81,6 +81,11 @@ class PlayPlugin(BeetsPlugin):
|
|||
action='store',
|
||||
help=u'add additional arguments to the command',
|
||||
)
|
||||
play_command.parser.add_option(
|
||||
u'-y', u'--yes',
|
||||
action="store_true",
|
||||
help=u'skip the warning threshold',
|
||||
)
|
||||
play_command.func = self._play_command
|
||||
return [play_command]
|
||||
|
||||
|
|
@ -125,8 +130,8 @@ class PlayPlugin(BeetsPlugin):
|
|||
|
||||
# Check if the selection exceeds configured threshold. If True,
|
||||
# cancel, otherwise proceed with play command.
|
||||
if not self._exceeds_threshold(selection, command_str, open_args,
|
||||
item_type):
|
||||
if opts.yes or not self._exceeds_threshold(
|
||||
selection, command_str, open_args, item_type):
|
||||
play(command_str, selection, paths, open_args, self._log,
|
||||
item_type)
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ New features:
|
|||
:bug:`2366` :bug:`2495`
|
||||
* Importing a release with multiple release events now selects the
|
||||
event based on your :ref:`preferred` countries. :bug:`2501`
|
||||
* :doc:`/plugins/play`: A new ``-y`` or ``--yes`` parameter lets you skip
|
||||
the warning message if you enqueue more items than the warning threshold
|
||||
usually allows.
|
||||
|
||||
Fixes:
|
||||
|
||||
|
|
|
|||
|
|
@ -95,6 +95,10 @@ example::
|
|||
indicates that you need to insert extra arguments before specifying the
|
||||
playlist.
|
||||
|
||||
The ``--yes`` (or ``-y``) flag to the ``play`` command will skip the warning
|
||||
message if you choose to play more items than the **warning_threshold**
|
||||
value usually allows.
|
||||
|
||||
Note on the Leakage of the Generated Playlists
|
||||
----------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,20 @@ class PlayPluginTest(unittest.TestCase, TestHelper):
|
|||
|
||||
open_mock.assert_not_called()
|
||||
|
||||
def test_skip_warning_threshold_bypass(self, open_mock):
|
||||
self.config['play']['warning_threshold'] = 1
|
||||
self.other_item = self.add_item(title='another NiceTitle')
|
||||
|
||||
expected_playlist = u'{0}\n{1}'.format(
|
||||
self.item.path.decode('utf-8'),
|
||||
self.other_item.path.decode('utf-8'))
|
||||
|
||||
with control_stdin("a"):
|
||||
self.run_and_assert(
|
||||
open_mock,
|
||||
[u'-y', u'NiceTitle'],
|
||||
expected_playlist=expected_playlist)
|
||||
|
||||
def test_command_failed(self, open_mock):
|
||||
open_mock.side_effect = OSError(u"some reason")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue