Allow more book types

This commit is contained in:
Timothy Allen 2017-06-08 11:00:26 +02:00
parent ba70cacc6d
commit 1327de5766
1 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ else:
ebook_dir = os.path.expanduser(ebook_dir)
for root, dirs, files in os.walk(ebook_dir):
for file in files:
if re.search('.(rar|zip|epub|mobi|lit|html)(.\d+)?', file):
if re.search('.(rar|zip|epub|mobi|lit|html|rtf|azw3)(.\d+)?', file):
try:
if os.path.getmtime(file) >= age:
books.append(os.path.join(root, file))
@ -42,13 +42,13 @@ for book in books:
# unzip
archive = zipfile.ZipFile(book)
archive.extractall(tmp)
elif re.search('.(epub|mobi|lit|html)', book):
elif re.search('.(epub|mobi|lit|html|rtf|awz3)', book):
# copy book into tmp
shutil.copy(book, tmp)
# find epub, mobi or lit and import into calibre
for root, dirs, files in os.walk(tmp):
for file in files:
if re.search('.(epub|mobi|lit|html)$', file):
if re.search('.(epub|mobi|lit|html|rtf|azw3)$', file):
try:
subprocess.call(["calibredb", "add", os.path.join(root, file)])
except Exception, e: