Refactor ImportTask
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
Following a discussion with @geigerzaehler regarding #690:
Some refactoring in the importer that delegates some more responsibility to the `ImportTask` class would help simplify the code. As an example, this block from `apply_choices`:
```
if task.is_album:
autotag.apply_metadata(
task.match.info, task.match.mapping
)
else:
autotag.apply_item_metadata(task.item, task.match.info)
```
could be wrapped up in a `task.apply()` call.
We could also consider dividing an `AlbumImportTask` class from a `SingletonImportTask`. Then `apply()` could be overridden to do the right thing for the kind of import.
If all goes well, we could eventually consider removing the distinction between album and singleton pipeline stages. The pipeline stages would just make calls to the appropriate ImportTask instance, which would handle the two kinds of imports differently. That would make, for example, the "as Tracks" interactive option more elegant since it could simply break the current `AlbumImportTask` into several `SingletonImportTask`s and send them down the pipeline.
Contributor guide
Assessment
This issue has not been assessed yet.