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