Import refactor

As initiated in #704, this PR refactors some of the importer code. 

The basic idea is to move code from importer stages to importer tasks and use different implementations of the `ImporterTask` interface instead of conditional statements.

Each commit reorganises a small part of the code that works towards this but tries not to change the overall behaviour. To review this its probably best to look at the commits one by one and verify that there is indeed no change. The tests give a strong argument that this is the case.

For now I think all small enough changes have been made and I would like to continue with rewrites of larger parts that block some of the refactoring.

First we should tackle the resume and incremental functionalities. I propose that for each task we record the imported paths, that is the original paths of items that are added to the library.

As an optimization we can record directories instead of paths if all paths in a directory have been added. This applies well to an album import. We should also use sorted lists and the `bisect` module to stay reasonably fast.

After changing the resume and incremental code we should be able to consolidate the remaining code even further.