Answers.Body: <p>You are better off noting that Calibre is a python app. First look at its command line options. Then if that is not enough create an addin or just code that uses calibre python code.</p>
  
  <p>One way might be to zip the HTML files together and pass that as the input file to ebook-convert see calibre documentation <a href="https://manual.calibre-ebook.com/generated/en/ebook-convert.html#recipe-input-options" rel="nofollow noreferrer">https://manual.calibre-ebook.com/generated/en/ebook-convert.html#recipe-input-options</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-08T13:19:41.077Z
Answers.LastActivityDate: 2019-09-08T18:29:14.957Z
Answers.LastEditDate: 2019-09-08T18:29:14.957Z
Answers.UserDisplayName: mmmmmm
Body: <p>I want to write a python automation program for merge html files in a epub using ebook-edit(in MacOS sub directory) in calibre. I know how to do it manually but I want to it many epub files automatically in python.
  What should I do after the opening the epub file with ebook-edit?</p>
  
  <pre><code>import os, shlex, keyboard, time
  
  from subprocess import Popen, PIPE
  
  filename = 'test.epub'
  command_line = '/Applications/calibre.app/Contents/MacOS/ebook-edit '+ '"'+ filename+ '"'
  args = shlex.split(command_line)
  p = Popen(args, stdin=PIPE)
  </code></pre>
  
Tags: <epub><calibre>
Title: ebook-edit in calibre automation with python
UserDisplayName: user13135
ThreadText: # ebook-edit in calibre automation with python
  
  (Asked by: username_0 on 2019-09-07)
  
  I want to write a python automation program for merge html files in a epub using ebook-edit(in MacOS sub directory) in calibre. I know how to do it manually but I want to it many epub files automatically in python.
  What should I do after the opening the epub file with ebook-edit?
  
  ```
  import os, shlex, keyboard, time
  
  from subprocess import Popen, PIPE
  
  filename = 'test.epub'
  command_line = '/Applications/calibre.app/Contents/MacOS/ebook-edit '+ '"'+ filename+ '"'
  args = shlex.split(command_line)
  p = Popen(args, stdin=PIPE)
  
  ```
  
  **Tags:** epub, calibre
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-09-08. Score: 0
  
  You are better off noting that Calibre is a python app. First look at its command line options. Then if that is not enough create an addin or just code that uses calibre python code.
  
  One way might be to zip the HTML files together and pass that as the input file to ebook-convert see calibre documentation <https://manual.calibre-ebook.com/generated/en/ebook-convert.html#recipe-input-options>
  
  
  ---
  
  