def __init__(self, prefix, lpath, title=None, authors=None, date=None, finished=False, current_page=None, size=None, other=None): Book.__init__(self, prefix, lpath, size, other) self.current_page = current_page self.finished = finished self.bookeen_id = None self.size = size if title is not None and len(title) > 0: self.title = title else: self.title = "(No title)" if authors is not None and len(authors) > 0: self.authors_from_string(authors) if self.author_sort is None or self.author_sort == "Unknown": self.author_sort = author_to_author_sort(authors) self.date = date self._new_book = False self.device_collections = [] self.path = os.path.join(prefix, lpath) if os.sep == '\\': self.path = self.path.replace('/', '\\') self.lpath = lpath.replace('\\', '/') else: self.lpath = lpath
def __init__(self, prefix, lpath, title, authors, mime, date, ContentType, thumbnail_name, size=None, other=None): Book_.__init__(self, prefix, lpath) self.title = title if not authors: self.authors = [''] else: self.authors = [authors] if not title: self.title = _('Unknown') self.mime = mime self.size = size # will be set later if None if ContentType == '6' and date is not None: self.datetime = time.strptime(date, "%Y-%m-%dT%H:%M:%S.%f") else: try: self.datetime = time.gmtime(os.path.getctime(self.path)) except: self.datetime = time.gmtime() if thumbnail_name is not None: self.thumbnail = ImageWrapper(thumbnail_name) self.tags = [] if other: self.smart_update(other)
def __init__(self, prefix, lpath, title=None, authors=None, mime=None, date=None, ContentType=None, thumbnail_name=None, size=None, other=None): from calibre.utils.date import parse_date # debug_print('Book::__init__ - title=', title) show_debug = title is not None and title.lower().find("xxxxx") >= 0 if show_debug: debug_print("Book::__init__ - title=", title, 'authors=', authors) debug_print("Book::__init__ - other=", other) Book_.__init__(self, prefix, lpath, size, other) if title is not None and len(title) > 0: self.title = title if authors is not None and len(authors) > 0: self.authors_from_string(authors) if self.author_sort is None or self.author_sort == "Unknown": self.author_sort = author_to_author_sort(authors) self.mime = mime self.size = size # will be set later if None if ContentType == '6' and date is not None: try: self.datetime = time.strptime(date, "%Y-%m-%dT%H:%M:%S.%f") except: try: self.datetime = time.strptime(date.split('+')[0], "%Y-%m-%dT%H:%M:%S") except: try: self.datetime = time.strptime(date.split('+')[0], "%Y-%m-%d") except: try: self.datetime = parse_date(date, assume_utc=True).timetuple() except: try: self.datetime = time.gmtime(os.path.getctime(self.path)) except: self.datetime = time.gmtime() self.contentID = None self.current_shelves = [] self.kobo_collections = [] self.kobo_series = None self.kobo_series_number = None self.can_put_on_shelves = True if thumbnail_name is not None: self.thumbnail = ImageWrapper(thumbnail_name) if show_debug: debug_print("Book::__init__ end - self=", self) debug_print("Book::__init__ end - title=", title, 'authors=', authors)