Quantcast
Channel: PirateBox Forum - PirateBox OpenWrt
Viewing all articles
Browse latest Browse all 3254

PirateBox + COPS (Calibre OPDS (and HTML) PHP Server)

$
0
0
So... I managed to get COPS (see title) installed on my PirateBox 0.6.3 on an MR3020. This a great application that allows me to have a fully searchable book archive with book descriptions, ratings, and other metadata. This is how I did it:

1. Install PirateBox as normal.

2. Connect PB to internet and install PHP via the guide found on the PB Modifications page here.

3. Install necessary PHP modules. What I have installed:


opkg list-installed | grep php

php5 - 5.4.5-3
php5-cgi - 5.4.5-3
php5-mod-dom - 5.4.5-3
php5-mod-gd - 5.4.5-3
php5-mod-json - 5.4.5-3
php5-mod-pdo - 5.4.5-3
php5-mod-pdo-sqlite - 5.4.5-3
php5-mod-sqlite - 5.4.5-3
php5-mod-sqlite3 - 5.4.5-3
php5-mod-xml - 5.4.5-3
php5-mod-xmlreader - 5.4.5-3
php5-mod-zip - 5.4.5-3

4. Uncomment necessary dynamic extensions in php.ini. This is what it looks like in mine:

; Dynamic Extensions

;extension=ctype.so
;extension=curl.so
extension=dom.so
;extension=exif.so
;extension=ftp.so
;extension=gd.so
;extension=gmp.so
;extension=hash.so
;extension=iconv.so
;extension=json.so
;extension=ldap.so
;extension=mbstring.so
;extension=mcrypt.so
;extension=mysql.so
;extension=openssl.so
;extension=pcre.so
extension=pdo.so
;extension=pdo-mysql.so
;extension=pdo-pgsql.so
extension=pdo_sqlite.so
;extension=pgsql.so
;extension=session.so
;extension=soap.so
;extension=sockets.so
extension=sqlite.so
extension=sqlite3.so
;extension=tokenizer.so
extension=xml.so
extension=xmlreader.so
;extension=xmlwriter.so

5. Created cops directory under /opt/piratebox/www/php:

mkdir /opt/piratebox/www/php/cops

6. Create books directory in /mnt/usb and put my Calibre library in it.

7. Download and extract the cops zip file from the COPS site linked at the top of this post. (I had to extract it on a separate machine and then tar the files as I did not want to mess with a zip file from within OpenWRT). Make sure to extract the files within the php/cops folder.

8. Edit a few of the php files to disable icon creation/display and date detection/parsing. (The icon creation is too resource heavy to run on the MR3020 and date parsing is pointless and doesn't work on the PB because the system time doesn't get set.) If anyone is interested in how I edited the files I can edit this post with that info later. I just have to track down all the changes I made.

9. Edit the COPS config_local.php to look like this:

Language: PHP
<?php if (!isset($config)) $config = array();   /* * The directory containing calibre's metadata.db file, with sub-directories * containing all the formats. * BEWARE : it has to end with a / */ $config['calibre_directory'] = '/mnt/usb/books/';   /* * Catalog's title */ $config['cops_title_default'] = "Books";   /* * use URL rewriting for downloading of ebook in HTML catalog * See README for more information * 1 : enable * 0 : disable */ $config['cops_use_url_rewriting'] = "0"; $config['default_timezone'] = "America/New_York"; $config['cops_recentbooks_limit'] = '0'; $config['cops_show_icons'] = "1"; $config['cops_use_fancyapps'] = "0"; $config['cops_max_item_per_page'] = "10"; ?>

10. Edit the PB index.html to include a link to "/php/cops/index.php"

11. Disconnect from the internet, edit network settings back to the way they were, plug it into my battery, and voila! A portable OPDS and HTML book server that is fully searchable and a nice front end for downloading those books.

Example of a search page:

Picture (kinda big)

So far it works great. I hope I didn't miss a step in my description. Typing this up fast because I don't have a lot of time. I'll edit later if I did. Questions or comments let me know. :D

Viewing all articles
Browse latest Browse all 3254

Trending Articles