Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f938843
Moved commands.py into commands/__init__.py for easier refactoring.
semohr Oct 21, 2025
d116d54
Moved `version` command into its own file.
semohr Oct 21, 2025
8ce1d27
Moved `help` command into its own file.
semohr Oct 21, 2025
01f389e
Moved `stats` command into its own file.
semohr Oct 21, 2025
17efb8b
Moved `list` command into its own file.
semohr Oct 21, 2025
df4a3c8
Moved `config` command into its own file.
semohr Oct 21, 2025
ce088e4
Moved `completion` command into its own file.
semohr Oct 21, 2025
bb246a3
Moved utility functions into own file.
semohr Oct 21, 2025
418c001
Moved `move` command into its own file.
semohr Oct 21, 2025
1b20c6d
Moved `fields` command into its own file.
semohr Oct 21, 2025
aee8bde
Moved `update` command into its own file.
semohr Oct 21, 2025
0b5f899
Moved `remove` command into its own file.
semohr Oct 21, 2025
adb2fea
Moved `modify` command into its own file.
semohr Oct 21, 2025
4ba4f92
Moved `write` command into its own file.
semohr Oct 21, 2025
df2be2c
Moved `import` command into its own folder, more commit following.
semohr Oct 21, 2025
6980908
Moved ImportSession related functions into `importer/session.py`.
semohr Oct 21, 2025
e5afb85
Moved import display display related functions into `importer/display…
semohr Oct 21, 2025
cd308c9
Renamed import to import_ as a module cant be named import.
semohr Oct 21, 2025
e273eba
Fixed imports in init file.
semohr Oct 21, 2025
5d0244e
Moved tests related to ui into own folder.
semohr Oct 21, 2025
3cd0448
Moved 'modify' command tests into own file.
semohr Oct 21, 2025
03dbf20
Moved 'write' command tests into own file.
semohr Oct 21, 2025
17017be
Moved 'fields' command tests into own file.
semohr Oct 21, 2025
bc46efa
Moved 'do_query' test into own file.
semohr Oct 21, 2025
d8bb9ea
Moved 'list' command tests into own file.
semohr Oct 21, 2025
464f85b
Moved 'remove' command tests into own file.
semohr Oct 21, 2025
a2ffeb3
Moved 'move' command tests into own file.
semohr Oct 21, 2025
701c190
Moved 'update' command tests into own file.
semohr Oct 21, 2025
f02afbc
Moved 'show_change' test into test_import file.
semohr Oct 21, 2025
14a1c1d
Moved 'summarize_items' test into test_import file.
semohr Oct 21, 2025
278580f
Moved 'completion' command test into own file.
semohr Oct 21, 2025
94c74ef
Added deprecation for TerminalImportSession and PromptChoice.
semohr Oct 21, 2025
e3803a1
Run linter
semohr Oct 21, 2025
e7fee04
typo
semohr Oct 21, 2025
b25bc8d
Wrong import for some reason
semohr Oct 21, 2025
4dd9402
refactor ui
amogus07 Oct 24, 2025
4093ac1
add type annotations in `ui/commands/import`
amogus07 Oct 26, 2025
73e6923
fix formatting
amogus07 Oct 26, 2025
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
20 changes: 14 additions & 6 deletions beets/importer/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import os
import time
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING

from beets import config, dbcore, library, logging, plugins, util
from beets.importer.tasks import Action
Expand All @@ -25,6 +25,10 @@
from .state import ImportState

if TYPE_CHECKING:
from typing import Literal, Sequence

from beets.autotag import AlbumMatch, TrackMatch
from beets.importer.tasks import SingletonImportTask
from beets.util import PathBytes

from .tasks import ImportTask
Expand Down Expand Up @@ -60,7 +64,7 @@ def __init__(
lib: library.Library,
loghandler: logging.Handler | None,
paths: Sequence[PathBytes] | None,
query: dbcore.Query | None,
query: dbcore.Query | str | list[str] | tuple[str] | None,
):
"""Create a session.

Expand Down Expand Up @@ -173,16 +177,20 @@ def log_choice(self, task: ImportTask, duplicate=False):
elif task.choice_flag is Action.SKIP:
self.tag_log("skip", paths)

def should_resume(self, path: PathBytes):
def should_resume(self, path: PathBytes) -> bool:
raise NotImplementedError

def choose_match(self, task: ImportTask):
def choose_match(
self, task: ImportTask
) -> Literal[Action.ASIS, Action.SKIP] | AlbumMatch | TrackMatch:
raise NotImplementedError

def resolve_duplicate(self, task: ImportTask, found_duplicates):
def resolve_duplicate(self, task: ImportTask, found_duplicates) -> None:
raise NotImplementedError

def choose_item(self, task: ImportTask):
def choose_item(
self, task: SingletonImportTask
) -> Literal[Action.ASIS, Action.SKIP] | AlbumMatch | TrackMatch:
raise NotImplementedError

def run(self):
Expand Down
6 changes: 5 additions & 1 deletion beets/test/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ def item(lib=None, **kwargs):

# Dummy import session.
def import_session(lib=None, loghandler=None, paths=[], query=[], cli=False):
cls = commands.TerminalImportSession if cli else importer.ImportSession
cls = (
commands.import_.session.TerminalImportSession
if cli
else importer.ImportSession
)
return cls(lib, loghandler, paths, query)


Expand Down
2 changes: 1 addition & 1 deletion beets/test/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
from beets.importer import ImportSession
from beets.library import Item, Library
from beets.test import _common
from beets.ui.commands import TerminalImportSession
from beets.ui.commands.import_.session import TerminalImportSession
from beets.util import (
MoveOperation,
bytestring_path,
Expand Down
Loading