Browse Source

remove varia specific code

main
crunk 1 year ago
parent
commit
200b689f55
  1. 35
      library/page.py
  2. 0
      library/rnrfeed/__init.py__
  3. 51
      library/rnrfeed/rnrfeeder.py
  4. 6
      library/static/css/style.css
  5. 32
      library/static/js/script.js
  6. 87
      library/static/svg/bookmark-latest.svg
  7. 73
      library/static/svg/bookmark-past.svg
  8. 87
      library/static/svg/bookmark-upcoming.svg
  9. 18
      library/templates/base.html
  10. 22
      library/templates/pastevents.html
  11. 20
      library/templates/upcomingevent.html

35
library/page.py

@ -19,7 +19,6 @@ from borrowform import BorrowForm
from csvparser.csvparser import (editborrowedby, getfullpublication, from csvparser.csvparser import (editborrowedby, getfullpublication,
getlicenses, getpublications, gettypes, getlicenses, getpublications, gettypes,
getyears, writepublication) getyears, writepublication)
from rnrfeed.rnrfeeder import getevents, getlatestevent
from search import search from search import search
from uploadform import PublicationForm from uploadform import PublicationForm
@ -96,40 +95,6 @@ def searchbooks(search_query):
return json.dumps(search_results) 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): def saveimage(image, id):
"""helper function that can save images""" """helper function that can save images"""
image.save(os.path.join(APP.config["UPLOAD_FOLDER"], image.filename)) image.save(os.path.join(APP.config["UPLOAD_FOLDER"], image.filename))

0
library/rnrfeed/__init.py__

51
library/rnrfeed/rnrfeeder.py

@ -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

6
library/static/css/style.css

@ -31,7 +31,7 @@ body:after {
src: url(../fonts/LibreBaskerville-Regular.otf); src: url(../fonts/LibreBaskerville-Regular.otf);
} }
#varia { #library {
line-height: 1.03em; line-height: 1.03em;
position: relative; position: relative;
color: #FFFFFF; color: #FFFFFF;
@ -59,7 +59,7 @@ body:after {
@supports (-webkit-text-stroke: 1px lightpink) { @supports (-webkit-text-stroke: 1px lightpink) {
#varia { #library {
-webkit-text-stroke: 1px lightpink; -webkit-text-stroke: 1px lightpink;
} }
} }
@ -172,7 +172,7 @@ a:hover { text-decoration: none; }
a:active { text-decoration: none; } a:active { text-decoration: none; }
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) { @media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
#varia { #library {
text-align: left; text-align: left;
max-width: 70%; max-width: 70%;
} }

32
library/static/js/script.js

@ -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);

87
library/static/svg/bookmark-latest.svg

@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Capa_1"
x="0px"
y="0px"
width="197.81665"
height="539.99939"
viewBox="0 0 197.06678 537.95139"
xml:space="preserve"
sodipodi:docname="bookmark-upcoming.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"><metadata
id="metadata13"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs11"><rect
x="207.04167"
y="97.061699"
width="111.52129"
height="86.161156"
id="rect17" /></defs><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1916"
inkscape:window-height="1041"
id="namedview9"
showgrid="false"
inkscape:zoom="1.0725863"
inkscape:cx="-8.3621061"
inkscape:cy="267.6066"
inkscape:window-x="1366"
inkscape:window-y="18"
inkscape:window-maximized="1"
inkscape:current-layer="Capa_1"
inkscape:document-rotation="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<g
id="g4"
transform="translate(-170.442,-5e-4)">
<path
d="M 346.164,0 H 191.939 c -11.857,0 -21.497,9.716 -21.497,21.497 v 505.894 c 0,11.857 6.12,14.076 13.617,4.896 0,0 56.304,-68.697 70.609,-87.822 14.306,-19.125 15.683,-21.268 32.972,0 17.365,21.268 66.938,87.363 66.938,87.363 7.191,9.41 12.929,7.496 12.929,-4.283 V 21.497 C 367.66,9.716 357.945,0 346.164,0 Z"
fill="#404d81"
id="path2" />
</g>
<text
xml:space="preserve"
id="text15"
style="font-size:40px;line-height:1.25;font-family:unscii;-inkscape-font-specification:unscii;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect17);"
transform="translate(-182.94372,-1.3642201)" /><text
xml:space="preserve"
style="font-size:42.6667px;line-height:1.25;font-family:unscii;-inkscape-font-specification:unscii;letter-spacing:0px;word-spacing:0px"
x="98.764069"
y="245.41867"
id="text23"
inkscape:transform-center-x="-22.440464"
inkscape:transform-center-y="6.5100632"><tspan
sodipodi:role="line"
id="tspan21"
x="98.764069"
y="245.41867"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:Carlito;-inkscape-font-specification:Carlito;text-align:center;text-anchor:middle;fill:#ffffff">Latest</tspan><tspan
sodipodi:role="line"
x="98.764069"
y="300.75204"
id="tspan25"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:Carlito;-inkscape-font-specification:Carlito;text-align:center;text-anchor:middle;fill:#ffffff">Read &amp; </tspan><tspan
sodipodi:role="line"
x="98.764069"
y="356.08542"
id="tspan27"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:Carlito;-inkscape-font-specification:Carlito;text-align:center;text-anchor:middle;fill:#ffffff">Repair</tspan></text></svg>

