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