Also, Library toolbar dropdown ==> Library Maintenance ==> Restore Database can re-add loose book folders to the database, might help with the corruption.
As theducks said, the corruption may very well have resulted from using a NAS

which is officially un-advised. I suggest using something like rsync (Macs do have that, right?) to mirror your main library onto the NAS, and run the library locally.