Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 09-13-2013, 11:28 AM   #601
vlad59
Addict
vlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five words
 
Posts: 369
Karma: 37869
Join Date: Sep 2011
Device: Kobo eReader Touch, Kobo Aura HD
COPS 0.6.2

COPS 0.6.2 is out with bug fixes and some new features (First post to download) :

* Added server side rendering for devices like PRS-TX / Kindle / Cybook. Thanks to all the testers.
* Added a configuration item to tweak how thumbnail are handled.
* Fixed the click on cog on IOS. Thanks to sb domo.
* Added dashboard icons / standalone mode for IOS. Thanks to sb domo.
* Fixed a regression about custom favicon.ico. Thanks to Tyler.
* Fixed another regression about COPS's version in the about box. Reported by Ian.
* Upgraded Magnific Popup to v0.9.5.
* Added a style for IPhone. Thanks to sb domo.
* Added Portuguese translation. Thanks to Pablo Aguiar.
* Fixed rendering on Internet Explorer < 9.0.

The most important bug fix is that COPS now use server side rendering for some devices (PRS-TX / Kindle / Cybook). You can tweak $config['cops_server_side_render'] if needed and send me your modifications.

I also fixed some regressions reported by mail, sorry for the inconvenience.

The biggest enhancement is about thumbnail. On low end devices thumbnail generation was long ... very long. I added a parameter ($config['cops_thumbnail_handling']) to choose between CPU hungry or Network hungry thumbnails. If COPS is installed on your Nas and you mainly use it on your LAN then set it to "1" (check config_default.php for the other values). I made especially after reading this link (they run COPS on devices even slower than my Dockstar or Raspberry Pi).

Thanks to sbdomo for an Iphone style, I've tried to make a Google Books kind of style and failed. Maybe someone will be better than me at it .

As always, thanks a lot to all the contributors and the beta testers.

I'll update the Synology package in a day or two.

As usual the download link is in the first post.

Happy testing.

Last edited by vlad59; 09-20-2013 at 08:26 AM.
vlad59 is offline   Reply With Quote
Old 09-14-2013, 04:57 PM   #602
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: 718
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
Installed this package on my Synology DS110j with setting $config['cops_thumbnail_handling'] = "1"; in config_local.php.

And it workes pretty good

for COPS
mariosipad is offline   Reply With Quote
Advert
Old 09-17-2013, 10:30 AM   #603
neodago
Junior Member
neodago began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2013
Device: Samsung Galaxy Tab 2 10.1, Sony PRS-T1
the previus beta 6.0.2 was working very well in all my devices, but this last one works only in chrome browser. From internet explorer and from my devices (kobo, sony) the home page is blank; nothing appears.
I lost something on the way?
neodago is offline   Reply With Quote
Old 09-17-2013, 02:34 PM   #604
vlad59
Addict
vlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five words
 
Posts: 369
Karma: 37869
Join Date: Sep 2011
Device: Kobo eReader Touch, Kobo Aura HD
Quote:
Originally Posted by neodago View Post
the previus beta 6.0.2 was working very well in all my devices, but this last one works only in chrome browser. From internet explorer and from my devices (kobo, sony) the home page is blank; nothing appears.
I lost something on the way?
That's strange, I tested 0.6.2 on my Kobo and it works fine. Did you try to reload the page or change the directory in which COPS is installed (just to be sure the browser's cache is not causing problems).
vlad59 is offline   Reply With Quote
Old 09-18-2013, 03:00 AM   #605
neodago
Junior Member
neodago began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2013
Device: Samsung Galaxy Tab 2 10.1, Sony PRS-T1
Quote:
Originally Posted by vlad59 View Post
That's strange, I tested 0.6.2 on my Kobo and it works fine. Did you try to reload the page or change the directory in which COPS is installed (just to be sure the browser's cache is not causing problems).
OK, I installed again the last version and now all is working fine... I don't know what went wrong last time...
Sorry for the waste of time.
neodago is offline   Reply With Quote
Advert
Old 09-18-2013, 07:23 AM   #606
wikiped
Member
wikiped began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: Kobo Aura HD, Kobo Glo
Cyrillic support

