mirror of
https://github.com/beetbox/beets.git
synced 2026-02-10 09:25:42 +01:00
rename ImportTask.path to paths (#89)
This commit is contained in:
parent
33c24235da
commit
99ed9e03de
4 changed files with 15 additions and 15 deletions
|
|
@ -271,7 +271,7 @@ class ImportSession(object):
|
|||
``duplicate``, then this is a secondary choice after a duplicate was
|
||||
detected and a decision was made.
|
||||
"""
|
||||
paths = task.path if task.is_album else [task.item.path]
|
||||
paths = task.paths if task.is_album else [task.item.path]
|
||||
if duplicate:
|
||||
# Duplicate: log all three choices (skip, keep both, and trump).
|
||||
if task.remove_duplicates:
|
||||
|
|
@ -347,9 +347,9 @@ class ImportTask(object):
|
|||
"""Represents a single set of items to be imported along with its
|
||||
intermediate state. May represent an album or a single item.
|
||||
"""
|
||||
def __init__(self, toppath=None, path=None, items=None):
|
||||
def __init__(self, toppath=None, paths=None, items=None):
|
||||
self.toppath = toppath
|
||||
self.path = path
|
||||
self.paths = paths
|
||||
self.items = items
|
||||
self.sentinel = False
|
||||
self.remove_duplicates = False
|
||||
|
|
@ -365,12 +365,12 @@ class ImportTask(object):
|
|||
return obj
|
||||
|
||||
@classmethod
|
||||
def progress_sentinel(cls, toppath, path):
|
||||
def progress_sentinel(cls, toppath, paths):
|
||||
"""Create a task indicating that a single directory in a larger
|
||||
import has finished. This is only required for singleton
|
||||
imports; progress is implied for album imports.
|
||||
"""
|
||||
obj = cls(toppath, path)
|
||||
obj = cls(toppath, paths)
|
||||
obj.sentinel = True
|
||||
return obj
|
||||
|
||||
|
|
@ -431,19 +431,19 @@ class ImportTask(object):
|
|||
"""Updates the progress state to indicate that this album has
|
||||
finished.
|
||||
"""
|
||||
if self.sentinel and self.path is None:
|
||||
if self.sentinel and self.paths is None:
|
||||
# "Done" sentinel.
|
||||
progress_set(self.toppath, None)
|
||||
elif self.sentinel or self.is_album:
|
||||
# "Directory progress" sentinel for singletons or a real
|
||||
# album task, which implies the same.
|
||||
progress_set(self.toppath, self.path)
|
||||
progress_set(self.toppath, self.paths)
|
||||
|
||||
def save_history(self):
|
||||
"""Save the directory in the history for incremental imports.
|
||||
"""
|
||||
if self.sentinel or self.is_album:
|
||||
history_add(self.path)
|
||||
history_add(self.paths)
|
||||
|
||||
|
||||
# Logical decisions.
|
||||
|
|
@ -629,7 +629,7 @@ def initial_lookup(session):
|
|||
|
||||
plugins.send('import_task_start', session=session, task=task)
|
||||
|
||||
log.debug('Looking up: %s' % displayable_path(task.path))
|
||||
log.debug('Looking up: %s' % displayable_path(task.paths))
|
||||
try:
|
||||
task.set_candidates(*autotag.tag_album(task.items,
|
||||
config['import']['timid']))
|
||||
|
|
@ -662,7 +662,7 @@ def user_query(session):
|
|||
def emitter():
|
||||
for item in task.items:
|
||||
yield ImportTask.item_task(item)
|
||||
yield ImportTask.progress_sentinel(task.toppath, task.path)
|
||||
yield ImportTask.progress_sentinel(task.toppath, task.paths)
|
||||
def collector():
|
||||
while True:
|
||||
item_task = yield
|
||||
|
|
@ -695,7 +695,7 @@ def show_progress(session):
|
|||
if task.sentinel:
|
||||
continue
|
||||
|
||||
log.info(displayable_path(task.path))
|
||||
log.info(displayable_path(task.paths))
|
||||
|
||||
# Behave as if ASIS were selected.
|
||||
task.set_null_candidates()
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ class TerminalImportSession(importer.ImportSession):
|
|||
"""
|
||||
# Show what we're tagging.
|
||||
print_()
|
||||
print_(displayable_path(task.path, u'\n'))
|
||||
print_(displayable_path(task.paths, u'\n'))
|
||||
|
||||
# Take immediate action if appropriate.
|
||||
action = _summary_judment(task.rec)
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ class FetchArtPlugin(BeetsPlugin):
|
|||
return
|
||||
|
||||
album = session.lib.get_album(task.album_id)
|
||||
path = art_for_album(album, task.path, self.maxwidth, local)
|
||||
path = art_for_album(album, task.paths, self.maxwidth, local)
|
||||
|
||||
if path:
|
||||
self.art_paths[task] = path
|
||||
|
|
|
|||
|
|
@ -582,7 +582,7 @@ class InferAlbumDataTest(_common.TestCase):
|
|||
i1.mb_albumartistid = i2.mb_albumartistid = i3.mb_albumartistid = ''
|
||||
self.items = [i1, i2, i3]
|
||||
|
||||
self.task = importer.ImportTask(path='a path', toppath='top path',
|
||||
self.task = importer.ImportTask(paths=['a path'], toppath='top path',
|
||||
items=self.items)
|
||||
self.task.set_null_candidates()
|
||||
|
||||
|
|
@ -677,7 +677,7 @@ class DuplicateCheckTest(_common.TestCase):
|
|||
artist = artist or item.albumartist
|
||||
album = album or item.album
|
||||
|
||||
task = importer.ImportTask(path='a path', toppath='top path',
|
||||
task = importer.ImportTask(paths=['a path'], toppath='top path',
|
||||
items=[item])
|
||||
task.set_candidates(artist, album, None, None)
|
||||
if asis:
|
||||
|
|
|
|||
Loading…
Reference in a new issue