![]() |
#1 | ||
Enthusiast
![]() Posts: 41
Karma: 10
Join Date: Jun 2010
Location: Portland, OR
Device: M1 Max Mac Studio, iPad Pro 2018 12.9, iPhone 7
|
Using fetch-ebook-metadata from a python script
I hope this is in the right forum. If not please let me know.
I am trying to use Calibre's fetch-ebook-metadata command to grab metadata for a book and I am getting some inconsistent results depending on how I run the program. I am working on an M1 Mac mini with macOS 12.2, running from iterm2. Running `fetch-ebook-metadata --help` tells me I have the following plugins: ` All plugin names: Goodreads, Google, Google Images, Amazon.com, Edelweiss, Open Library, Big Book Search ` If I run `/Applications/calibre.app/Contents/MacOS/fetch-ebook-metadata --title="Devil House" --author="John Darnielle" -c DevilHouse.jpg -p Goodreads` I get good metadata, and a cover file. However, if I run the same command, but from within a Python script using: Code:
from subprocess import PIPE,run CalibreFetchCmd ='/Applications/calibre.app/Contents/MacOS/fetch-ebook-metadata' fetchcmd = [CalibreFetchCmd, f'--title="{title}"', f'--author="{author}"', f'-c "{title}-{author}.jpg"-p Goodreads'] result = run(fetchcmd, stdout=PIPE, stderr=PIPE, universal_newlines=True) "Cover : None" Here is the entire output of the command line invocation: Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,342
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You are not serializing the command line arguments properly in your python script. You want something like
['--title', title, '-c', cover_path, etc] |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Enthusiast
![]() Posts: 41
Karma: 10
Join Date: Jun 2010
Location: Portland, OR
Device: M1 Max Mac Studio, iPad Pro 2018 12.9, iPhone 7
|
I played around a bit with how I presented th parameters in the list to the subprocess.run() command, and got varying results. I tried this again on your suggestion, and I do see the cover file downloaded, but I still see some inconsistencies. I’ll do some more rigorous testing to figure out where I went wrong.
Thanks for the help. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question on fetch-ebook-metadata behavior | johnmcd | Library Management | 2 | 10-24-2021 11:00 AM |
Using calibredb and fetch-ebook-metadata to fix invalidly identified books | EldonMcGuinness | Library Management | 4 | 08-01-2019 01:10 PM |
New fetch-ebook-metadata errors | plo233 | Calibre | 6 | 08-24-2018 11:14 PM |
fetch-ebook-metadata.exe python error | dzog | Calibre | 2 | 11-04-2016 05:26 AM |
Import ebook conversion in python script | erollisi | Calibre | 1 | 08-19-2010 09:43 PM |