mirror of
https://github.com/beetbox/beets.git
synced 2026-02-09 00:41:57 +01:00
Remove unnecessary method on ImportTask
This commit is contained in:
parent
dc3c4883dc
commit
79d1203541
2 changed files with 29 additions and 15 deletions
|
|
@ -278,10 +278,8 @@ class ImportSession(object):
|
|||
# Split directory tasks into one task for each album
|
||||
stages += [group_albums(self)]
|
||||
if self.config['autotag']:
|
||||
# Only look up and query the user when autotagging.
|
||||
|
||||
# FIXME We should also resolve duplicates when not
|
||||
# autotagging.
|
||||
# autotagging. This is currently handled in `user_query`
|
||||
stages += [lookup_candidates(self), user_query(self)]
|
||||
else:
|
||||
stages += [import_asis(self)]
|
||||
|
|
@ -382,18 +380,15 @@ class ImportTask(object):
|
|||
self.paths = paths
|
||||
self.items = items
|
||||
self.choice_flag = None
|
||||
|
||||
self.cur_album = None
|
||||
self.cur_artist = None
|
||||
self.candidates = []
|
||||
self.rec = None
|
||||
# TODO remove this eventually
|
||||
self.should_remove_duplicates = False
|
||||
self.is_album = True
|
||||
|
||||
def set_null_candidates(self):
|
||||
"""Set the candidates to indicate no album match was found.
|
||||
"""
|
||||
self.cur_artist = None
|
||||
self.cur_album = None
|
||||
self.candidates = None
|
||||
self.rec = None
|
||||
|
||||
def set_choice(self, choice):
|
||||
"""Given an AlbumMatch or TrackMatch object or an action constant,
|
||||
indicates that an action has been selected for this task.
|
||||
|
|
@ -1173,9 +1168,6 @@ def import_asis(session, task):
|
|||
return
|
||||
|
||||
log.info(displayable_path(task.paths))
|
||||
|
||||
# Behave as if ASIS were selected.
|
||||
task.set_null_candidates()
|
||||
task.set_choice(action.ASIS)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -888,7 +888,6 @@ class InferAlbumDataTest(_common.TestCase):
|
|||
|
||||
self.task = importer.ImportTask(paths=['a path'], toppath='top path',
|
||||
items=self.items)
|
||||
self.task.set_null_candidates()
|
||||
|
||||
def test_asis_homogenous_single_artist(self):
|
||||
self.task.set_choice(importer.action.ASIS)
|
||||
|
|
@ -1017,6 +1016,29 @@ class ImportDuplicateAlbumTest(unittest.TestCase, TestHelper):
|
|||
item = self.lib.items().get()
|
||||
self.assertEqual(item.title, u'new title')
|
||||
|
||||
def test_no_autotag_keeps_duplicate_album(self):
|
||||
config['import']['autotag'] = False
|
||||
item = self.lib.items().get()
|
||||
self.assertEqual(item.title, u't\xeftle 0')
|
||||
self.assertTrue(os.path.isfile(item.path))
|
||||
|
||||
# Imported item has the same artist and album as the one in the
|
||||
# library.
|
||||
import_file = os.path.join(self.importer.paths[0],
|
||||
'album 0', 'track 0.mp3')
|
||||
import_file = MediaFile(import_file)
|
||||
import_file.artist = item['artist']
|
||||
import_file.albumartist = item['artist']
|
||||
import_file.album = item['album']
|
||||
import_file.title = 'new title'
|
||||
|
||||
self.importer.default_resolution = self.importer.Resolution.REMOVE
|
||||
self.importer.run()
|
||||
|
||||
self.assertTrue(os.path.isfile(item.path))
|
||||
self.assertEqual(len(self.lib.albums()), 2)
|
||||
self.assertEqual(len(self.lib.items()), 2)
|
||||
|
||||
def test_keep_duplicate_album(self):
|
||||
self.importer.default_resolution = self.importer.Resolution.KEEPBOTH
|
||||
self.importer.run()
|
||||
|
|
|
|||
Loading…
Reference in a new issue