+ def get_extra_info_json(self):
+ return json.loads(self.extra_info or '{}')
+
+ def get_nice_filename(self):
+ parts_count = 1 + type(self).objects.filter(book=self.book, type=self.type).exclude(pk=self.pk).count()
+
+ name = self.book.slug
+ if parts_count > 0:
+ name += f'_{self.index:03d}'
+ if self.part_name:
+ name += f'_' + slugify(self.part_name)
+ ext = self.ext()
+ return f'{name}.{ext}'
+