|
41 | 41 | import optparse |
42 | 42 | from collections.abc import Callable |
43 | 43 |
|
| 44 | + from beets.importer import ImportSession, ImportTask |
44 | 45 | from beets.library import LibModel |
45 | 46 |
|
46 | 47 | LASTFM = pylast.LastFMNetwork(api_key=plugins.LASTFM_KEY) |
@@ -178,14 +179,13 @@ def sources(self) -> tuple[str, ...]: |
178 | 179 | """A tuple of allowed genre sources. May contain 'track', |
179 | 180 | 'album', or 'artist.' |
180 | 181 | """ |
181 | | - source = self.config["source"].as_choice(("track", "album", "artist")) |
182 | | - if source == "track": |
183 | | - return "track", "album", "artist" |
184 | | - if source == "album": |
185 | | - return "album", "artist" |
186 | | - if source == "artist": |
187 | | - return ("artist",) |
188 | | - return tuple() |
| 182 | + return self.config["source"].as_choice( |
| 183 | + { |
| 184 | + "track": ("track", "album", "artist"), |
| 185 | + "album": ("album", "artist"), |
| 186 | + "artist": ("artist",), |
| 187 | + } |
| 188 | + ) |
189 | 189 |
|
190 | 190 | # More canonicalization and general helpers. |
191 | 191 |
|
@@ -603,10 +603,8 @@ def lastgenre_func( |
603 | 603 | lastgenre_cmd.func = lastgenre_func |
604 | 604 | return [lastgenre_cmd] |
605 | 605 |
|
606 | | - def imported( |
607 | | - self, session: library.Session, task: library.ImportTask |
608 | | - ) -> None: |
609 | | - self._process(task.album if task.is_album else task.item, write=False) |
| 606 | + def imported(self, _: ImportSession, task: ImportTask) -> None: |
| 607 | + self._process(task.album if task.is_album else task.item, write=False) # type: ignore[attr-defined] |
610 | 608 |
|
611 | 609 | def _tags_for( |
612 | 610 | self, |
|
0 commit comments