generated thesis covers

master
Michael Murtaugh 1 year ago
parent 6660f39c77
commit 903d2a7fa3

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

@ -2,4 +2,12 @@ index.json: index.html
python3 scripts/extract_rdf.py > $@
index_titles.html: index.json scripts/templates/index_titles.html scripts/index_new.py
python3 scripts/index_new.py
python3 scripts/index_new.py
venv/:
python3 -m venv venv
source venv/bin/activate
pip install html5lib jinja2 rdflib pyrdfa3
merge.json: index.json covers.json
python3 scripts/merge_json.py index.json covers.json > $@

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

@ -0,0 +1,205 @@
{
"@context": "https://xpub.nl/contexts/projects.json",
"@graph": [
{
"cover": "https://project.xpub.nl/thanks_for_listening/thesis_mitsitron.cover.jpg",
"url": "https://project.xpub.nl/thanks_for_listening/"
},
{
"cover": "https://project.xpub.nl/terrafying-hear-say/pdf/thesis.cover.jpg",
"url": "https://project.xpub.nl/terrafying-hear-say/"
},
{
"cover": "https://project.xpub.nl/alt-reality-lexicon/pdf/Publication-AltRealityLexBook.cover.jpg",
"url": "https://project.xpub.nl/alt-reality-lexicon/"
},
{
"cover": "https://project.xpub.nl/sound-jams/alnik-xpub-thesis.cover.jpg",
"url": "https://project.xpub.nl/sound-jams/"
},
{
"cover": "https://project.xpub.nl/usx/Nami%20Kim_graduation%20thesis_Xpub.cover.jpg",
"url": "https://project.xpub.nl/usx/"
},
{
"cover": "https://project.xpub.nl/minor_stories/pdf/%28compressed%29_spark%28l%29ing_curiosities_through_intimate_publishing.cover.jpg",
"url": "https://project.xpub.nl/minor_stories/"
},
{
"cover": "https://project.xpub.nl/lever_burns/pdf/Ezn_LeverBurns.cover.jpg",
"url": "https://project.xpub.nl/lever_burns/"
},
{
"cover": "https://project.xpub.nl/desire_revolution/pdf/A%20SAILORS%20GUIDE%20TO%20EARTH_Clara%20Noseda.cover.jpg",
"url": "https://project.xpub.nl/desire_revolution/"
},
{
"cover": "https://project.xpub.nl/habitat/Thesis--Habitat--Living-sharing-adapting---Jacopo-Lega.cover.jpg",
"url": "https://project.xpub.nl/habitat/"
},
{
"cover": "https://project.xpub.nl/referendum-medialogs/pdf/Publication-referendum_medialogs.cover.jpg",
"url": "https://project.xpub.nl/referendum-medialogs/"
},
{
"cover": "https://project.xpub.nl/low-tech-chronicles/PDF/Mark_van_den_Heuvel_thesis_light-edition.cover.jpg",
"url": "https://project.xpub.nl/low-tech-chronicles/"
},
{
"cover": "https://project.xpub.nl/the-constitution/pdf/Tisa-Ne%C5%BEa-Herlec_The-Constitution.cover.jpg",
"url": "https://project.xpub.nl/the-constitution/"
},
{
"cover": "https://project.xpub.nl/when-you-might-go-astray/pdf/wymga.cover.jpg",
"url": "https://project.xpub.nl/when-you-might-go-astray/"
},
{
"cover": "https://project.xpub.nl/howtobeasocialjusticewarrior/img/Masterthesis_MiriamSch%C3%B6b_TheLeftCanMeme.cover.jpg",
"url": "https://project.xpub.nl/howtobeasocialjusticewarrior/"
},
{
"cover": "https://project.xpub.nl/sobremesa/pdf/thesis.cover.jpg",
"url": "https://project.xpub.nl/sobremesa/"
},
{
"cover": "https://project.xpub.nl/cartographies-of-counter-speculation/pdf/garcia-paloma-cartographies-of-invisibility.cover.jpg",
"url": "https://project.xpub.nl/cartographies-of-counter-speculation/"
},
{
"cover": "https://project.xpub.nl/smart-speaker-theatre/pdf/ghost_in_the_speaker.cover.jpg",
"url": "https://project.xpub.nl/smart-speaker-theatre/"
},
{
"cover": "https://project.xpub.nl/lets-amplify-unspeakable-things/pdf/diakrousi-lets-amplify-unspeakable-things.cover.jpg",
"url": "https://project.xpub.nl/lets-amplify-unspeakable-things/"
},
{
"cover": "https://project.xpub.nl/parallel-colonialism/pdf/bohye-woo-thesis-2020.cover.jpg",
"url": "https://project.xpub.nl/parallel-colonialism/"
},
{
"cover": "https://project.xpub.nl/notitleyet/pdf/Martin_Foucaut_Graduation_Thesis_XPUB_2022.cover.jpg",
"url": "https://project.xpub.nl/notitleyet/"
},
{
"cover": "https://project.xpub.nl/hacking-maintenance-with-care/pdf/HMWC.cover.jpg",
"url": "https://project.xpub.nl/hacking-maintenance-with-care/"
},
{
"cover": "https://project.xpub.nl/how-to-make-a-notebook-that/Thesis-Paper-Notebooks.cover.jpg",
"url": "https://project.xpub.nl/how-to-make-a-notebook-that/"
},
{
"cover": "https://project.xpub.nl/the-bootleg-library/pdf/thesis.cover.jpg",
"url": "https://project.xpub.nl/the-bootleg-library/"
},
{
"cover": "https://project.xpub.nl/unpublishing/pdf/Thesis-N.Rotem-Stibbe.cover.jpg",
"url": "https://project.xpub.nl/unpublishing/"
},
{
"cover": "https://project.xpub.nl/eigengrau/pdf/Phantasmagoria_Zalan_Szakacs_Thesis.cover.jpg",
"url": "https://project.xpub.nl/eigengrau/"
},
{
"cover": "https://project.xpub.nl/tactical-watermarks/pdf/Thesis_Master_PSC_HD.cover.jpg",
"url": "https://project.xpub.nl/tactical-watermarks/"
},
{
"cover": "https://project.xpub.nl/nothanks/pdf/THESIS-compressed.cover.jpg",
"url": "https://project.xpub.nl/nothanks/"
},
{
"cover": "https://project.xpub.nl/networks-of-care/pdf/networksofcare_thesis.cover.jpg",
"url": "https://project.xpub.nl/networks-of-care/"
},
{
"cover": "https://project.xpub.nl/anomolous-faces/pdf/Publication-POD_Thesis_Max-Franklin.cover.jpg",
"url": "https://project.xpub.nl/anomolous-faces/"
},
{
"cover": "https://project.xpub.nl/back-it-up/pdf/Publication-Karina_ABC_thesis.cover.jpg",
"url": "https://project.xpub.nl/back-it-up/"
},
{
"cover": "https://project.xpub.nl/frabjousish/pdf/thesis.cover.jpg",
"url": "https://project.xpub.nl/frabjousish/"
},
{
"cover": "https://project.xpub.nl/dear-cross-maker/supi_Cross-Making.cover.jpg",
"url": "https://project.xpub.nl/dear-cross-maker/"
},
{
"cover": "https://project.xpub.nl/is-it-time-to-eat-or-is-there-no-more-time-to-eat/pdf/your-body-will-make-itself-heard.cover.jpg",
"url": "https://project.xpub.nl/is-it-time-to-eat-or-is-there-no-more-time-to-eat/"
},
{
"cover": "https://project.xpub.nl/unlearning-the-rules-of-collectivity/pdf/Publication-thesis%20Giuliade%20Giovanelli.cover.jpg",
"url": "https://project.xpub.nl/unlearning-the-rules-of-collectivity/"
},
{
"cover": "https://project.xpub.nl/generatingstories/thesis.cover.jpg",
"url": "https://project.xpub.nl/generatingstories/"
},
{
"cover": "https://project.xpub.nl/ilinx/pdf/OHE.cover.jpg",
"url": "https://project.xpub.nl/ilinx/"
},
{
"cover": "https://project.xpub.nl/hello-worlding/Hello%20Worlding%20-%20kamo%20-%20THE%20REAL%20ONE.cover.jpg",
"url": "https://project.xpub.nl/hello-worlding/"
},
{
"cover": "https://project.xpub.nl/social-shelves-project/xpub_master-thesis_gersande-schellinx.cover.jpg",
"url": "https://project.xpub.nl/social-shelves-project/"
},
{
"cover": "https://project.xpub.nl/syster-papyri-magicae/pdf/ArtemisGryllaki-Thesis.cover.jpg",
"url": "https://project.xpub.nl/syster-papyri-magicae/"
},
{
"cover": "https://project.xpub.nl/the-repeater-archive/pdf/Biyi_Wen_Thesis.cover.jpg",
"url": "https://project.xpub.nl/the-repeater-archive/"
},
{
"cover": "https://project.xpub.nl/to-whom-it-may-affect/somewhere-highway-publishing.cover.jpg",
"url": "https://project.xpub.nl/to-whom-it-may-affect/"
},
{
"cover": "https://project.xpub.nl/868-mhz/asphaltspur.cover.jpg",
"url": "https://project.xpub.nl/868-mhz/"
},
{
"cover": "https://project.xpub.nl/modular-matter/modular-matter-Jian_Haake.cover.jpg",
"url": "https://project.xpub.nl/modular-matter/"
},
{
"cover": "https://project.xpub.nl/instant-warnet/pdf/Berting-Making-Silences-On-Social-Media.cover.jpg",
"url": "https://project.xpub.nl/instant-warnet/"
},
{
"cover": "https://project.xpub.nl/writing_cure/pdf/Avital_Barkai_thesis_compressed.cover.jpg",
"url": "https://project.xpub.nl/writing_cure/"
},
{
"cover": "https://project.xpub.nl/RuralComputing/pdf/thesis.cover.jpg",
"url": "https://project.xpub.nl/RuralComputing/"
},
{
"cover": "https://project.xpub.nl/makeinclusivewebsites/pdf/MaxLehmann_Thesis_compressed.cover.jpg",
"url": "https://project.xpub.nl/makeinclusivewebsites/"
},
{
"cover": "https://project.xpub.nl/poetic-software/pdf/poetic_software_thesis.cover.jpg",
"url": "https://project.xpub.nl/poetic-software/"
},
{
"cover": "https://project.xpub.nl/virtualgarden/XPUB-Cyberhotels-KB.cover.jpg",
"url": "https://project.xpub.nl/virtualgarden/"
},
{
"cover": "https://project.xpub.nl/attempting-diffraction/pdf/Camilo_Garcia_Aycardi_Graduation_Thesis_XPUB_.cover.jpg",
"url": "https://project.xpub.nl/attempting-diffraction/"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

@ -0,0 +1,55 @@
from pathlib import Path
from common import load_json
from urllib.parse import urlparse, quote as urlquote, unquote as urlunquote
from rdflib import Graph, Namespace, RDF, DCTERMS, URIRef
import subprocess
XPUB = Namespace("http://xpub.nl/terms/")
def url_to_path (url):
parts = urlparse(url)
if parts.hostname == "project.xpub.nl":
path = urlunquote(parts.path.lstrip('/'))
return Path(path)
def path_to_url(path):
return "https://project.xpub.nl/" + urlquote(str(path))
def make_cover (inpath, outpath, page=1):
p = subprocess.run(["gs", "-dSAFER", "-r600", "-sDEVICE=jpeg", f"-dFirstPage={page}", f"-dLastPage={page}", "-o", outpath, inpath])
if p.returncode == 0:
p = subprocess.run(["mogrify", "-resize", "640x", outpath])
return p.returncode == 0
g = Graph()
data = load_json()
for project in data['projects']:
print (project['thesis'])
p = url_to_path(project['thesis'])
cover_path = p.parent / (p.stem + ".cover.jpg")
g.add((URIRef(project['url']), XPUB['cover'], URIRef(path_to_url(cover_path))))
print (f" {p}->{cover_path}")
if not cover_path.exists():
make_cover(p, cover_path)
with open("covers.json", "w") as fout:
# print (g.serialize(), file=fout)
print (g.serialize(format="json-ld", context="https://xpub.nl/contexts/projects.json"), file=fout)
# from generated_covers import books_with_generated_covers
# import subprocess
# from shutil import copyfile
# for dbid, path in books_with_generated_covers("calibre"):
# for pdf in path.glob("*.pdf"):
# print (pdf)
# # gs -dSAFER -r600 -sDEVICE=jpeg -dFirstPage=2 -dLastPage=2 -o cover.jpg test.pdf && mogrify -resize 640x cover.jpg
# # gs -dSAFER -r600 -sDEVICE=jpeg -dLastPage=1 -o cover.jpg "calibre/Michael Moss/To talk of many things_ Of shoes--and ships--and sealing-wax--Of cabbages--and kings- (85)/To talk of many things_ Of shoes--and ship - Michael Moss.pdf"
# subprocess.run(["gs", "-dSAFER", "-r600", "-sDEVICE=jpeg", "-dLastPage=1", "-o", "cover.jpg", str(pdf)])
# subprocess.run(["mogrify", "-resize", "1200x", "cover.jpg"])
# subprocess.run(["exiftool", "-Comment=Generated cover: gs/pdffirstpage", "cover.jpg"])
# copyfile("cover.jpg", path / "cover.jpg")

@ -0,0 +1,22 @@
import rdflib
import json
import argparse
ap = argparse.ArgumentParser("")
ap.add_argument("input", nargs="+")
args = ap.parse_args()
context = None
u = rdflib.Graph()
for i in args.input:
if context is None:
with open(i) as fin:
data = json.load(fin)
if '@context' in data:
context = data['@context']
g = rdflib.Graph()
g.parse(i)
u += g
print (u.serialize(format="json-ld", context=context))

@ -14,6 +14,7 @@
"url": {"@id": "@id", "@type": "@id"},
"type": {"@id": "@type", "@type": "@id"},
"links": {"@id": "dc:link", "@type": "@id"},
"nicknames": "xpub:nick"
"nicknames": "xpub:nick",
"cover": { "@id": "xpub:cover", "@type": "@id" }
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Loading…
Cancel
Save