2020-09-17 20:02:52 +00:00
|
|
|
''' book and author data '''
|
|
|
|
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
|
|
|
|
from .image import Image
|
2020-03-28 02:52:05 +00:00
|
|
|
|
2020-09-17 20:02:52 +00:00
|
|
|
@dataclass(init=False)
|
|
|
|
class Book(ActivityObject):
|
|
|
|
''' serializes an edition or work, abstract '''
|
|
|
|
title: str
|
2020-11-27 23:34:47 +00:00
|
|
|
sortTitle: str = ''
|
|
|
|
subtitle: str = ''
|
|
|
|
description: str = ''
|
2020-11-28 18:18:24 +00:00
|
|
|
languages: List[str] = field(default_factory=lambda: [])
|
2020-11-27 23:34:47 +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: [])
|
2020-11-27 23:34:47 +00:00
|
|
|
firstPublishedDate: str = ''
|
|
|
|
publishedDate: str = ''
|
|
|
|
|
|
|
|
openlibraryKey: str = ''
|
|
|
|
librarythingKey: str = ''
|
|
|
|
goodreadsKey: str = ''
|
2020-03-28 02:52:05 +00:00
|
|
|
|
2020-11-28 01:58:21 +00:00
|
|
|
cover: Image = field(default_factory=lambda: {})
|
2020-09-17 20:02:52 +00:00
|
|
|
type: str = 'Book'
|
2020-05-08 23:56:49 +00:00
|
|
|
|
2020-03-28 02:52:05 +00:00
|
|
|
|
2020-09-17 20:02:52 +00:00
|
|
|
@dataclass(init=False)
|
|
|
|
class Edition(Book):
|
|
|
|
''' Edition instance of a book object '''
|
|
|
|
work: str
|
2020-11-28 18:18:24 +00:00
|
|
|
isbn10: str = ''
|
|
|
|
isbn13: str = ''
|
|
|
|
oclcNumber: str = ''
|
|
|
|
asin: str = ''
|
2020-12-17 20:02:59 +00:00
|
|
|
pages: int = None
|
2020-11-28 18:18:24 +00:00
|
|
|
physicalFormat: str = ''
|
|
|
|
publishers: List[str] = field(default_factory=lambda: [])
|
|
|
|
|
2020-09-17 20:02:52 +00:00
|
|
|
type: str = 'Edition'
|
2020-03-28 02:52:05 +00:00
|
|
|
|
2020-05-10 04:52:13 +00:00
|
|
|
|
2020-09-17 20:02:52 +00:00
|
|
|
@dataclass(init=False)
|
|
|
|
class Work(Book):
|
|
|
|
''' work instance of a book object '''
|
2020-11-28 18:18:24 +00:00
|
|
|
lccn: str = ''
|
2020-11-29 01:41:57 +00:00
|
|
|
defaultEdition: str = ''
|
2020-12-20 00:14:05 +00:00
|
|
|
editions: List[str] = field(default_factory=lambda: [])
|
2020-09-17 20:02:52 +00:00
|
|
|
type: str = 'Work'
|
2020-05-10 04:52:13 +00:00
|
|
|
|
|
|
|
|
2020-09-17 20:02:52 +00:00
|
|
|
@dataclass(init=False)
|
|
|
|
class Author(ActivityObject):
|
|
|
|
''' author of a book '''
|
|
|
|
name: str
|
2020-12-20 00:14:05 +00:00
|
|
|
born: str = None
|
|
|
|
died: str = None
|
|
|
|
aliases: List[str] = field(default_factory=lambda: [])
|
2020-11-27 22:54:08 +00:00
|
|
|
bio: str = ''
|
|
|
|
openlibraryKey: str = ''
|
2020-12-21 21:21:17 +00:00
|
|
|
librarythingKey: str = ''
|
|
|
|
goodreadsKey: str = ''
|
2020-11-27 22:54:08 +00:00
|
|
|
wikipediaLink: str = ''
|
2020-09-17 20:02:52 +00:00
|
|
|
type: str = 'Person'
|