Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Books.py: Run makeMobi always when the book is missing

  • Loading branch information...
commit 767b46c132456687503af5d9bd9e2f65b1e684be 1 parent 9fad542
@palfrey authored
Showing with 4 additions and 5 deletions.
  1. +2 −3 books.py
  2. +2 −2 common.py
View
5 books.py
@@ -7,7 +7,7 @@
from codecs import open
from urlparse import urljoin
from optparse import OptionParser
-from common import generatePage, tocStart, tocEnd
+from common import generatePage, tocStart, tocEnd, makeMobi
c = Cache()
@@ -86,8 +86,7 @@
break
page = newpage
tocEnd(toc)
- if newitems:
- makeMobi(folder, s.author)
+ makeMobi(folder, s.author, newitems)
if page != None:
index +=1
View
4 common.py
@@ -56,8 +56,8 @@ def tocEnd(toc):
</html>""")
toc.close()
-def makeMobi(folder, author):
- if not exists(folder + ".mobi"):
+def makeMobi(folder, author, newitems = False):
+ if newitems or not exists(folder + ".mobi"):
cmd = "rm -f book.zip && zip -j book.zip %s/* && ebook-convert book.zip \"%s.mobi\" --output-profile kindle --margin-top 0 --margin-bottom 0 --margin-left 0 --authors=\"%s\" --input-encoding=utf-8" %(folder.replace(" ", "\\ "), folder, author)
print cmd
system(cmd)
Please sign in to comment.
Something went wrong with that request. Please try again.