Add Calibre importer for CSV exports

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
This commit is contained in:
André Jaenisch 2022-04-30 15:25:09 +02:00
parent a4a06fa32c
commit 3626db3c1a
No known key found for this signature in database
GPG key ID: 5A668E771F1ED854
4 changed files with 15 additions and 0 deletions

View file

@ -1,6 +1,7 @@
""" import classes """ """ import classes """
from .importer import Importer from .importer import Importer
from .calibre_import import CalibreImporter
from .goodreads_import import GoodreadsImporter from .goodreads_import import GoodreadsImporter
from .librarything_import import LibrarythingImporter from .librarything_import import LibrarythingImporter
from .openlibrary_import import OpenLibraryImporter from .openlibrary_import import OpenLibraryImporter

View file

@ -0,0 +1,8 @@
""" handle reading a csv from calibre """
from . import Importer
class CalibreImporter(Importer):
"""csv downloads from OpenLibrary"""
service = "Calibre"

View file

@ -32,6 +32,9 @@
<option value="OpenLibrary" {% if current == 'OpenLibrary' %}selected{% endif %}> <option value="OpenLibrary" {% if current == 'OpenLibrary' %}selected{% endif %}>
OpenLibrary (CSV) OpenLibrary (CSV)
</option> </option>
<option value="Calibre" {% if current == 'Calibre' %}selected{% endif %}>
Calibre (CSV)
</option>
</select> </select>
</div> </div>

View file

@ -11,6 +11,7 @@ from django.views import View
from bookwyrm import forms, models from bookwyrm import forms, models
from bookwyrm.importers import ( from bookwyrm.importers import (
CalibreImporter,
LibrarythingImporter, LibrarythingImporter,
GoodreadsImporter, GoodreadsImporter,
StorygraphImporter, StorygraphImporter,
@ -52,6 +53,8 @@ class Import(View):
importer = StorygraphImporter() importer = StorygraphImporter()
elif source == "OpenLibrary": elif source == "OpenLibrary":
importer = OpenLibraryImporter() importer = OpenLibraryImporter()
elif source == "Calibre":
importer = CalibreImporter()
else: else:
# Default : Goodreads # Default : Goodreads
importer = GoodreadsImporter() importer = GoodreadsImporter()