This was textbook-specific code that was previously part of the uploader. If a new chapter is being created its name will be set to the PDF's filename. I just factored it out almost verbatim.