package duplicates import "errors" // Why a removal is refused. The API turns each into its own answer. var ( // ErrTrackNotFound: a track that was named does not exist (any more). ErrTrackNotFound = errors.New("no such track") // ErrDisabled: the operator has not allowed Sonda to delete files (library.allow_delete). ErrDisabled = errors.New("deleting files is not allowed: turn on library.allow_delete") // ErrScanRunning: a scan is running, and what it reads and what is removed must not meet. ErrScanRunning = errors.New("a scan is running") // ErrInvalid: the tracks named are not copies of one song, or the request makes no sense. ErrInvalid = errors.New("these tracks are not copies of the same song") // ErrChanged: a file is not what the index says (another size or date, a link, gone), or the // copy to keep is not there any more. Nothing is removed; a new scan brings the index up to date. ErrChanged = errors.New("a file changed since it was scanned") // ErrReadOnly: the folder cannot be written to. ErrReadOnly = errors.New("the music folder is read-only") ) // FileRecord is a file as the index knows it: where it is and what it looked like when it was scanned. type FileRecord struct { FileID int64 TrackID int64 Root string // the path of its library RelPath string // relative to the library SizeBytes int64 MTimeUnix int64 Hash string // SHA-256, empty until read Missing bool // flagged as not found by a scan }