Merge pull request #8 from Gluejar/lockss

lockss needs a page listing the books unglued in each year to crawl
pull/1/head
eshellman 2012-09-19 07:31:27 -07:00
commit 4d562b64d5
4 changed files with 40 additions and 3 deletions

View File

@ -99,12 +99,16 @@
</div>
</div>
{% block news %}
<div class="launch_top">
It's here: our first unglued edition. You can now <a href="/work/81724/">download <I>Oral Literature in Africa</I></a>.<br /><br />Campaigns to unglue more books <a href="http://blog.unglue.it/2012/09/13/update-on-unglue-it-relaunch/">will relaunch soon</a>.
</div>
{% endblock %}
{% block topsection %}{% endblock %}
{% block content %}{% endblock %}
</div>
{% block footer %}
<div id="footer">
<div class="js-main">
<div class="column">
@ -151,6 +155,7 @@ It's here: our first unglued edition. You can now <a href="/work/81724/">downlo
</div>
</div>
</div>
{% endblock %}
{% block counter %}
<script type="text/javascript">
@ -164,7 +169,8 @@ It's here: our first unglued edition. You can now <a href="/work/81724/">downlo
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>{% endblock %}
</script>
{% endblock %}
</body>
</html>

View File

@ -0,0 +1,14 @@
{% extends "base.html" %}
{% block news %}
{% endblock %}
{% block content %}
Books unglued in {{ year }} for the LOCKSS harvester to crawl.<br /><br />
{% for ebook in ebooks %}
<a href="{% url lockss ebook.work.id %}">{{ ebook.work.title }}</a><br />
{% endfor %}
{% endblock %}
{% block footer %}
{% endblock %}

View File

@ -44,6 +44,7 @@ urlpatterns = patterns(
url(r"^work/(?P<work_id>\d+)/preview/$", "work", {'action': 'preview'}, name="work_preview"),
url(r"^work/(?P<work_id>\d+)/acks/$", "work", {'action': 'acks'}, name="work_acks"),
url(r"^work/(?P<work_id>\d+)/lockss/$", "lockss", name="lockss"),
url(r"^lockss/(?P<year>\d+)/$", "lockss_manifest", name="lockss_manifest"),
url(r"^work/(?P<work_id>\d+)/download/$", "download", name="download"),
url(r"^work/\d+/acks/images/(?P<file_name>[\w\.]*)$", "static_redirect_view",{'dir': 'images'}),
url(r"^work/(?P<work_id>\d+)/librarything/$", "work_librarything", name="work_librarything"),

View File

@ -4,7 +4,7 @@ import json
import logging
import urllib
from datetime import timedelta
from datetime import timedelta, date
from regluit.utils.localdatetime import now, date_today
from random import randint
@ -2047,7 +2047,7 @@ def campaign_archive_js(request):
def lockss(request, work_id):
"""
manifest pages for lockss harvester
manifest pages for lockss harvester -- individual works
"""
work = safe_get_work(work_id)
try:
@ -2058,6 +2058,22 @@ def lockss(request, work_id):
return render(request, "lockss.html", {'work':work, 'ebooks':ebooks, 'authors':authors})
def lockss_manifest(request, year):
"""
manifest pages for lockss harvester -- yearly indices
(lockss needs pages listing all books unglued by year, with
programmatically determinable URLs)
"""
year = int(year)
start_date = date(year, 1, 1)
end_date = date(year, 12, 31)
try:
ebooks = models.Edition.objects.filter(unglued=True).filter(created__range=(start_date, end_date))
except:
ebooks = None
return render(request, "lockss_manifest.html", {'ebooks':ebooks, 'year': year})
def download(request, work_id):
context = {}
work = safe_get_work(work_id)