Before

Width:  |  Height:  |  Size: 3.6 KiB

73
library/static/svg/bookmark-past.svg

@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Capa_1"
x="0px"
y="0px"
width="197.81665"
height="539.99939"
viewBox="0 0 197.06678 537.95139"
xml:space="preserve"
sodipodi:docname="bookmark-past.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"><metadata
id="metadata11"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs9"><rect
x="177.97797"
y="223.17792"
width="182.00249"
height="193.39874"
id="rect21" /></defs><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="956"
inkscape:window-height="1041"
id="namedview7"
showgrid="false"
inkscape:zoom="1.0725863"
inkscape:cx="97.88594"
inkscape:cy="268.97551"
inkscape:window-x="2326"
inkscape:window-y="18"
inkscape:window-maximized="0"
inkscape:current-layer="Capa_1"
inkscape:document-rotation="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<g
id="g4"
transform="translate(-170.442,-5e-4)">
<path
d="M 346.164,0 H 191.939 c -11.857,0 -21.497,9.716 -21.497,21.497 v 505.894 c 0,11.857 6.12,14.076 13.617,4.896 0,0 56.304,-68.697 70.609,-87.822 14.306,-19.125 15.683,-21.268 32.972,0 17.365,21.268 66.938,87.363 66.938,87.363 7.191,9.41 12.929,7.496 12.929,-4.283 V 21.497 C 367.66,9.716 357.945,0 346.164,0 Z"
fill="#dd4f77"
id="path2" />
</g>
<text
xml:space="preserve"
id="text19"
style="font-size:42.6667px;line-height:1.25;font-family:unscii;-inkscape-font-specification:unscii;text-align:center;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect21);"
x="57.5"
y="0"
transform="translate(-170.442,-5e-4)"><tspan
x="232.94822"
y="262.5111"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Carlito;-inkscape-font-specification:Carlito;fill:#ffffff">Past </tspan></tspan><tspan
x="212.52112"
y="317.84447"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Carlito;-inkscape-font-specification:Carlito;fill:#ffffff">Events</tspan></tspan></text></svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

87
library/static/svg/bookmark-upcoming.svg

@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Capa_1"
x="0px"
y="0px"
width="197.81665"
height="539.99939"
viewBox="0 0 197.06678 537.95139"
xml:space="preserve"
sodipodi:docname="bookmark-upcoming.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"><metadata
id="metadata13"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs11"><rect
x="207.04167"
y="97.061699"
width="111.52129"
height="86.161156"
id="rect17" /></defs><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1916"
inkscape:window-height="1041"
id="namedview9"
showgrid="false"
inkscape:zoom="1.0725863"
inkscape:cx="-8.3621061"
inkscape:cy="267.6066"
inkscape:window-x="1366"
inkscape:window-y="18"
inkscape:window-maximized="1"
inkscape:current-layer="Capa_1"
inkscape:document-rotation="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<g
id="g4"
transform="translate(-170.442,-5e-4)">
<path
d="M 346.164,0 H 191.939 c -11.857,0 -21.497,9.716 -21.497,21.497 v 505.894 c 0,11.857 6.12,14.076 13.617,4.896 0,0 56.304,-68.697 70.609,-87.822 14.306,-19.125 15.683,-21.268 32.972,0 17.365,21.268 66.938,87.363 66.938,87.363 7.191,9.41 12.929,7.496 12.929,-4.283 V 21.497 C 367.66,9.716 357.945,0 346.164,0 Z"
fill="#404d81"
id="path2" />
</g>
<text
xml:space="preserve"
id="text15"
style="font-size:40px;line-height:1.25;font-family:unscii;-inkscape-font-specification:unscii;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect17);"
transform="translate(-182.94372,-1.3642201)" /><text
xml:space="preserve"
style="font-size:42.6667px;line-height:1.25;font-family:unscii;-inkscape-font-specification:unscii;letter-spacing:0px;word-spacing:0px"
x="98.764069"
y="245.41867"
id="text23"
inkscape:transform-center-x="-22.440464"
inkscape:transform-center-y="6.5100632"><tspan
sodipodi:role="line"
id="tspan21"
x="98.764069"
y="245.41867"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:Carlito;-inkscape-font-specification:Carlito;text-align:center;text-anchor:middle;fill:#ffffff">Upcoming</tspan><tspan
sodipodi:role="line"
x="98.764069"
y="300.75204"
id="tspan25"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:Carlito;-inkscape-font-specification:Carlito;text-align:center;text-anchor:middle;fill:#ffffff">Read &amp; </tspan><tspan
sodipodi:role="line"
x="98.764069"
y="356.08542"
id="tspan27"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:Carlito;-inkscape-font-specification:Carlito;text-align:center;text-anchor:middle;fill:#ffffff">Repair</tspan></text></svg>