Can you please help with issue I am having with Cyrillic letters when accessing cops on ereaders' browsers (Kobo Aura HD and Onyx Book A60).

As shown in the attached screenshots all non Latin letters are not displayed.
While at the top of the 2nd screen (outside of browser) there are readable Cyrillic letters (Author).
Spoiler:


Any other web page (outside of cops) that contain Cyrillic can be read without any problems.

Are there any settings that I missed that can help to fix this?

COPS is installed on QNAP and everything works fine when it is accessed from windows PC or android smartphone (both html and opds).
Rendering at server side is turned on.

Thanks.
wikiped is offline   Reply With Quote
Old 09-18-2013, 09:42 AM   #607
vlad59
Addict
vlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five words
 
Posts: 369
Karma: 37869
Join Date: Sep 2011
Device: Kobo eReader Touch, Kobo Aura HD
@neodago

Thanks for the report. As a side note I'll integrate your translation soon.

@wikiped

That's interesting. I've tried on Firefox / IE10 / Chrome and I cannot reproduce your problem. Can you confirm you also don't have the problem on normal desktop browser ?

I'll check tonight on my Kobo Touch.
vlad59 is offline   Reply With Quote
Old 09-18-2013, 10:08 AM   #608
wikiped
Member
wikiped began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: Kobo Aura HD, Kobo Glo
@vlad59

No problem on Firefox! And no problem on Android Browser!
ONLY on e-readers: Kobo and Onyx.
Thanks.
wikiped is offline   Reply With Quote
Old 09-18-2013, 10:39 AM   #609
vlad59
Addict
vlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five words
 
Posts: 369
Karma: 37869
Join Date: Sep 2011
Device: Kobo eReader Touch, Kobo Aura HD
Quote:
Originally Posted by wikiped View Post
@vlad59

No problem on Firefox! And no problem on Android Browser!
ONLY on e-readers: Kobo and Onyx.
Thanks.
That's reassuring . Could you try to change index.php and replace this line :

Code:
<link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css?family=Open+Sans:400,300italic,800,300,400italic,600,600italic,700,700italic,800italic' />
By

Code:
<link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css?family=Open+Sans:400,300italic,800,300,400italic,600,600italic,700,700italic,800italic&subset=latin,cyrillic' />
It could help.
vlad59 is offline   Reply With Quote
Old 09-18-2013, 11:10 AM   #610
wikiped
Member
wikiped began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: Kobo Aura HD, Kobo Glo
Quote:
Originally Posted by vlad59 View Post
It could help.
It did help! Problem solved.
Thank you very much!

But does it mean that I have to manually change this line with every update or is there a way to incorporate this line into the distributed package?
Thanks again!
wikiped is offline   Reply With Quote
Old 09-18-2013, 11:42 AM   #611
zitronenrollchen
Junior Member
zitronenrollchen began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Feb 2013
Device: Kindle NT
Using COPS with library in Dropbox

I have the following setup:

1. COPS and my metadata.db are hosted in my webspace
2. The calibre library is in a local folder that syncs with dropbox. I do not want so have a copy in my webspace.

So to have ebooks and covers available in COPS I have to rewrite all links and also cache cover photos in my webspace. I access all files in dropbox with the following perl script (cgi-bin) that uses the dropbox api.

Code:
#!/usr/bin/perl

use strict;
use Net::Dropbox::API;
use URI::Escape;
use CGI;

my $types = {
    epub => 'application/epub+zip',
    mobi => 'application/x-mobipocket-ebook',
    pdf => 'application/pdf',
    jpg => 'image/jpeg',
};

my $cfg;
my $dev_key = 'xxxxxx';
my $dev_secret = 'xxxxxxx';

### config 
$cfg->{access_token} = 'xxxxx';
$cfg->{access_secret} = 'xxxxx';

my $base = 'ebooks';
my $q = CGI->new();
my $f = $q->path_info();
my ($ext) = ($f =~ /\.(\w+)$/);

