seblucas / cops

Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)
http://blog.slucas.fr/en/oss/calibre-opds-php-server
GNU General Public License v2.0
1.42k stars 229 forks source link

Multiple libraries - COPS on Docker [SOLVED] #503

Open bitnikrbt opened 3 years ago

bitnikrbt commented 3 years ago

My configuration: Docker 19.03.8 Portainer 2.1.1 Cops 1.1.3 packed by Linuxserver (Linuxserver/cops) Installed on WD MyCloudEx2Ultra

I want to get access to multiple Calibre libraries stored on my WD MyCloudEx2Ultra NAS. I already manage to configure COPS to get access to one of them.

Now I am clueless on how to preceed from now on.

I am seeking advice to conconfigure COPSs to access multiple libraries with the above mentioned configuration.

Thanks

Roberto

jvanderzande commented 3 years ago

Just add a second directory to your config_local.php like:


$config['calibre_directory'] = array ("Nederlands" => "./ebooks/Calibrebibliotheek-NL-NAS/", "English" => "./ebooks/Calibrebibliotheek-EN-NAS/");

Jos

bitnikrbt commented 3 years ago

Jos thank you very much for your help.

After some testing with no positive output I think the problem is that COPS is installed as a Portainer App.

By using the command "array" in the config_local.php as you suggested I think that the configuration conflicts with the container of the books and with the host configured in Portainer.

These are problems that go beyond my basic skills.

So if anyone is able to support me I would be grateful.

Thanks

Rob

bitnikrbt commented 3 years ago

I have found a solution that works for me.

This procedure is applied in case of installation of COPS from APP TEMPLATES in Portainer. In my case the COPS template is based on linuxserver / cops.

Install the template and add a container - host (binded to container) pair for each book collection you want to make accessible. The host must point to the folder where the metadata.db file of the reference collection is located. example: container = books - host = /path-to-library-on-your-nas/books container = books1 - host =/path-to-library-on-your-nas/books1 etc.

Deploy the ammended container.

In Portainer, stop the COPS container that has started automatically.

Download the config_local.php file from the NAS and edit it as follows:

command $ config ['calibre_internal_directory']: add a line for each container created. (using example reference :) $ config ['calibre_internal_directory'] = '/books/'; $ config ['calibre_internal_directory'] = '/books1/';

command "$ config ['calibre_directory'] = array" enter the desired name for the collection and the reference to "calibre_internal_directory" and NOT to the path where the collections are located. (using example reference :) $ config ['calibre_directory'] = array ("READ THIS" => "/books/", "READ MORE" => "/books1/");

Save the config_local.php, overwrite the original file by uploading it to the same location it was downloaded from.

In Portainer restart the COPS container.

Check on the local port if there are all the collections set up.

This solution works for me.

Hope will help someone else.

Rob

horus68 commented 3 years ago

In your config you have caliber word but it should be calibre Note: you can also edit your text here and place the code inside code tags

itsalljustdata commented 2 years ago

I went with the following....

/books/ is the "base" folder where all of my ebook libraries exist one subfolder down

    $config['calibre_directory'] = array();

    foreach (array_map('dirname',glob('/books/*/metadata.db')) as $dir) {
        $name = basename($dir);
        $config['calibre_directory'][$name] = $dir.'/';
    }
marsimgit commented 2 years ago

I went with the following....

/books/ is the "base" folder where all of my ebook libraries exist one subfolder down

    $config['calibre_directory'] = array();

    foreach (array_map('dirname',glob('/books/*/metadata.db')) as $dir) {
        $name = basename($dir);
        $config['calibre_directory'][$name] = $dir.'/';
    }

I tried this and it works partially i.e. you can browse all configured libraries but cannot neither view not download ebooks. I suppose that $config['calibre_internal_directory'] has to be changed in a similar fashion but don't know yet how to do it.