Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Related Tools

Notices

Reply
 
Thread Tools Search this Thread
Old 12-20-2022, 01:02 PM   #1891
jajaX
Junior Member
jajaX began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jul 2022
Device: samsung galaxy Z fold 2 5G
Smile

Quote:
Originally Posted by mariosipad View Post
@jajaX

Question: Is Cops compatible with php 8 ?

Answer: NO, not with the original code from https://github.com/seblucas/cops

However (YES) if you are willing to dive into the code and edit 1 line. Then COPS should work with PHP 8 (never tried with PHP 8.2).
Reference: https://github.com/seblucas/cops/issues/492

How:
1 - open file ../cops/vendor/seblucas/dot-php/doT.php
2 - change line 94
Code:
return @create_function ('$it', $func);
3 - to
Code:
return @function ($it) use ($func) {
        eval($func);
        };
I did it like this:
Code:
        // For PHP 8 replace this line 
        //return create_function ('$it', $func);
        // with
        return function ($it) use ($func) {
        return eval($func);
        };
        // end replace
Please report back if it works for you.
Hi,

sorry for my bad english, i use a translator.

Thank you for your answer.
I tried to modify as indicated but I still found myself in front of a blank page.

I've downgraded to php 7.4.33 for now.
jajaX is offline   Reply With Quote
Old 12-22-2022, 01:21 PM   #1892
leo4any1
Junior Member
leo4any1 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Dec 2022
Device: Kindle Oasis
Hi,
Can someone please post the example of the following two rows from config_local.php?
$config['cops_convert_to_types']
$config['convert_cmd']

I installed COPS on my Synology, and it allows me to download FB2 books. I am trying to add an option to download ePub file using converter from this site: https://github.com/rupor-github/fb2converter/releases
but I don't know how to make epub option appearing next to FB2 one.
I found an instruction to use two parameters above, but no examples.
Thank you in advance.
leo4any1 is offline   Reply With Quote
Old 12-22-2022, 05:28 PM   #1893
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 719
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
@leo4any1
As a long time user of COPS I have never seen the 2 lines from config_local.php (they are not in MY config_local.php).

Can you point me to where you found them?
mariosipad is online now   Reply With Quote
Old 12-22-2022, 06:38 PM   #1894
leo4any1
Junior Member
leo4any1 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Dec 2022
Device: Kindle Oasis
@mariosipad
I don’t have these lines too. I found the following instruction in COPSFB2 fork of COPS project. (sorry, the following is auto translated)

7. If you need a converter to mobi/epub:
We take here the converter for our platform
We unpack it into copsfb2/convert, check the rights and attributes of executable files. The specified directory must contain the fb2c executable file (for Windows, fb2c.exe).
In copsfb2/config_local.php we edit the parameters:
$config['cops_convert_to_types'], specify the types to which to convert, separated by commas, by default mobi,epub are written in the config
$config['convert_cmd'], command line for conversion. If you have linux, you can leave it alone, in windows correct the name of the executable file.
You can create the convert/configuration.toml configuration file by hand or run the converter with the export command and edit it. If one is found, it will be passed to the executable command at startup
If there are problems with the conversion (there are mobi/epub icons, but fb2 is loaded, check the write and execute permissions. By default, the converter tries to create its own log in the copsfb2/ directory (conversion.log). If the http group does not have write permissions to this directory, there will be an error and no output file will be created.Logging can be disabled in configuration.toml ([logger.file] level = "none", read the documentation for the converter) or give write permissions to the http group in the copsfb2/ directory.


Sent from my iPad using Tapatalk
leo4any1 is offline   Reply With Quote
Old 12-27-2022, 05:12 PM   #1895
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 719
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
@leo4any1

Do you have a link to the code?
The only link I could find https://sites.google.com/site/copsfb...attredirects=0 seems to be dead.

What this piece of software seems to do is convert FBreader files to epub/mobi files on-the-fly. It does not add a downloadable copy of a FBreader-file in epub-format to COPS. You can (only) do that with Calibre.
mariosipad is online now   Reply With Quote
Old 12-29-2022, 06:56 PM   #1896
leo4any1
Junior Member
leo4any1 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Dec 2022
Device: Kindle Oasis
@mariosipad
The link is below:
https://sites.google.com/site/copsfb...;-synology-dsm

It is in Russian though therefore you need to use the Google translator.
I am trying to get it converted on the fly. The original library has books in fb2 format only. What I am trying to do is to get 'epub' and 'mobi' icons appearing next to 'fb2' one, and to get COPS automatically running the installed converter to get the book downloaded in 'epub' format (if I click on epub icon)
I got the following example on another forum, but it still doesn't work for me.

$config['cops_prefered_format'] = array ("epub","fb2");
$config['cops_convert_to_types'] = (file_exists('./convert/fb2c') ? "mobi,epub" : TRUE);

What is interesting though is that when I remove 'fb2' from the list above I don't get 'fb2' download icon anymore. It means the system takes it, but still something is missing, I get only 'fb2' icons regardless of the values in this list.
leo4any1 is offline   Reply With Quote
Old 12-30-2022, 07:30 AM   #1897
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 719
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
@leo4any1

Thanks for the link. However I cannot find any working link to the installable code (copsfb2.zip).
It might be that I need new glasses or a bigger monitor, but so far no luck.

So I'm not able to install and test it.

I would use calibre to convert all FBreader files to epub or mobi and then use COPS to serve them.

It's a nice challenge to get copsfb2 working though!
mariosipad is online now   Reply With Quote
Old 12-30-2022, 07:37 AM   #1898
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by mariosipad View Post
@leo4any1

Thanks for the link. However I cannot find any working link to the installable code (copsfb2.zip).
It might be that I need new glasses or a bigger monitor, but so far no luck.

So I'm not able to install and test it.

I would use calibre to convert all FBreader files to epub or mobi and then use COPS to serve them.

It's a nice challenge to get copsfb2 working though!
I found this working download link to what appears to be the latest version. The downloaded zip file is attached. I have no idea if the contents are legitimate.
Attached Files
File Type: zip copsfb2_113_20211009.zip (2.35 MB, 129 views)
chaley is offline   Reply With Quote
Old 12-30-2022, 01:09 PM   #1899
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 719
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
@chaley @leo4any1

The link seems to work.
I have tried to test it on a Debian 10 PC with apache2.

However copsfb2 does not behave like I expect cops to behave.

The source code seems to be a bit more changed than I thought.
I am just an enthousiast user of cops and not really a php programmer.

If I can find the time I will try again to make it work in 2023! (I give op for 2022.)
mariosipad is online now   Reply With Quote
Old 12-30-2022, 01:40 PM   #1900
leo4any1
Junior Member
leo4any1 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Dec 2022
Device: Kindle Oasis
Quote:
Originally Posted by mariosipad View Post
@chaley @leo4any1

The link seems to work.
I have tried to test it on a Debian 10 PC with apache2.

However copsfb2 does not behave like I expect cops to behave.

The source code seems to be a bit more changed than I thought.
I am just an enthousiast user of cops and not really a php programmer.

If I can find the time I will try again to make it work in 2023! (I give op for 2022.)
I downloaded and installed copsfb2 using the instructions from the following page: https://sites.google.com/site/copsfb...a-nas-synology

The actual zip file can be found at:

https://drive.google.com/uc?id=0B001...xport=download

Everything works fine, I am able to browse and download all books in FB2 format (my library has books in FB2 format only). It is probably possible to get all books pre-converted to epub and/or mobi and have them added to the library, but it will double or triple the required storage space, and seems like an overkill. It would be much better to have an option to convert on the fly, in the same way as Calibre does it.

Anyways, I hope we can have it figured out next year.

Happy New Year to everyone!
leo4any1 is offline   Reply With Quote
Old 01-12-2023, 09:42 AM   #1901
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 719
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
@jajaX

I just found out there is an error in the post #1890 I made.

Below you'll find the correction in red.

How:
1 - open file ../cops/vendor/seblucas/dot-php/doT.php
2 - change line 94
Code:
return @create_function ('$it', $func);
3 - to
Code:
return @function ($it) use ($func) {
        return eval($func);
        };
I did it like this:
Code:
        // For PHP 8 replace this line 
        //return create_function ('$it', $func);
        // with
        return function ($it) use ($func) {
        return eval($func);
        };
        // end replace
Now it should work.
mariosipad is online now   Reply With Quote
Old 03-14-2023, 05:43 PM   #1902
jajaX
Junior Member
jajaX began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jul 2022
Device: samsung galaxy Z fold 2 5G
Quote:
Originally Posted by mariosipad View Post
@jajaX

I just found out there is an error in the post #1890 I made.

Below you'll find the correction in red.

How:
1 - open file ../cops/vendor/seblucas/dot-php/doT.php
2 - change line 94
Code:
return @create_function ('$it', $func);
3 - to
Code:
return @function ($it) use ($func) {
        return eval($func);
        };
I did it like this:
Code:
        // For PHP 8 replace this line 
        //return create_function ('$it', $func);
        // with
        return function ($it) use ($func) {
        return eval($func);
        };
        // end replace
Now it should work.
Hi,

ok, thank you véry much.

I must upgrade my "server" computer to 22.04 tomorrow. I try that after !!
jajaX is offline   Reply With Quote
Old 03-20-2023, 12:58 PM   #1903
jajaX
Junior Member
jajaX began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jul 2022
Device: samsung galaxy Z fold 2 5G
Smile

Quote:
Originally Posted by mariosipad View Post
@jajaX

I just found out there is an error in the post #1890 I made.

Below you'll find the correction in red.

How:
1 - open file ../cops/vendor/seblucas/dot-php/doT.php
2 - change line 94
Code:
return @create_function ('$it', $func);
3 - to
Code:
return @function ($it) use ($func) {
        return eval($func);
        };
I did it like this:
Code:
        // For PHP 8 replace this line 
        //return create_function ('$it', $func);
        // with
        return function ($it) use ($func) {
        return eval($func);
        };
        // end replace
Now it should work.
Hi,

I confirm => it's works !!

thank you very much
jajaX is offline   Reply With Quote
Old 06-22-2023, 04:22 AM   #1904
dunxd
Member
dunxd began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Oct 2022
Device: Kindle Paperwhite 1st Generation
Those participating in this thread who also use Home Assistant may be interested in the COPS add-on I have put together. It is updated to work in PHP8 and supports hosting your library locally or via a network share. Make your library easily available to visitors to your home 24/7 via web browser and OPDS. Take a look at HA COPS add-on.
dunxd is offline   Reply With Quote
Old 07-24-2023, 08:09 AM   #1905
Horus68
Zealot
Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.
 
Horus68's Avatar
 
Posts: 140
Karma: 76596
Join Date: Feb 2015
Location: Portugal
Device: Kobo Aura HD
Call to action to create a new template for COPS. Bring in your skills:
«if anyone has a slight interest or knowledge in designing a new front-end web interface for COPS, that would be most welcome.»
See this Github:
https://github.com/mikespub-org/sebl.../discussions/9

Note: for questions keep on with this actual mobileread forum topic!
Horus68 is offline   Reply With Quote
Reply

Tags
calibre opds, dns, kobo aura, synology


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre OPDS server with windows apps? nickdma Related Tools 10 03-03-2024 02:53 PM
[Old Thread] Android FBreader and Calibre OPDS server question kalex Calibre 5 12-24-2015 10:16 PM
PHP+Apache web server for calibre ... chaley Related Tools 254 04-28-2014 08:18 PM
External OPDS catalogue in Calibre bolton Calibre 1 09-05-2012 06:14 AM
Calibre Command Line usage with PHP artoros Related Tools 13 07-01-2010 09:57 AM


All times are GMT -4. The time now is 01:33 PM.


MobileRead.com is a privately owned, operated and funded community.