Before

Width:  |  Height:  |  Size: 3.6 KiB

18
library/templates/base.html

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>varia library zone</title> <title>library library zone</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css')}}"> <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css')}}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/dropdown.css')}}"> <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/dropdown.css')}}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/bookmark.css')}}"> <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/bookmark.css')}}">
@ -16,22 +16,8 @@
</head> </head>
<body> <body>
<div id="cloud"></div> <div id="cloud"></div>
<a href="/"><h1 id="varia">VARIA LIBRARY COLLECTION</h1></a> <a href="/"><h1 id="library">LIBRARY COLLECTION</h1></a>
<a href="pastevents"><img src="{{ url_for('static', filename='svg/bookmark-past.svg')}}" id="pastevents" /></a>
{% if upcoming %}
<a href="upcoming"><img src="{{ url_for('static', filename='svg/bookmark-upcoming.svg')}}" id="upcomingevents" /></a>
{% else %}
<a href="upcoming"><img src="{{ url_for('static', filename='svg/bookmark-latest.svg')}}" id="upcomingevents" /></a>
{% endif %}
{% block main %} {% block main %}
{% endblock main %} {% endblock main %}
<svg width="0">
<filter id="filter">
<feTurbulence type="fractalNoise"
baseFrequency=".001" numOctaves="5" />
<feDisplacementMap in="SourceGraphic" scale="240" />
</filter>
</svg>
</body> </body>
<script src="{{ url_for('static', filename='js/script.js')}}"></script>
</html> </html>

22
library/templates/pastevents.html

@ -1,22 +0,0 @@
{% extends "base.html" %}
{% block main %}
<div id="nav" class="container">
<button id="leftmostbtn"><a href="/">All books</a></button>
<button><a href="/upload">Upload</a></button>
<div class="dropdown" style="visibility: hidden">
<button id="Year" class="dropbtn">Year</button>
</div>
</div>
{% for eventtitle, text in events.items() %}
<div class="event">
<h2>{{ eventtitle }}</h2>
{{ text[0]|safe }}
<p>For those interested to learn more on the topics of this read and repair event the physical library at varia offers the following books:</p>
<ul>
{% for link, booktitle in text[1].items() %}
<li><a href="/{{ link }}">{{ booktitle }}</a></li>
{% endfor%}
</ul>
</div>
{% endfor%}
{% endblock %}

20
library/templates/upcomingevent.html

@ -1,20 +0,0 @@
{% extends "base.html" %}
{% block main %}
<div id="nav" class="container">
<button id="leftmostbtn"><a href="/">All books</a></button>
<button><a href="/upload">Upload</a></button>
<div class="dropdown" style="visibility: hidden">
<button id="Year" class="dropbtn">Year</button>
</div>
</div>
<div class="event">
{% if upcoming %}
<h2 id="upcomingevent">Upcoming event!</h2>
{% else %}
<p id="latestevent">Unfortunately this Read&Repair event has already happened, keep an eye on <a href="http://varia.zone/">varia.zone</a>
or this site for upcoming Read&Repair and other Varia events!</p>
{% endif %}
<h2>{{ event.title }}</h2>
{{ event.description|safe }}
</div>
{% endblock %}
Loading…
Cancel
Save