Quote:
Originally Posted by kovidgoyal
Bash is so last century Save the following as batch.py in the directory wth your epub files. Then run it as either
python batch.py
or
calibre-debug -e batch.py
Code:
#!/usr/bin/python
import os, time, glob, subprocess
files = glob.glob('*.epub')
workers = []
while files or workers:
while len(workers) < 4 and files:
f = files[0]
files = files[1:]
w = subprocess.Popen(['ebook-convert', f,
os.path.splitext(f)[0]+'.mobi'])
workers.append(w)
for w in list(workers):
if w.poll() is not None:
workers.remove(w)
time.sleep(0.1)
Change 4 to the number of worker processes you want.
|
Question, would this work under Windows, too?