Doh! I fixed my problem and it was pretty stupid...
In the config_local.php file I had the variable:
PHP Code:
$config['calibre_directory'] = '/var/www/books';
When it should have been:
PHP Code:
$config['calibre_directory'] = '/var/www/books/';
Notice the '/' at the end? Such a small thing that took me several hours to find.