In beets 1.4.5 on Centos 7, after an interrupted import (abort or crash), the subsequent import always starts from the beginning, even though I have set the -p command line option and the message “Resuming interrupted import of …” shows up. Any idea how to fix this?
beets version 1.4.5
Python version 2.7.5
plugins: fetchart, fromfilename, lyrics
Strange! I don’t see any obvious evidence there. I’m not sure what else to try, really—maybe there’s some sort of small test that we can run here to reproduce the problem “from scratch”?
Could be because I fiddled around with some of the files beet uses, how is
the starting point of an interrupted import determined? Maybe this gives me
a clue where to start looking.
The short answer is that the importer stores all the directories it imports in a file called state.pickle under ~/.config/beets. It also records an indication when an import finishes.
Then, when you start an import, it checks whether an import of that directory has previously started but not finished. If so, it skips over all the subdirectories recorded in the file for that directory.
If you’re interested in more mechanical details, I recommend reading importer.py in the source. The right place to start are the _open_state and _save_state functions for reading and writing this file.