Summarize:

It will read "Fair is foul, and foul is fair. Put these books out of order." There will be 5 books in normal mode. You'll be allowed to place the books on the empty space on the shelf. Put the books in randomly; order doesn't matter as this puzzle is generated randomly. You'll see there are black markings on it; this is the code you need. It won't be too hard as the numbers are written quite obviously. Try to make out the numbers written on the spine of the books and keep moving them until you get it right.
Read the note on the door. Pick up all the books on the floor. Examine the bookshelf. Take a good look at the books. Arrange the books until you get the correct order.