## authenticate
my $box = Net::Dropbox::API->new({key => $dev_key, secret => $dev_secret});
$box->access_token($cfg->{access_token});
$box->access_secret($cfg->{access_secret});

$box->context('dropbox'); ## or 'sandbox'
my $file = $box->getfile($base . join("/", map { uri_escape($_) } split(/\//, $f)));

if ($file =~ /^{"http_response_code":"(\d+)"/)
{
    error($1);
}
else
{
    print $q->header($types->{$ext} || 'application/octet-stream');
    print $file;
}

exit;

sub error
{
    my $error = shift;
    print $q->header(-type=>"text/plain", -status=>$error);
    print "error $error";
    exit 1;
}
I had to make a couple of changes to COPS (0.6.1 but diff applies also to 0.6.2) to reflect my needs.

Code:
diff -urN ../ebook.orig/book.php ./book.php
--- ../ebook.orig/book.php      2013-07-29 14:03:58.000000000 +0200
+++ ./book.php  2013-08-27 11:32:57.889844409 +0200
@@ -83,7 +83,7 @@
         $this->comment = $line->comment;
         $this->uuid = $line->uuid;
         $this->hasCover = $line->has_cover;
-        if (!file_exists ($this->getFilePath ("jpg"))) {
+        if (!$config['cops_alex_ebook_link_prefix'] && !file_exists ($this->getFilePath ("jpg"))) {
             // double check
             $this->hasCover = 0;
         }
@@ -562,4 +562,27 @@
         return $entryArray;
     }
 
+    public function get_remote_link ($type, $bookId) {
+       global $config;
+       $file = $this->getFilePath ($type);
+       if (! $config['cops_alex_cover_remote_link_prefix'] ) return $file;
+
+       $cache = $config['cops_alex_cover_cache_prefix'].$bookId.".jpg";
+       if ($bookId && file_exists ($cache)) { return $cache; }
+
+       $file = $config['cops_alex_cover_remote_link_prefix'] . str_replace('%2F','/', rawurlencode($file));
+       $ch = curl_init($file);
+       curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+       $curl_data = curl_exec($ch);
+       if (curl_errno($ch) == 0) {
+         if ($fd = @fopen($config['cops_alex_cover_cache_prefix'].$bookId.".jpg", "wb")) {
+            fwrite($fd, $curl_data);
+            fclose($fd);
+            $file = $config['cops_alex_cover_cache_prefix'].$bookId.".jpg";
+        }
+       }
+       return $file;
+   }
+
+
 }
diff -urN ../ebook.orig/data.php ./data.php
--- ../ebook.orig/data.php      2013-07-22 14:07:38.000000000 +0200
+++ ./data.php  2013-08-27 10:11:29.057281377 +0200
@@ -139,7 +139,7 @@
         }
         else
         {
-            return new Link (str_replace('%2F','/',rawurlencode ($book->path."/".$filename)), $mime, $rel, $title);
+            return new Link (str_replace('%2F','/',$config['cops_alex_ebook_link_prefix'].rawurlencode ($book->path."/".$filename)), $mime, $rel, $title);
         }
     }
 }
diff -urN ../ebook.orig/fetch.php ./fetch.php
--- ../ebook.orig/fetch.php     2013-07-22 14:10:50.000000000 +0200
+++ ./fetch.php 2013-08-27 11:38:34.069344458 +0200
@@ -45,7 +45,7 @@
         } else {
             $file = $book->getFilePath ($type, $idData);
         }
-        if (!$file || !file_exists ($file)) {
+        if (!$config['cops_alex_cover_remote_link_prefix'] && (!$file || !file_exists ($file))) {
             notFound ();
             return;
         }
@@ -57,7 +57,8 @@
             header("Content-Type: image/jpeg");
             if (isset($_GET["width"]))
             {
-                $file = $book->getFilePath ($type);
+                //$file = $book->getFilePath ($type);
+               $file = $book->get_remote_link($type, $bookId);
                 // get image size
                 if($size = GetImageSize($file)){
                     $w = $size[0];
@@ -83,7 +84,8 @@
             }
             if (isset($_GET["height"]))
             {
-                $file = $book->getFilePath ($type);
+                //$file = $book->getFilePath ($type);
+               $file = $book->get_remote_link($type, $bookId);
                 // get image size
                 if($size = GetImageSize($file)){
                     $w = $size[0];
@@ -119,6 +121,7 @@
         return;
     }
     if ($type == "jpg") {
+        $file = $book->get_remote_link($type, $bookId);
         header('Content-Disposition: filename="' . basename ($file) . '"');
     } else {
         header('Content-Disposition: attachment; filename="' . basename ($file) . '"');
@@ -131,6 +134,7 @@
     
     if (empty ($config['cops_x_accel_redirect'])) {
         $filename = $dir . $file;
+       if ($config['cops_alex_cover_remote_link_prefix']) { $filename = $file; }
         $fp = fopen($filename, 'rb');
         header("Content-Length: " . filesize($filename));
         fpassthru($fp);
These are the new config options:

Code:
$config['cops_alex_ebook_link_prefix'] = "/cgi-bin/ebook/drop.pl/calibre-books/";
$config['cops_alex_cover_remote_link_prefix'] = "http://my.server.com/cgi-bin/ebook/drop.pl/calibre-books/";
$config['cops_alex_cover_cache_prefix'] = "/tmp/cops6ebook";
Maybe this is of any help to some of you. I would like to see something like this in a future version of COPS if there is any interest.

This is all very quick and dirty.

Thanks for COPS.
Alex
zitronenrollchen is offline   Reply With Quote
Old 09-18-2013, 02:56 PM   #612
vlad59
Addict
vlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five wordsvlad59 can name that ebook in five words
 
Posts: 369
Karma: 37869
Join Date: Sep 2011
Device: Kobo eReader Touch, Kobo Aura HD
@wikiped

Don't worry, I just committed it on Github so next version will be fixed. Thanks for the test.

@zitronenrollchen

I once thought of accessing my Calibre library like you, but my legendary laziness was stronger and I preferred a easier solution.

Anyway I'll have to think about it. If your solution had been fully in PHP I would certainly have merged it after a quick review, but using a perl script bugs me (heavier maintenance, harder to explain to average Joe user, ...).

That being said, thanks for sharing your work and I'll get back to you.
vlad59 is offline   Reply With Quote
Old 09-19-2013, 07:36 AM   #613
zitronenrollchen
Junior Member
zitronenrollchen began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Feb 2013
Device: Kindle NT
Quote:
Originally Posted by vlad59 View Post
@wikiped
If your solution had been fully in PHP I would certainly have merged it after a quick review, but using a perl script bugs me (heavier maintenance, harder to explain to average Joe user, ...).
Thanks for your reply.

The perl stuff can easily be done in PHP with
https://www.dropbox.com/developers/core/sdks/php

All the script does is getting a file via the Dropbox API and delivering it to the client.

Using the API removes the need for putting ebook files in a "Public" dropbox folder. The approach might be useful with other cloud providers.

Alex
zitronenrollchen is offline   Reply With Quote
Old 09-20-2013, 07:24 AM   #614
evillevi
Junior Member
evillevi began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Aug 2013
Device: Ipad 2
Great work, you've just made my day! Browsing on Synology 112 is now much much faster!
evillevi is offline   Reply With Quote
Old 09-21-2013, 02:38 AM   #615
halfcore
Junior Member
halfcore began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Sep 2013
Device: ibook
vlad59,

Sorry if you have already answered this question before. The device I am trying to install on only have php 5.2.17. How much work would need to be done on my end to make it work? So far I get error on preg_replace_callback. I have searched high and low for php 5.3 but it's not available for my Seagate Wireless Plus.

Thanks,

halfcore
halfcore is offline   Reply With Quote
Reply

Tags
calibre opds, dns, kobo aura, synology

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 10:37 PM.


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