OPDS feed unable to load

Hi,

I’m using OPDS on my Nextcloud setup and when I try to connect to it, I get an error saying “Cannot download feed. The service may not be available or you may not be connected to the internet.” This is on the iOS app Marvin. It’s connecting to other feeds just fine.

Thanks!

Fixed. It seems to have been a datetime issue with some of the books in the folder I was pointing to.

It seems that might be caused by weird non conforming to DB file dates or date formats.
Some files used to throw these type of messages:

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing ‘INSERT INTO oc_opds_metadata (id, updated, date, author, title, language, publisher, isbn, copyright, description, subjects, cover, rescan) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)’ with params [77796, “2019-03-08 20:37:32”, “”, “”, “Bargain ZZZ”, “”, “”, “9781591845505”, “”, “”, “”, null, “2019-03-15T20:37:33+00:00”]: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: ‘2019-03-15T20:37:33+00:00’ for column nextcloud.oc_opds_metadata.rescan at row 1

I made these changes in \lib\meta.php:
Change
$meta['date'],
to
date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $meta['date']))),

and change
$meta['rescan'],
to
date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $meta['rescan']))),

in this block of the code

$sql = "UPDATE *PREFIX*opds_metadata SET `updated`=?, `date`=?, `author`=?, `title`=?, `language`=?, `publisher`=?, `isbn`=?, `copyright`=?, `description`=?, `subjects`=?, `cover`=?, `rescan`=? WHERE id=?";
			$args = array(
				$meta['updated'],
				date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $meta['date']))),
				$meta['author'],
				$meta['title'],
				$meta['language'],
				$meta['publisher'],
				preg_replace('/[^0-9xX]/','',$meta['isbn']),
				mb_strimwidth($meta['copyright'],0,252,'...'),
				mb_strimwidth($meta['description'],0,2044,'...'),
				$meta['subjects'],
				$meta['cover'],
				date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $meta['rescan']))),
				$meta['id']
				);

		} else {
			$sql = "INSERT INTO *PREFIX*opds_metadata (`id`, `updated`, `date`, `author`, `title`, `language`, `publisher`, `isbn`, `copyright`, `description`, `subjects`, `cover`, `rescan`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
			$args = array(
				$meta['id'],
				$meta['updated'],
				date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $meta['date']))),
				$meta['author'],
				$meta['title'],
				$meta['language'],
				$meta['publisher'],
				preg_replace('/[^0-9xX]/','',$meta['isbn']),
				mb_strimwidth($meta['copyright'],0,252,'...'),
				mb_strimwidth($meta['description'],0,2044,'...'),
				$meta['subjects'],
				$meta['cover'],
				date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $meta['rescan']))),
				);

These changes also fixed files_reader app (nextcloud/owncloud unsupported in v14,v15) throwing 500 error while trying to display these bad date format files.