diff --git a/files_opds/appinfo/info.xml b/files_opds/appinfo/info.xml
index b3867d5..823761b 100644
--- a/files_opds/appinfo/info.xml
+++ b/files_opds/appinfo/info.xml
@@ -11,7 +11,7 @@
The feed is in compliance with the OPDS 1.1 specification according to the online OPDS validator (http://opds-validator.appspot.com/).
AGPL
- 0.7.2
+ 0.7.3
Frank de Lange
tools
files
diff --git a/files_opds/lib/bookshelf.php b/files_opds/lib/bookshelf.php
index 06254f4..0411ca6 100644
--- a/files_opds/lib/bookshelf.php
+++ b/files_opds/lib/bookshelf.php
@@ -33,6 +33,19 @@ class Bookshelf
Config::set('bookshelf', json_encode($bookshelf));
}
+ /**
+ * @brief remove book from personal bookshelf
+ *
+ * @param int $id book to remove from bookshelf
+ */
+ public static function remove($id) {
+ $bookshelf = json_decode(Config::get('bookshelf', ''), true);
+ if(isset($bookshelf[$id])) {
+ unset($bookshelf[$id]);
+ Config::set('bookshelf', json_encode($bookshelf));
+ }
+ }
+
/**
* @brief clear personal bookshelf
*/
@@ -58,7 +71,12 @@ class Bookshelf
if($bookshelf = json_decode(Config::get('bookshelf', ''), true)) {
arsort($bookshelf);
while (list($id, $time) = each($bookshelf)) {
- array_push($files, \OC\Files\Filesystem::getFileInfo(\OC\Files\Filesystem::normalizePath(\OC\Files\Filesystem::getPath($id))));
+ try {
+ array_push($files, \OC\Files\Filesystem::getFileInfo(\OC\Files\Filesystem::normalizePath(\OC\Files\Filesystem::getPath($id))));
+ } catch(\OCP\Files\NotFoundException $e) {
+ self::remove($id);
+ Meta::remove($id);
+ }
}
}
diff --git a/files_opds/lib/meta.php b/files_opds/lib/meta.php
index fc399a1..4174c61 100644
--- a/files_opds/lib/meta.php
+++ b/files_opds/lib/meta.php
@@ -141,6 +141,20 @@ class Meta
return $meta;
}
+ /**
+ * @brief remove metadata for fileid
+ *
+ * @param int $id fileif
+ * @return OC_DB_StatementWrapper
+ */
+ public static function remove($id) {
+ $sql = "DELETE FROM *PREFIX*opds_metadata WHERE `id`=?";
+ $args = array($id);
+ $query = \OCP\DB::prepare($sql);
+
+ return $query->execute($args);
+ }
+
/**
* @brief schedule rescan of metadata
*