Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/beets_flask/importer/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class Progress(Enum):

# ImportSession
OFFERING_MATCHES = 30
WAITING_FOR_USER_SELECTION = 31
MATCH_THRESHOLD = 32
MATCH_THRESHOLD = 31
WAITING_FOR_USER_SELECTION = 32
EARLY_IMPORTING = 33
IMPORTING = 34
MANIPULATING_FILES = 35
Expand Down
7 changes: 6 additions & 1 deletion backend/beets_flask/importer/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ def __init__(
@property
def stages(self):
stages = super().stages
stages.insert(after="user_query", stage=match_threshold(self))
stages.insert(before="user_query", stage=match_threshold(self))
return stages

def match_threshold(self, task: importer.ImportTask):
Expand All @@ -850,6 +850,11 @@ def match_threshold(self, task: importer.ImportTask):
or raise an exception.

Currently raising, as we do not have a dedicated progress for "not imported".

FIXME: Instead of adding a whole new stage, with progress and a session function,
we could simply extend the choose_match function. It's defined for the normal
import session, and gets called early in user_query.
(see #78)
"""
try:
task_state = self.state.get_task_state_for_task(task)
Expand Down
2 changes: 2 additions & 0 deletions backend/tests/integration/test_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ async def test_import_auto_accept(self, db_session: Session, path: Path):
assert len(self.statuses) == 4
assert self.statuses[2].status == FolderStatus.IMPORTING
assert self.statuses[3].status == FolderStatus.FAILED
assert len(self.beets_lib.albums()) == 0

await run_import_auto(
"obsolete_hash_import_auto",
Expand All @@ -523,6 +524,7 @@ async def test_import_auto_accept(self, db_session: Session, path: Path):
assert len(self.statuses) == 6
assert self.statuses[4].status == FolderStatus.IMPORTING
assert self.statuses[5].status == FolderStatus.IMPORTED
assert len(self.beets_lib.albums()) == 1


class TestChooseCandidatesSingleTask(
Expand Down
Loading