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.43k stars 229 forks source link

Ability to filter formats #461

Open PeterJT opened 4 years ago

PeterJT commented 4 years ago

My calibrte library includes many entries with an ORIGINAL_epub format. A configurable option to ewmovw these from COPS would be most useful.

horus68 commented 4 years ago

Those formats shouldn't be in the Calibre folders. They are backups created by Calibre when you converted a book. Its just for safety until you check the conversion quality, then they should be removed. You can delete all of them from Calibre at once using the menu from "Remove books / Remove files of a specific format from the selected books". Always keep Calibre folders clean! If you want you can also avoid the backup creation in Calibre settings (only not recommended!)

PeterJT commented 4 years ago

While I agree that they're not required, I disagree that they should not be in the calibre library. They are created by calibre for good reasons

marioscube commented 4 years ago

I only see ORIGINAL_epub in the detailed book view (not on the main page).

It's not a (major) problem for me, however I would welcome a cops-option (in config_local.php) to exclude one or more formats (like ORIGINAL_epub, lit, imp, etc) from COPS while not deleting anything from the calibre database.

horus68 commented 4 years ago

I can understand the need for an option to hide formats from the detail view. Maybe @seblucas can join in and say if this would be a possibility

horus68 commented 4 years ago

quote from old post by "seblucas: https://github.com/seblucas/cops/issues/317#issuecomment-270368043

Straight answer : not possible for now.
If you know PHP, it should be fairly easy to add. Just by tweaking getDataByBook : 

Maybe someone can solve this one? The code lines are https://github.com/seblucas/cops/blob/master/lib/Data.php#L147-L158

            preg_match("/Kobo/", $_SERVER['HTTP_USER_AGENT'])) {
            $href .= rawurlencode ($this->getUpdatedFilenameKepub ());
        } else {
            $href .= rawurlencode ($this->getFilename ());
        }
        return new Link ($href, $this->getMimeType (), Link::OPDS_ACQUISITION_TYPE, $title);
    }
    public static function getDataByBook ($book) {
        $out = array ();
        $result = parent::getDb ()->prepare('select id, format, name
                                             from data where book = ?');