crunk
1 year ago
11 changed files with 5 additions and 426 deletions
@ -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 |
@ -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); |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.6 KiB |
@ -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 %} |
@ -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…
Reference in new issue