look at the commandline tools help page: calibredb (add --cover section)
It will take some scripting effort to align your folders to the {id}
since not all books need covers:
search for: covers:false to show a list
additionally: some books may just have unidentified covers (and not the first image). The Quality check PI might help identify candidates for further work