Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert ebooks storage to the database #336

Open
colagrosso opened this issue Feb 4, 2024 · 3 comments
Open

Convert ebooks storage to the database #336

colagrosso opened this issue Feb 4, 2024 · 3 comments
Assignees

Comments

@colagrosso
Copy link
Collaborator

This is a large project that may require multiple issues, but we'll start here.

To help with the discussion, I have a draft PR at #335 where I hacked up a schema, script, methods, etc. for Ebooks and EbookTags. No hard feelings if we have to scrap that PR and start a different way.

Question:

  • Would you be willing to create a separate, long-running branch like we did for covers? I think that would save you review time because you could review the changes periodically, and there would be no chance of breaking something in master.

Some notes about draft PR #335:

  • For now the script just reuses the Ebook constructor. Eventually we will have to break up that constructor into separate methods. Some of the logic is needed for populating the DB tables, and some is needed for setting request-time properties.
  • I haven't modified Library::FilterEbooks(), /ebooks/index.php, or /ebooks/ebook.php yet. I thought I would populate more fields in the DB tables first.
  • We'll need some other tables for Contributors, Git commits, Collections, etc.

The more I look, the more work I see to do, but we'll chip away at it. One nice thing is that the ebook webpages are all read-only (unlike the artwork site).

@colagrosso colagrosso self-assigned this Feb 4, 2024
@colagrosso
Copy link
Collaborator Author

I forgot to mention above, but I ran the script in #335 over a hundred or so ebooks, and it picked up the title, URL, and tags just fine. You can skip rebuilding the books and just update the database via:

for BOOK in $(find /standardebooks.org/ebooks -maxdepth 1 -type d)
do
  tsp nice /standardebooks.org/web/scripts/deploy-ebook-to-www -v --no-build --no-images --no-epubcheck --no-recompose --no-feeds --no-bulk-downloads --update-ebook-database $BOOK
done

@acabal
Copy link
Member

acabal commented Feb 5, 2024

For this project, I don't think we need one very large branch. Since we can do this piecemeal and release these updates as we make them, while still leaving the existing filesystem-based system in place to fill in the blanks, we can do each piece of work as its own PR.

@acabal
Copy link
Member

acabal commented Feb 5, 2024

I think we will probably drop Ebook::__construct() entirely in favor of several ::From* methods, like Ebook::FromFilesystem($path), Ebook::Get($ebookId), etc. much like Artwork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants