06-26-2024, 02:02 PM | #1 |
Generally Awesome Person
Posts: 1,090
Karma: 2178847
Join Date: Jan 2013
Location: /dev/kmem
Device: Kobo Clara HD, Kindle Oasis
|
Execute calibredb from Python code?
I'm trying to tweak calibre-web (a Python web app using Flask) to allow using calibredb to process new books instead of it doing its own thing. The purpose is to allow uploading books that need certain plugins to be processed, like uploading a KePub file as KePub format. Why not just use calibre-server? calibre-web has the Kobo sync server and I really prefer doing things from one interface as much as possible.
Code:
>>> proc=subprocess.run(["/opt/calibre/calibredb", "add", "--library-path=/home/jgoguen/calibre-library", "/home/jgoguen/test-book.epub"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) >>> proc.returncode 0 >>> print(proc.stdout) Added book ids: 8 Code:
Usage: calibredb command [options] [arguments] calibredb is the command line interface to the calibre books database. command is one of: list add ... Is there some way I can better debug what's happening here? Or is there something else I need to do to make calibredb work when called from a Python web app? Or maybe there's something stupid I'm doing wrong here? |
06-26-2024, 06:35 PM | #2 |
Generally Awesome Person
Posts: 1,090
Karma: 2178847
Join Date: Jan 2013
Location: /dev/kmem
Device: Kobo Clara HD, Kindle Oasis
|
I have absolutely no idea what I may have changed, but suddenly it's working exactly as expected.
|
06-26-2024, 08:35 PM | #3 |
Bibliophagist
Posts: 41,263
Karma: 158182188
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Ahhh! Another I don't believe in miracles, I just depend on them moment.
|
06-26-2024, 08:43 PM | #4 |
Generally Awesome Person
Posts: 1,090
Karma: 2178847
Join Date: Jan 2013
Location: /dev/kmem
Device: Kobo Clara HD, Kindle Oasis
|
Half the time programming is staring at code wondering why it doesn’t work, the other half is wondering how it does work
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Converting ePub Python coding books to PDF outputs Python code far too small | lysakowski | Conversion | 9 | 04-30-2023 06:44 AM |
'calibredb add' throws python error when calibre-server is running | CubGeek | Server | 2 | 09-17-2021 12:01 PM |
How to debug calibredb error using Python tools? | plo233 | Development | 1 | 07-01-2019 01:39 PM |
Python error when accessing content server with calibredb | drawson1 | Library Management | 1 | 06-19-2018 01:08 PM |
Security Researcher Demoes Bug To Execute Unsigned Code on iOS Devices | kjk | Apple Devices | 0 | 11-07-2011 08:09 PM |