Giter Site home page Giter Site logo

kiwilan / php-opds Goto Github PK

View Code? Open in Web Editor NEW
4.0 0.0 2.0 424 KB

PHP package to create OPDS feed (Open Publication Distribution System) for eBooks.

Home Page: https://packagist.org/packages/kiwilan/php-opds

License: MIT License

PHP 100.00%
api atom book ebook opds php rss

php-opds's People

Contributors

dependabot[bot] avatar ewilan-riviere avatar github-actions[bot] avatar mikespub avatar

Stargazers

 avatar  avatar  avatar

php-opds's Issues

[Bug]: Paginator revisited

What happened?

I've been trying to find a good way to extend/replace the OpdsPaginator() so that it can generate the right output in json() or xml() without messing up the feeds in paginate() or using the wrong route(), but I can't seem to find it without some major code surgery.

Ideally I'd like to pass along the actual total, items per page and current page, perhaps with some callback to generate the right route for first/previous/next/last links, and then let json() and/or xml() do its work to generate the correct feed links.

Maybe we could have a public paginate() method in Opds() that could handle that, and not call some protected paginate() inside OpdsEngine()->feed() ?

How to reproduce the bug

Try to paginate

Package Version

1.0.30

PHP Version

8.2

Which operating systems does with happen with?

Linux

Notes

No response

[Bug]: JSON Schema validation fails due to 'modified' format and null properties

What happened?

I tried running json schema validation tests on the OPDS 2.0 output, but they failed whenever publications were included.

Reason is that the 'modified' property should be of type 'string' format 'date-time' like 2018-11-13T20:20:39+00:00
But it's actually an object in the JSON output: {"date":"2012-03-03 19:47:50.000000","timezone_type":1,"timezone":"+00:00"}

See https://json-schema.org/understanding-json-schema/reference/string.html#dates-and-times for details.

OPDS validation error{
    "/publications/0/metadata/modified": [
        "The data (object) must match the type: string"
    ]
}

How to reproduce the bug

Try to validate the OPDS 2.0 output against the JSON schema using opis/json-schema or some other validator

Package Version

1.0.23

PHP Version

8.2

Which operating systems does with happen with?

Linux

Notes

No response

[Bug]: OpdsPaginator is still created when usePaginator is false, and it checks that 'page' URL param is int

What happened?

When you have your own URL scheme that includes an URL parameter called 'page', and you configure Opds with usePaginator = false, OpdsPaginator is still created, and it still checks the query parameters to see if 'page' is there and is an int.

Hint: it's not (always) for COPS :-)

I would expect php-opds not to create a paginator, or at least not to choke on any URL param it has no business checking out.

Or as a fall-back measure, to be able to specify 'this-param-does-not-exist' in OpdsConfig, as the fake page param it should check out instead.

Hint: COPS uses 'n' as actual page param, so someday it might be nice to be able to configure that in php-opds...

PHP Fatal error:  Uncaught TypeError: Kiwilan\\Opds\\Engine\\OpdsPaginator::__construct(): Argument #8 ($page) must be of type int, string given, called in ./vendor/kiwilan/php-opds/src/Engine/OpdsPaginator.php on line 48 and defined in ./vendor/kiwilan/php-opds/src/Engine/OpdsPaginator.php:15
Stack trace:
#0 ./vendor/kiwilan/php-opds/src/Engine/OpdsPaginator.php(48): Kiwilan\\Opds\\Engine\\OpdsPaginator->__construct()
#1 ./vendor/kiwilan/php-opds/src/Engine/OpdsEngine.php(245): Kiwilan\\Opds\\Engine\\OpdsPaginator::make()
#2 ./vendor/kiwilan/php-opds/src/Engine/OpdsJsonEngine.php(68): Kiwilan\\Opds\\Engine\\OpdsEngine->paginate()
#3 ./vendor/kiwilan/php-opds/src/Engine/OpdsJsonEngine.php(23): Kiwilan\\Opds\\Engine\\OpdsJsonEngine->feed()
#4 ./vendor/kiwilan/php-opds/src/Opds.php(122): Kiwilan\\Opds\\Engine\\OpdsJsonEngine::make()
#5 ./lib/Output/KiwilanOPDS.php(191): Kiwilan\\Opds\\Opds->get()
#6 ./opds.php(47): SebLucas\\Cops\\Output\\KiwilanOPDS->render()
#7 {main}
thrown in ./vendor/kiwilan/php-opds/src/Engine/OpdsPaginator.php on line 15

How to reproduce the bug

Try OPDS feed with URL parameter ?page=index

Package Version

1.0.1

PHP Version

8.2

Which operating systems does with happen with?

Linux

Notes

Not sure what it actually does with an 'int' page, but it doesn't seem to bother it after that...

[Bug]: Parameter $volume of class Kiwilan\Opds\Entries\OpdsEntryBook constructor expects int|null, float|null give

What happened?

I might as well post this one too while I'm reporting issues :-)

As the title says, OpdsEntryBook expects 'volume' to be int, but Calibre actually uses float to cover series indexes like 1.25

And the OPDS 2.0 draft states that the 'position' it is converted to can be either an integer or a float:
https://github.com/readium/webpub-manifest/tree/master/contexts/default
which translates to type 'number' in json schema:
https://json-schema.org/understanding-json-schema/reference/numeric.html#number

How to reproduce the bug

Try to use calibre series_index for volume

Package Version

1.0.23

PHP Version

8.2

Which operating systems does with happen with?

Linux

Notes

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.