Skip to content

Commit

Permalink
play: make the many files warning configurable
Browse files Browse the repository at this point in the history
The warning_treshold key in the play configuration defines the
minimum number of file before a warning is issued (default 100).
A zero value means no warning is ever issued.

This is the first commit for this feature, and this should fully
implement it.
  • Loading branch information
nath@home committed Sep 3, 2015
1 parent bc137b1 commit ff4fda1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion beetsplug/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(self):
'use_folders': False,
'relative_to': None,
'raw': False,
'warning_treshold': 100,
})

def commands(self):
Expand All @@ -64,6 +65,7 @@ def play_music(self, lib, opts, args):
use_folders = config['play']['use_folders'].get(bool)
relative_to = config['play']['relative_to'].get()
raw = config['play']['raw'].get(bool)
warning_treshold = config['play']['warning_treshold'].get(int)
if relative_to:
relative_to = util.normpath(relative_to)

Expand Down Expand Up @@ -105,7 +107,7 @@ def play_music(self, lib, opts, args):
return

# Warn user before playing any huge playlists.
if len(selection) > 100:
if warning_treshold and len(selection) > warning_treshold:
ui.print_(ui.colorize(
'text_warning',
'You are about to queue {0} {1}.'.format(len(selection),
Expand Down

0 comments on commit ff4fda1

Please sign in to comment.