Add meta types. 2.4.7
authorRadek Czajka <rczajka@rczajka.pl>
Mon, 18 Jul 2022 11:38:17 +0000 (13:38 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Mon, 18 Jul 2022 11:38:17 +0000 (13:38 +0200)
CHANGELOG.md
setup.py
src/librarian/dcparser.py
src/librarian/meta/types/text.py

index fd3ea03..eeb4c66 100644 (file)
@@ -3,7 +3,17 @@
 This document records all notable changes to Librarian.
 
 
 This document records all notable changes to Librarian.
 
 
-@@ 2.4.6 (2022-07-15)
+## 2.4.7 (2022-07-18)
+
+# Added
+- Metadata types.
+
+# Fixed
+- Don't validate comment contents.
+- Ignore translators on new cover if too long.
+
+
+## 2.4.6 (2022-07-15)
 
 # Fixed:
 - Bug in reading child books.
 
 # Fixed:
 - Bug in reading child books.
index a48f2d7..8cec542 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ def whole_tree(prefix, path):
 
 setup(
     name='librarian',
 
 setup(
     name='librarian',
-    version='2.4.6',
+    version='2.4.7',
     description='Converter from WolneLektury.pl XML-based language to XHTML, TXT and other formats',
     author="Marek StÄ™pniowski",
     author_email='marek@stepniowski.com',
     description='Converter from WolneLektury.pl XML-based language to XHTML, TXT and other formats',
     author="Marek StÄ™pniowski",
     author_email='marek@stepniowski.com',
index 7a11788..075c7c7 100644 (file)
@@ -18,11 +18,11 @@ from librarian.meta.types.bool import BoolValue
 from librarian.meta.types.date import DateValue
 from librarian.meta.types.person import Person
 from librarian.meta.types.wluri import WLURI
 from librarian.meta.types.date import DateValue
 from librarian.meta.types.person import Person
 from librarian.meta.types.wluri import WLURI
-from librarian.meta.types.text import TextValue
+from librarian.meta.types import text
 
 
 class Field(object):
 
 
 class Field(object):
-    def __init__(self, uri, attr_name, value_type=TextValue,
+    def __init__(self, uri, attr_name, value_type=text.TextValue,
                  multiple=False, salias=None, **kwargs):
         self.uri = uri
         self.name = attr_name
                  multiple=False, salias=None, **kwargs):
         self.uri = uri
         self.name = attr_name
@@ -353,16 +353,16 @@ class WorkInfo(six.with_metaclass(DCInfo, object)):
 
 class BookInfo(WorkInfo):
     FIELDS = (
 
 class BookInfo(WorkInfo):
     FIELDS = (
-        Field(DCNS('audience'), 'audiences', salias='audience', multiple=True,
+        Field(DCNS('audience'), 'audiences', text.Audience, salias='audience', multiple=True,
               required=False),
 
               required=False),
 
-        Field(DCNS('subject.period'), 'epochs', salias='epoch', multiple=True,
+        Field(DCNS('subject.period'), 'epochs', text.Epoch, salias='epoch', multiple=True,
               required=False),
               required=False),
-        Field(DCNS('subject.type'), 'kinds', salias='kind', multiple=True,
+        Field(DCNS('subject.type'), 'kinds', text.Kind, salias='kind', multiple=True,
               required=False),
               required=False),
-        Field(DCNS('subject.genre'), 'genres', salias='genre', multiple=True,
+        Field(DCNS('subject.genre'), 'genres', text.Genre, salias='genre', multiple=True,
               required=False),
               required=False),
-        Field(WLNS('category.legimi'), 'legimi', required=False),
+        Field(WLNS('category.legimi'), 'legimi', text.LegimiCategory, required=False),
 
         Field(DCNS('subject.location'), 'location', required=False),
 
 
         Field(DCNS('subject.location'), 'location', required=False),
 
index b53aa88..5241398 100644 (file)
@@ -8,3 +8,28 @@ class TextValue(MetaValue, str):
 
     def __str__(self):
         return self.value
 
     def __str__(self):
         return self.value
+
+
+
+class NameIdentifier(TextValue):
+    has_language = False
+
+
+class LegimiCategory(NameIdentifier):
+    pass
+
+    
+class Epoch(NameIdentifier):
+    pass
+
+
+class Kind(NameIdentifier):
+    pass
+
+
+class Genre(NameIdentifier):
+    pass
+
+
+class Audience(NameIdentifier):
+    pass