You could require that the input files have the same sha256 hash, that would presumably be more robust than trusting an ID from the file itself
It's highly likely to be globally unique, and it can also help with the missing forewords/afterwords/bonus content sections.
In addition, you can also add fuzzy matching for the title.