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 10-06-2024, 07:51 AM   #1
alfie74
Junior Member
alfie74 began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Aug 2024
Device: Sony PRS T-2
Calibre-web not updating when metadata.db is modified

Hi, I am having an issue with my calibre-web installation. I found that other users have been experiencing the same issue in the past, but I couldn't find any satisfying solution.

My goal is to keep managing my Calibre library on my desktop PC with the Calibre desktop application. I also need to connect an old ebook reader with USB, so I need this instance of Calibre to run on my PC. However, I also want to have the possibility to always access my library via web, even when my PC is not on. So I installed calibre-web on Docker on my Synology NAS. I set up a synchronization job, so that changes to the library on the PC are automatically synchronized to the NAS. It is a one-way synchronization, I wanted to make sure that only the Calibre desktop application is making changes to the main library.

This setup is working well, but there is one issue. When I add a new book to Calibre desktop, the metadata.db file is correctly updated on the NAS. However, this change is not visible on Calibre Web, until I restart Calibre Web (with Administration --> Restart).

I saw that some users in other forums suggested that one should not let another application modify the database while Calibre Web is running. That may well be the case, but then what should I do if I want to manage the database with Calibre desktop and at the same time use Calibre Web to make the content available to mobile devices? My understanding is that letting Calibre and Calibre Web use the same database (i.e., exactly the same file, without using a synchronization job) is also not recommended...

Thank you!
alfie74 is offline   Reply With Quote
Old 10-06-2024, 09:01 AM   #2
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,751
Karma: 75000002
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Unfortunately I've lost the solution I used to use but it was along these lines.

This was to handle the changes to the calibre library that I did a one-way sync from my PC to my NAS.
  • Ensure calibre-web is configured to allow reconnect endpoint
    See https://github.com/janeczku/calibre-...Line-Interface
  • Have a script active on the NAS that used inotifywait to monitor for changes to metadata.db (this would be triggered on the sync from the PC to my NAS of the calibre library)
  • On change being detected use curl to issue a request to calibre-web your_libray_ip/reconnect to force the database to be reloaded
PeterT is offline   Reply With Quote
Advert
Old 10-06-2024, 10:10 PM   #3
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,751
Karma: 75000002
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Rather than inotifwait it might be simpler to install entware and the monit package on your Synology and use it to monitor for changes to metadata.db and issue the curl command on change.

See https://www.mmonit.com for the monit command.

Sent from my Pixel 7a using Tapatalk
PeterT is offline   Reply With Quote
Old 10-07-2024, 01:34 AM   #4
haertig
Wizard
haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.
 
Posts: 1,804
Karma: 26951450
Join Date: Sep 2017
Device: PW3, Fire HD8 Gen7, Moto G7, Sansa Clip v2, Ruizu X26
I have the same setup as you. Calibre on my desktop computer, Calibre-Web in a docker container on a server.

I have a nightly cronjob (actually, systemd script and timer - but functionally the same as a cronjob) that runs on the server and does the following:
Code:
docker container stop calibre-novels
rsync -avzh --password-file=/root/credentials/rsync.calibre.credentials --chown=calibre:calibre rsync://calibre@192.168.0.2:873/novels/ /srv/books/novels/
sleep 2
docker container start calibre-novels
I run an rsync daemon on my desktop computer (192.168.0.2) On the server, /srv/books/novels is bind-mounted into Calibre-Webs docker container. Like you, I have found that Calibre-Web does not pick up database changes just by me copying the database. So I stop/restart the docker container. That's probably hitting it with a bigger hammer than is needed, but the big hammer works so why not?

The entire rsync takes only a few seconds, and I expect most of that time is taken by the "sleep" command. Which I don't know is really needed, but I tend to put these into scripts as a safety measure - especially when it's a script that takes seconds to run and runs in the middle of the night when I'm asleep.

This once-a-day rsync works fine for me since I don't need immediate access to newly added (or changed) eBooks. If you need immediate access, there's nothing stopping you from kicking off the servers rsync script remotely from your desktop. I do that quite often myself, like when I want to evaluate my work in Calibre as it appears in Calibre-Web.

There is a potential for problems if you leave Calibre running on your desktop, doing something to the database, while the rsync is running. In theory at least. But I have done this accidentally many times and never once seen any corruption result on the servers copy of the database. And running the rsync a second time would overwrite any corruption anyway since it's nor really "syncing" anything - just like you are doing, mine is a one-way copy from my desktop to the server as well. You could even build a shutdown of Calibre on the desktop computer into the rsync process if you wanted to.

If you decide to use Calibre (not Calibre-Web) on the server sometime in the future, you will probably want to add the (directory-adjusted) following line to the rsync script:
Code:
rsync -avzh --password-file=/root/credentials/rsync.calibre.credentials --chown=calibre:calibre rsync://calibre@192.168.0.2:873/config/ /home/calibre/.config/calibre/

Last edited by haertig; 10-07-2024 at 01:37 AM.
haertig is offline   Reply With Quote
Reply

Tags
calibre-web, docker, nas, sync failure, synology


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating Metadata on a Kobo by Calibre bluepeter Kobo Reader 12 10-14-2024 02:21 PM
Updating Calibre metadata mst KOReader 13 12-09-2022 10:23 AM
Modified date for entire database is updating toxteth Library Management 2 06-23-2021 07:09 AM
Metadata errors after updating to Calibre 3.6 drav666 Calibre 6 08-06-2017 04:04 AM
Calibre slow in updating metadata meandher57 Kobo Reader 7 07-14-2011 06:13 PM


All times are GMT -4. The time now is 03:49 AM.


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