mirror of
https://github.com/beetbox/beets.git
synced 2025-12-27 11:02:43 +01:00
Safer defaults on confirmation prompts.
Remove default option and require selection on confirmation prompts for: - Partial matches, if `import: confirm_partial` setting is "yes". - Matches that are below the medium recommendation threshold, but above the gap threshold. - Matches that have no recommendation. - Matches other than the best and auto-suggested match.
This commit is contained in:
parent
666b9848de
commit
e923f673cb
3 changed files with 12 additions and 3 deletions
|
|
@ -25,7 +25,8 @@ from beets.util import sorted_walk, ancestry, displayable_path
|
|||
from .hooks import AlbumInfo, TrackInfo, AlbumMatch, TrackMatch
|
||||
from .match import AutotagError
|
||||
from .match import tag_item, tag_album
|
||||
from .match import RECOMMEND_STRONG, RECOMMEND_MEDIUM, RECOMMEND_NONE
|
||||
from .match import \
|
||||
RECOMMEND_STRONG, RECOMMEND_MEDIUM, RECOMMEND_LOW, RECOMMEND_NONE
|
||||
|
||||
# Global logger.
|
||||
log = logging.getLogger('beets')
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ SD_REPLACE = [
|
|||
# Recommendation constants.
|
||||
RECOMMEND_STRONG = 'RECOMMEND_STRONG'
|
||||
RECOMMEND_MEDIUM = 'RECOMMEND_MEDIUM'
|
||||
RECOMMEND_LOW = 'RECOMMEND_LOW'
|
||||
RECOMMEND_NONE = 'RECOMMEND_NONE'
|
||||
|
||||
# Artist signals that indicate "various artists". These are used at the
|
||||
|
|
@ -348,7 +349,7 @@ def recommendation(results):
|
|||
elif results[1].distance - min_dist >= \
|
||||
config['match']['rec_gap_thresh'].as_number():
|
||||
# Gap between first two candidates is large.
|
||||
rec = RECOMMEND_MEDIUM
|
||||
rec = RECOMMEND_LOW
|
||||
else:
|
||||
# No conclusion.
|
||||
rec = RECOMMEND_NONE
|
||||
|
|
|
|||
|
|
@ -323,6 +323,7 @@ def choose_candidate(candidates, singleton, rec, cur_artist=None,
|
|||
bypass_candidates = True
|
||||
|
||||
while True:
|
||||
require = rec in (autotag.RECOMMEND_NONE, autotag.RECOMMEND_LOW)
|
||||
# Display and choose from candidates.
|
||||
if not bypass_candidates:
|
||||
# Display list of candidates.
|
||||
|
|
@ -391,6 +392,9 @@ def choose_candidate(candidates, singleton, rec, cur_artist=None,
|
|||
match = candidates[sel - 1]
|
||||
else:
|
||||
match = candidates[sel - 1]
|
||||
# Require selection (no default).
|
||||
if sel != 1:
|
||||
require = True
|
||||
bypass_candidates = False
|
||||
|
||||
# Show what we're about to do.
|
||||
|
|
@ -410,7 +414,10 @@ def choose_candidate(candidates, singleton, rec, cur_artist=None,
|
|||
else:
|
||||
opts = ('Apply', 'More candidates', 'Skip', 'Use as-is',
|
||||
'as Tracks', 'Enter search', 'enter Id', 'aBort')
|
||||
sel = ui.input_options(opts)
|
||||
if config['import']['confirm_partial'].get(bool) and \
|
||||
match.extra_items or match.extra_tracks:
|
||||
require = True
|
||||
sel = ui.input_options(opts, require=require)
|
||||
if sel == 'a':
|
||||
return match
|
||||
elif sel == 'm':
|
||||
|
|
|
|||
Loading…
Reference in a new issue