From 200b689f55cf6e809a09116c59d2ea5c0e11df0d Mon Sep 17 00:00:00 2001 From: crunk Date: Sat, 15 Jul 2023 14:36:55 +0200 Subject: [PATCH] remove varia specific code --- library/page.py | 35 ---------- library/rnrfeed/__init.py__ | 0 library/rnrfeed/rnrfeeder.py | 51 -------------- library/static/css/style.css | 6 +- library/static/js/script.js | 32 --------- library/static/svg/bookmark-latest.svg | 87 ------------------------ library/static/svg/bookmark-past.svg | 73 -------------------- library/static/svg/bookmark-upcoming.svg | 87 ------------------------ library/templates/base.html | 18 +---- library/templates/pastevents.html | 22 ------ library/templates/upcomingevent.html | 20 ------ 11 files changed, 5 insertions(+), 426 deletions(-) delete mode 100644 library/rnrfeed/__init.py__ delete mode 100644 library/rnrfeed/rnrfeeder.py delete mode 100644 library/static/js/script.js delete mode 100644 library/static/svg/bookmark-latest.svg delete mode 100644 library/static/svg/bookmark-past.svg delete mode 100644 library/static/svg/bookmark-upcoming.svg delete mode 100644 library/templates/pastevents.html delete mode 100644 library/templates/upcomingevent.html diff --git a/library/page.py b/library/page.py index 7930b14..e82e11b 100644 --- a/library/page.py +++ b/library/page.py @@ -19,7 +19,6 @@ from borrowform import BorrowForm from csvparser.csvparser import (editborrowedby, getfullpublication, getlicenses, getpublications, gettypes, getyears, writepublication) -from rnrfeed.rnrfeeder import getevents, getlatestevent from search import search from uploadform import PublicationForm @@ -96,40 +95,6 @@ def searchbooks(search_query): return json.dumps(search_results) -@APP.route("/pastevents") -def pastevents(): - """show past R&R events and book recommendations""" - events = getevents() - return render_template("pastevents.html", events=events) - - -@APP.route("/upcoming") -def latestevent(): - """show upcoming or latest R&R events and book recommendations""" - event = getlatestevent() - return render_template("upcomingevent.html", event=event) - - -@APP.context_processor -def upcoming_or_latest(): - """determines wether the newest R&R event is upcoming or not""" - upcoming = True - ics = get("https://varia.zone/events.ics").text - gcal = Calendar.from_ical(ics) - eventtimes = [ - c.get("dtstart").dt - for c in gcal.walk() - if c.name == "VEVENT" and "Read & Repair" in c.get("summary") - ] - now = datetime.datetime.now() - eventtimes.sort() - eventtimes.reverse() - if now > eventtimes[0]: - upcoming = False - - return dict(upcoming=upcoming) - - def saveimage(image, id): """helper function that can save images""" image.save(os.path.join(APP.config["UPLOAD_FOLDER"], image.filename)) diff --git a/library/rnrfeed/__init.py__ b/library/rnrfeed/__init.py__ deleted file mode 100644 index e69de29..0000000 diff --git a/library/rnrfeed/rnrfeeder.py b/library/rnrfeed/rnrfeeder.py deleted file mode 100644 index d7afe1e..0000000 --- a/library/rnrfeed/rnrfeeder.py +++ /dev/null @@ -1,51 +0,0 @@ -from feedparser import parse -from csvparser.csvparser import getfieldsofinterest, getfullpublication - -feed = parse("http://varia.zone/en/feeds/all-en.rss.xml") - - -def getentries(): - entries = {} - for entry in feed.entries: - if "readrepair" in entry.category: - entries[entry.title] = [] - entrylist = entries[entry.title] - entrylist.append(entry.description) - entrylist.append(rabbithole(entry)) - return entries - - -def getlatestevent(): - for entry in feed.entries: - if "readrepair" in entry.category: - entry[entry.title] = [] - entrylist = entry[entry.title] - entrylist.append(entry.description) - return entry - - -def gettitles(): - titles = [] - for entry in feed.entries: - if "readrepair" in entry.category: - titles.append(entry.title) - return titles - - -def rabbithole(entry): - pubtitles = {} - fieldsofinterest = getfieldsofinterest() - categories = [t.get('term').lower() for t in entry.tags] - for id, fields in fieldsofinterest.items(): - if [f for f in fields if(f.strip().lower() in categories)]: - # print("book found") - publicationinfo = getfullpublication(id) - fulltitle = "{0} - {1}".format( - publicationinfo["Author"], publicationinfo["Title"]) - pubtitles[id] = fulltitle - return pubtitles - - -def getevents(): - events = getentries() - return events diff --git a/library/static/css/style.css b/library/static/css/style.css index 26c87b7..ff64bc2 100644 --- a/library/static/css/style.css +++ b/library/static/css/style.css @@ -31,7 +31,7 @@ body:after { src: url(../fonts/LibreBaskerville-Regular.otf); } -#varia { +#library { line-height: 1.03em; position: relative; color: #FFFFFF; @@ -59,7 +59,7 @@ body:after { @supports (-webkit-text-stroke: 1px lightpink) { - #varia { + #library { -webkit-text-stroke: 1px lightpink; } } @@ -172,7 +172,7 @@ a:hover { text-decoration: none; } a:active { text-decoration: none; } @media only screen and (min-device-width: 320px) and (max-device-width: 480px) { - #varia { + #library { text-align: left; max-width: 70%; } diff --git a/library/static/js/script.js b/library/static/js/script.js deleted file mode 100644 index 80d7c01..0000000 --- a/library/static/js/script.js +++ /dev/null @@ -1,32 +0,0 @@ -// Cloud section ===================== old school code divider ================= -function rn(from, to) { - return ~~(Math.random() * (to - from + 1)) + from; -} - -function rs() { - return arguments[rn(1, arguments.length) - 1]; -} - -function boxShadows(max) { - let ret = []; - for (let i = 0; i < max; ++i) { - ret.push(` - ${ rn(1, 110) }vw ${ rn(1, 110) }vh ${ rn(20, 30) }vmin ${ rn(10, 60) }vmin - ${ rs('#F52D75', '#CCBD4F', '#32497F', '#EB4377') } - `) - } - return ret.join(','); -} - -const cloud = document.querySelector('#cloud'); - -function update() { - if (window.screen.availWidth > 400 && window.screen.availHeight > 400 ) { - cloud.style.boxShadow = boxShadows(30); - } - else { - document.body.style.backgroundImage = "linear-gradient(to bottom right, white, #F52D75)"; - } -} - -window.addEventListener('load', update); diff --git a/library/static/svg/bookmark-latest.svg b/library/static/svg/bookmark-latest.svg deleted file mode 100644 index 9a12d56..0000000 --- a/library/static/svg/bookmark-latest.svg +++ /dev/null @@ -1,87 +0,0 @@ - -image/svg+xml - - - -LatestRead & Repair diff --git a/library/static/svg/bookmark-past.svg b/library/static/svg/bookmark-past.svg deleted file mode 100644 index 1da2729..0000000 --- a/library/static/svg/bookmark-past.svg +++ /dev/null @@ -1,73 +0,0 @@ - -image/svg+xml - - - -Past Events diff --git a/library/static/svg/bookmark-upcoming.svg b/library/static/svg/bookmark-upcoming.svg deleted file mode 100644 index b75f396..0000000 --- a/library/static/svg/bookmark-upcoming.svg +++ /dev/null @@ -1,87 +0,0 @@ - -image/svg+xml - - - -UpcomingRead & Repair diff --git a/library/templates/base.html b/library/templates/base.html index 5ce0a7b..f6474b0 100644 --- a/library/templates/base.html +++ b/library/templates/base.html @@ -3,7 +3,7 @@ - varia library zone + library library zone @@ -16,22 +16,8 @@
-

VARIA LIBRARY COLLECTION

- - {% if upcoming %} - - {% else %} - - {% endif %} +

LIBRARY COLLECTION

{% block main %} {% endblock main %} - - - - - - - diff --git a/library/templates/pastevents.html b/library/templates/pastevents.html deleted file mode 100644 index a25fc67..0000000 --- a/library/templates/pastevents.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "base.html" %} -{% block main %} - -{% for eventtitle, text in events.items() %} -
-

{{ eventtitle }}

- {{ text[0]|safe }} -

For those interested to learn more on the topics of this read and repair event the physical library at varia offers the following books:

- -
-{% endfor%} -{% endblock %} diff --git a/library/templates/upcomingevent.html b/library/templates/upcomingevent.html deleted file mode 100644 index 5861936..0000000 --- a/library/templates/upcomingevent.html +++ /dev/null @@ -1,20 +0,0 @@ -{% extends "base.html" %} -{% block main %} - -
- {% if upcoming %} -

Upcoming event!

- {% else %} -

Unfortunately this Read&Repair event has already happened, keep an eye on varia.zone - or this site for upcoming Read&Repair and other Varia events!

- {% endif %} -

{{ event.title }}

- {{ event.description|safe }} -
-{% endblock %}