summaryrefslogtreecommitdiff
path: root/backend.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-02-26 00:14:30 +0300
committerAndrew Dolgov <[email protected]>2017-02-26 00:14:30 +0300
commitb8ae4b31c129031e89e4c7fb9801d6761513dd73 (patch)
tree4522dc5c059837a8c143c2a90c1dc562db0915ff /backend.php
parentf858879a3d13bcec694a5e2493fbfe3a1a233e13 (diff)
experimental service worker offline stuff
Diffstat (limited to 'backend.php')
-rw-r--r--backend.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/backend.php b/backend.php
index d14c92f..5d30f9d 100644
--- a/backend.php
+++ b/backend.php
@@ -43,6 +43,23 @@
break;
+ case "getinfo":
+ $id = (int) $_REQUEST["id"];
+
+ $db = new SQLite3(CALIBRE_DB, SQLITE3_OPEN_READONLY);
+
+ $result = $db->query("SELECT books.*, s.name AS series_name,
+ (SELECT id FROM data WHERE book = books.id AND format = 'EPUB' LIMIT 1) AS epub_id FROM books
+ LEFT JOIN books_series_link AS bsl ON (bsl.book = books.id)
+ LEFT JOIN series AS s ON (bsl.series = s.id)
+ WHERE books.id = " . $id);
+
+ if ($line = $result->fetchArray(SQLITE3_ASSOC)) {
+ print json_encode($line);
+ }
+
+ break;
+
case "download":
$id = (int) $_REQUEST["id"];