fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Legimi update.
[redakcja.git]
/
src
/
depot
/
models.py
diff --git
a/src/depot/models.py
b/src/depot/models.py
index
12bd9c2
..
e3b6dfd
100644
(file)
--- a/
src/depot/models.py
+++ b/
src/depot/models.py
@@
-35,18
+35,20
@@
class Package(models.Model):
return json.loads(self.status_json)
def set_status(self, status):
return json.loads(self.status_json)
def set_status(self, status):
- self.status_json = json.dumps(status, indent=4)
+ self.status_json = json.dumps(status, indent=4
, ensure_ascii=False
)
def get_definition(self):
return json.loads(self.definition_json)
def set_definition(self, definition):
def get_definition(self):
return json.loads(self.definition_json)
def set_definition(self, definition):
- self.definition_json = json.dumps(definition, indent=4)
+ self.definition_json = json.dumps(definition, indent=4
, ensure_ascii=False
)
def build(self):
f = tempfile.NamedTemporaryFile(prefix='depot-', suffix='.zip', mode='wb', delete=False)
def build(self):
f = tempfile.NamedTemporaryFile(prefix='depot-', suffix='.zip', mode='wb', delete=False)
+ book_count = self.books.all().count()
with zipfile.ZipFile(f, 'w') as z:
with zipfile.ZipFile(f, 'w') as z:
- for book in self.books.all():
+ for i, book in enumerate(self.books.all()):
+ print(f'{i}/{book_count} {book.slug}')
self.build_for(book, z)
f.close()
with open(f.name, 'rb') as ff:
self.build_for(book, z)
f.close()
with open(f.name, 'rb') as ff:
@@
-94,16
+96,20
@@
class Package(models.Model):
output = EpubBuilder(
cover=cover,
base_url=base_url,
output = EpubBuilder(
cover=cover,
base_url=base_url,
-# fundraising=[]
+ fundraising=item.get('fundraising', []),
).build(wldoc2)
elif item['type'] == 'mobi':
output = MobiBuilder(
cover=cover,
base_url=base_url,
).build(wldoc2)
elif item['type'] == 'mobi':
output = MobiBuilder(
cover=cover,
base_url=base_url,
+ fundraising=item.get('fundraising', []),
).build(wldoc2)
).build(wldoc2)
- fname = f'{slug}/{slug}.{ext}'
+ fname = f'{slug}/{slug}.'
+ if 'slug' in item:
+ fname += item['slug'] + '.'
+ fname += ext
z.writestr(
fname,
z.writestr(
fname,