Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 767b46c132456687503af5d9bd9e2f65b1e684be 1 parent 9fad542
Tom Parker authored

Showing 2 changed files with 4 additions and 5 deletions. Show diff stats Hide diff stats

  1. +2 3 books.py
  2. +2 2 common.py
5 books.py
@@ -7,7 +7,7 @@
7 7 from codecs import open
8 8 from urlparse import urljoin
9 9 from optparse import OptionParser
10   -from common import generatePage, tocStart, tocEnd
  10 +from common import generatePage, tocStart, tocEnd, makeMobi
11 11
12 12 c = Cache()
13 13
@@ -86,8 +86,7 @@
86 86 break
87 87 page = newpage
88 88 tocEnd(toc)
89   - if newitems:
90   - makeMobi(folder, s.author)
  89 + makeMobi(folder, s.author, newitems)
91 90
92 91 if page != None:
93 92 index +=1
4 common.py
@@ -56,8 +56,8 @@ def tocEnd(toc):
56 56 </html>""")
57 57 toc.close()
58 58
59   -def makeMobi(folder, author):
60   - if not exists(folder + ".mobi"):
  59 +def makeMobi(folder, author, newitems = False):
  60 + if newitems or not exists(folder + ".mobi"):
61 61 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)
62 62 print cmd
63 63 system(cmd)

0 comments on commit 767b46c

Please sign in to comment.
Something went wrong with that request. Please try again.