From cf66c7db0a39ec379ba192036581cc72da513917 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 7 Feb 2024 00:09:42 -0500 Subject: [PATCH 1/3] make author relations and tag relations unique in db schema --- dlibrary/dlibrary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index 3d313b5..635157c 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -101,8 +101,8 @@ async def fetch_async(args): cur = con.cursor() cur.execute("CREATE TABLE IF NOT EXISTS works(id TEXT PRIMARY KEY, title TEXT, circle TEXT, date TEXT, description TEXT, series TEXT, virtual INT)") - cur.execute("CREATE TABLE IF NOT EXISTS authors(author TEXT, work TEXT, FOREIGN KEY(work) REFERENCES works(id))") - cur.execute("CREATE TABLE IF NOT EXISTS tags(tag TEXT, work TEXT, FOREIGN KEY(work) REFERENCES works(id))") + cur.execute("CREATE TABLE IF NOT EXISTS authors(author TEXT, work TEXT, FOREIGN KEY(work) REFERENCES works(id), PRIMARY KEY(author, work))") + cur.execute("CREATE TABLE IF NOT EXISTS tags(tag TEXT, work TEXT, FOREIGN KEY(work) REFERENCES works(id), PRIMARY KEY(tag, work))") thumbnails_dir = args.destdir / 'site' / 'thumbnails' thumbnails_dir.mkdir(parents=True, exist_ok=True) From 885b4884fdc2e276784edc7b385d426233f09e3f Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 7 Feb 2024 00:14:22 -0500 Subject: [PATCH 2/3] don't write description of 'None' if the field is empty --- dlibrary/templates/work.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlibrary/templates/work.html b/dlibrary/templates/work.html index 2bedfb2..c2860fa 100644 --- a/dlibrary/templates/work.html +++ b/dlibrary/templates/work.html @@ -36,7 +36,9 @@ {% endif %} + {% if work['description'] %} {{ work['description'] }} + {% endif %} {% endblock %} From 7ab32041c82bf244b4fd04252b6aec375b900f62 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 7 Feb 2024 00:24:30 -0500 Subject: [PATCH 3/3] import readline so hopefully input prompts will suck less --- dlibrary/dlibrary.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index 635157c..02371dc 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -7,6 +7,7 @@ from pathlib import Path import os from os.path import relpath, splitext import re +import readline import shutil import sqlite3 import textwrap