2021-03-08 16:49:10 +00:00
|
|
|
""" book and author data """
|
2020-09-17 20:02:52 +00:00
|
|
|
from dataclasses import dataclass, field
|
|
|
|
from typing import List
|
2020-03-28 02:52:05 +00:00
|
|
|
|
2020-11-28 01:58:21 +00:00
|
|
|
from .base_activity import ActivityObject
|
2021-04-15 23:35:04 +00:00
|
|
|
from .image import Document
|
2020-03-28 02:52:05 +00:00
|
|
|
|
2021-03-08 16:49:10 +00:00
|
|
|
|
2021-06-18 21:12:56 +00:00
|
|
|
# pylint: disable=invalid-name
|
2020-09-17 20:02:52 +00:00
|
|
|
@dataclass(init=False)
|
2021-04-07 01:00:54 +00:00
|
|
|
class BookData(ActivityObject):
|
2021-04-26 21:43:29 +00:00
|
|
|
"""shared fields for all book data and authors"""
|
2021-04-07 01:17:33 +00:00
|
|
|
|
2021-04-07 01:00:54 +00:00
|
|
|
openlibraryKey: str = None
|
|
|
|
inventaireId: str = None
|
|
|
|
librarythingKey: str = None
|
|
|
|
goodreadsKey: str = None
|
|
|
|
bnfId: str = None
|
2021-04-26 21:22:05 +00:00
|
|
|
lastEditedBy: str = None
|
2021-04-07 01:00:54 +00:00
|
|
|
|
|
|
|
|
2021-06-18 21:12:56 +00:00
|
|
|
# pylint: disable=invalid-name
|
2021-04-07 01:00:54 +00:00
|
|
|
@dataclass(init=False)
|
|
|
|
class Book(BookData):
|
2021-04-26 16:15:42 +00:00
|
|
|
"""serializes an edition or work, abstract"""
|
2021-03-08 16:49:10 +00:00
|
|
|
|
2020-09-17 20:02:52 +00:00
|
|
|
title: str
|
2021-03-08 16:49:10 +00:00
|
|
|
sortTitle: str = ""
|
|
|
|
subtitle: str = ""
|
|
|
|
description: str = ""
|
2020-11-28 18:18:24 +00:00
|
|
|
languages: List[str] = field(default_factory=lambda: [])
|
2021-03-08 16:49:10 +00:00
|
|
|
series: str = ""
|
|
|
|
seriesNumber: str = ""
|
2020-11-28 18:18:24 +00:00
|
|
|
subjects: List[str] = field(default_factory=lambda: [])
|
|
|
|
subjectPlaces: List[str] = field(default_factory=lambda: [])
|
2020-03-28 04:28:52 +00:00
|
|
|
|
2020-11-28 18:18:24 +00:00
|
|
|
authors: List[str] = field(default_factory=lambda: [])
|
2021-03-08 16:49:10 +00:00
|
|
|
firstPublishedDate: str = ""
|
|
|
|
publishedDate: str = ""
|
2020-11-27 23:34:47 +00:00
|
|
|
|
2021-04-15 23:35:04 +00:00
|
|
|
cover: Document = None
|
2021-03-08 16:49:10 +00:00
|
|
|
type: str = "Book"
|
2020-05-08 23:56:49 +00:00
|
|
|
|
2020-03-28 02:52:05 +00:00
|
|
|
|
2021-06-18 21:12:56 +00:00
|
|
|
# pylint: disable=invalid-name
|
2020-09-17 20:02:52 +00:00
|
|
|
@dataclass(init=False)
|
|
|
|
class Edition(Book):
|
2021-04-26 16:15:42 +00:00
|
|
|
"""Edition instance of a book object"""
|
2021-03-08 16:49:10 +00:00
|
|
|
|
2020-09-17 20:02:52 +00:00
|
|
|
work: str
|
2021-03-08 16:49:10 +00:00
|
|
|
isbn10: str = ""
|
|
|
|
isbn13: str = ""
|
|
|
|
oclcNumber: str = ""
|
|
|
|
asin: str = ""
|
2020-12-17 20:02:59 +00:00
|
|
|
pages: int = None
|
2021-03-08 16:49:10 +00:00
|
|
|
physicalFormat: str = ""
|
2021-09-07 19:51:07 +00:00
|
|
|
physicalFormatDetail: str = ""
|
2020-11-28 18:18:24 +00:00
|
|
|
publishers: List[str] = field(default_factory=lambda: [])
|
2021-01-11 17:49:32 +00:00
|
|
|
editionRank: int = 0
|
2020-11-28 18:18:24 +00:00
|
|
|
|
2021-03-08 16:49:10 +00:00
|
|
|
type: str = "Edition"
|
2020-03-28 02:52:05 +00:00
|
|
|
|
2020-05-10 04:52:13 +00:00
|
|
|
|
2021-06-18 21:12:56 +00:00
|
|
|
# pylint: disable=invalid-name
|
2020-09-17 20:02:52 +00:00
|
|
|
@dataclass(init=False)
|
|
|
|
class Work(Book):
|
2021-04-26 16:15:42 +00:00
|
|
|
"""work instance of a book object"""
|
2021-03-08 16:49:10 +00:00
|
|
|
|
|
|
|
lccn: str = ""
|
2020-12-20 00:14:05 +00:00
|
|
|
editions: List[str] = field(default_factory=lambda: [])
|
2021-03-08 16:49:10 +00:00
|
|
|
type: str = "Work"
|
2020-05-10 04:52:13 +00:00
|
|
|
|
|
|
|
|
2021-06-18 21:12:56 +00:00
|
|
|
# pylint: disable=invalid-name
|
2020-09-17 20:02:52 +00:00
|
|
|
@dataclass(init=False)
|
2021-04-07 01:00:54 +00:00
|
|
|
class Author(BookData):
|
2021-04-26 16:15:42 +00:00
|
|
|
"""author of a book"""
|
2021-03-08 16:49:10 +00:00
|
|
|
|
2020-09-17 20:02:52 +00:00
|
|
|
name: str
|
2021-04-07 01:00:54 +00:00
|
|
|
isni: str = None
|
|
|
|
viafId: str = None
|
|
|
|
gutenbergId: str = None
|
2020-12-20 00:14:05 +00:00
|
|
|
born: str = None
|
|
|
|
died: str = None
|
|
|
|
aliases: List[str] = field(default_factory=lambda: [])
|
2021-03-08 16:49:10 +00:00
|
|
|
bio: str = ""
|
|
|
|
wikipediaLink: str = ""
|
|
|
|
type: str = "Author"
|