remove readmill, add dropbox

pull/1/head
eric 2014-05-20 12:19:34 -04:00
parent f2b34ddde9
commit 314847459b
9 changed files with 44 additions and 59 deletions

View File

@ -1636,6 +1636,9 @@ class Ebook(models.Model):
@property
def download_url(self):
return settings.BASE_URL_SECURE + reverse('download_ebook',args=[self.id])
def is_direct(self):
return self.provider!='Google Books'
def __unicode__(self):
return "%s (%s from %s)" % (self.edition.title, self.format, self.provider)

View File

@ -6,9 +6,9 @@
{% endblock %}
{% block extra_js %}
<script type="text/javascript" src="/static/js/readmill.js"></script>
<script type="text/javascript" src="/static/js/embed.js"></script>
<script type="text/javascript" src="/static/js/download_page.js"></script>
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function() {
@ -19,9 +19,10 @@ $j(document).ready(function() {
{% endblock %}
{% block content %}
<div class="download_container">
<div id="lightbox_content">
<span id="dropboxjs" data-app-key="{{ dropbox_key }}"></span>
{% if show_beg %}
<div class="border" style="padding: 10px; min-height: 18em">
<div id="askblock">
@ -81,12 +82,12 @@ $j(document).ready(function() {
<div id="widgetcode2">Copy/paste this into your site:<br /><textarea rows="7" cols="22">&lt;iframe src="https://{{ request.META.HTTP_HOST }}/api/widget/{{ work.first_isbn_13 }}/" width="152" height="325" frameborder="0"&gt;&lt;/iframe&gt;</textarea></div>
</ul>
</div>
{% if readmill_epub_url or can_kindle %}
{% if xfer_url or can_kindle %}
<div class="one_click clearfix">
<h3>One-click options</h3>
{% if mac_ibooks and readmill_epub_url%}
{% if mac_ibooks and xfer_url %}
<div id="mac_ibooks" title="{{ work.id }}" >
<div class="btn_support mac_ibooks"><a href="{{readmill_epub_url}}">Load to iBooks</a></div>
<div class="btn_support mac_ibooks"><a href="{{ xfer_url }}">Load to iBooks</a></div>
</div>
{% endif %}
{% if can_kindle %}
@ -109,20 +110,18 @@ $j(document).ready(function() {
{% endif %}
</div>
{% endif %}
{% if readmill_epub_url %}
{% if xfer_url %}
{% if iOS %}
<div id="marvin" title="{{ work.id }}" >
<div class="btn_support marvin"><a href="marvinhttp://{{readmill_epub_url|urlencode}}">Load to Marvin</a></div>
<div class="btn_support marvin"><a href="marvinhttp://{{ xfer_url|urlencode }}">Load to Marvin</a></div>
</div>
{% endif %}
<div id="readmill_div" class="yes_js">
<div class="send-to-readmill" data-download-url="{{ readmill_epub_url }}" data-buy-url="{{ base_url }}{% url work work.id %}"></div>
</div>
{% endif %}
{% if not request.user.is_authenticated %}
{% if can_kindle %}{% if not request.user.is_authenticated %}
<div style="clear:left"> You'll need an unglue.it account to <i>Send to Kindle</i>.</div>
{% endif %}
{% endif %}{% endif %}
</div>
{% endif %}
<div class="ebook_download_container">
@ -138,6 +137,10 @@ $j(document).ready(function() {
<img src="{{ ebook.rights_badge }}" alt="{{ ebook.rights}}" title="{{ ebook.rights}}" /></a>
<a href="{% url download_ebook ebook.id %}"><img src="/static/images/{{ ebook.format }}32.png" height="32" alt="{{ ebook.format }}" title="{{ ebook.format }}" /></a>
<a href="{% url download_ebook ebook.id %}">{{ ebook.format }}</a>
{% if ebook.is_direct %}<a class="dropbox-saver" href="{{ ebook.download_url }}" data-filename="unglueit-{{ work.id }}.{{ ebook.format }}">{% endif %}
</a>
</p>
{% if not forloop.last %}<br /><br />{% endif %}
{% endfor %}
</div>
@ -154,6 +157,8 @@ $j(document).ready(function() {
<img src="{{ ebook.rights_badge }}" alt="{{ ebook.rights}}" title="{{ ebook.rights}}" /></a>
<a href="{% url download_ebook ebook.id %}"><img src="/static/images/{{ ebook.format }}32.png" height="32" alt="{{ ebook.format }} at {{ebook.provider}}" title="{{ ebook.format }} at {{ebook.provider}}" /></a>
<a href="{% url download_ebook ebook.id %}">{{ ebook.format }} at {{ ebook.provider }}</a>
{% if ebook.is_direct %}<a class="dropbox-saver" href="{{ ebook.download_url }}" data-filename="unglueit-{{ work.id }}.{{ ebook.format }}">{% endif %}
</a>
{% if not forloop.last %}<br /><br />{% endif %}
{% endfor %}
</div>
@ -164,9 +169,11 @@ $j(document).ready(function() {
<div class="ebook_download">
<a href="{{ formats.epub }}"><img src="/static/images/epub32.png" height="32" alt="epub" title="epub" /></a>
<a href="{{ formats.epub }}">EPUB</a> (for iBooks, Nook, Kobo)
<a class="dropbox-saver" href="{{ formats.epub }}" data-filename="unglueit-{{ work.id }}.epub">
<br /><br />
<a href="{{ formats.mobi }}"><img src="/static/images/mobi32.png" height="32" alt="mobi" title="mobi" /></a>
<a href="{{ formats.mobi }}">MOBI</a> (for Kindle)
<a class="dropbox-saver" href="{{ formats.mobi }}" data-filename="unglueit-{{ work.id }}.mobi">
</div>
{% endifequal %}
{% endif %}
@ -218,13 +225,7 @@ $j(document).ready(function() {
<li>Download the <a href="{{ formats.epub }}">epub file</a>.</li>
<li>You will be given the option of opening the file in iBooks.</li>
</ul>
<p class="ebook_download logo"><img src="/static/images/readmill_logo.jpg" alt="iBooks Logo" />Readmill is another great option. </p>
<ul>
<li><a href="https://itunes.apple.com/us/app/readmill-book-reader-for-epub/id438032664?mt=8">Install the free Readmill app</a> from the App Store.</li>
<li>Click the "Send to Readmill" button above.</li>
<li>If you don't have a free Readmill account, you'll be given the option of creating one.</li>
</ul>
<p class="ebook_download logo"><img src="/static/images/marvin_logo.jpg" alt="iBooks Logo" />We like Marvin, too. </p>
<p class="ebook_download logo"><img src="/static/images/marvin_logo.jpg" alt="iBooks Logo" />Marvin is a great way to read ebooks. </p>
<ul>
<li><a href="https://itunes.apple.com/us/app/marvin-ebook-reader-for-epub/id667361209?ls=1&mt=8">Install Marvin</a> from the App Store.</li>
<li>Click the "Load to Marvin" button above.</li>
@ -271,12 +272,6 @@ $j(document).ready(function() {
<li>Download the <a href="{{ formats.epub }}">epub file</a>.</li>
<li>When the download is complete, tap it in your notifications menu. It will be added to Aldiko, ready to read next time you open the app.</li>
</ul>
<p class="ebook_download logo"><img src="/static/images/readmill_logo.jpg" alt="iBooks Logo" />Readmill is another great option. </p>
<ul>
<li><a href="https://play.google.com/store/apps/details?id=com.readmill.android">Install the free Readmill app</a> from Google Play.</li>
<li>Click the "Send to Readmill" button above.</li>
<li>If you don't have a free Readmill account, you'll be given the option of creating one.</li>
</ul>
{% else %}{% if formats.pdf %}
<p>
You may already have an app which reads ebooks. Download the <a href="{{ formats.pdf }}">pdf file</a> and see if you're offered an option for opening the file. If so, you're done! If not...
@ -380,27 +375,18 @@ $j(document).ready(function() {
We're sorry; we don't have a file format suitable for ereaders.
</p>
{% endif %}
<p class="other_instructions_paragraph">
Not using an ereader? Try the instructions for <a class="ios other_instructions">iPhone/iPad</a>, <a class="android other_instructions">Android</a>, or <a class="desktop other_instructions">desktop computers</a>.
</p>
</div>
<div id="ereader_div" class="active">
<h4>Dropbox</h4>
<p class="other_instructions_paragraph"> Dropbox is a good way to share your ebooks between desktop, tablet and smartphone. If you see a dropbox button above, click it to load your books into your dropbox folder. Then load the file into your reader application on your device.
</p>
</div>
</div>
{% comment %}
If we're going to be providing mobi as the norm, let's not bother with these instructions.
<div class="instructions">
<h4>Converting epubs for Kindle</h4>
<p>Kindles can read plain text, MOBI, PDF, and HTML files. They cannot read epub books (the format unglued ebooks are released in). However, you can convert epubs to mobi files using free software.</p>
<ul>
<li><a href="http://calibre-ebook.com/download">Download the free Calibre app</a> to a desktop or laptop computer.</li>
<li>Download your book from this page onto the desktop or laptop.</li>
<li>Open the ebook file in Calibre.</li>
<li>Convert the epub to a mobi file: select the file; click on "convert books"; and set the output format to mobi.</li>
<li>When the conversion is done, put the file on your device using the instructions for ereaders above. If you've set up your Kindle email address at Amazon.com, you can also email it to yourself using the "Connect/share" button, without needing to plug your Kindle in. Calibre will walk you through the process of setting up your Kindle email in Calibre.</li>
</ul>
</div>
{% endcomment %}
<br />
<h4>Need more help?</h4>
<p>Email us at <a href="mailto:support@gluejar.com?Subject=Ebook%20downloading%20help">support@gluejar.com</a>.</p>
@ -413,6 +399,7 @@ $j(document).ready(function() {
{% endif %}
</div>
</div>
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" ></script>
{% endblock %}
{% endwith %}

View File

@ -20,7 +20,7 @@
<li class="last parent">
<span class="faq">How and when will I get my eBook?</span>
<span class="menu level2 answer">
Your purchased books will be always available for download from your <a href="{% url supporter request.user %}"> personal unglue.it page</a>. You can read the ebooks on any laptop, ebook reader or tablet. You can also use them within reading environments such as <a href="http://www.readmill.com">Readmill</a>.
Your purchased books will be always available for download from your <a href="{% url supporter request.user %}"> personal unglue.it page</a>. You can read the ebooks on any laptop, ebook reader or tablet.
</span>
</li>

View File

@ -61,7 +61,7 @@
<h4>Available formats...</h4>
<ul>
<li><span class="format_display"><img src="/static/images/mobi32.png" height="32" alt="mobi" title="mobi" /> (for Kindle) </span></li>
<li><span class="format_display"><img src="/static/images/epub32.png" height="32" alt="epub" title="epub" /> (for iBooks, Readmill, Nook, Kobo) </span></li>
<li><span class="format_display"><img src="/static/images/epub32.png" height="32" alt="epub" title="epub" /> (for iBooks, Nook, Kobo) </span></li>
</ul>
</div>

View File

@ -2733,7 +2733,7 @@ class DownloadView(PurchaseView):
acq = an_acq
formats['epub']= reverse('download_acq', kwargs={'nonce':acq.nonce, 'format':'epub'})
formats['mobi']= reverse('download_acq', kwargs={'nonce':acq.nonce, 'format':'mobi'})
readmill_epub_url = settings.BASE_URL + formats['epub']
xfer_url = settings.BASE_URL_SECURE + formats['epub']
can_kindle = True
break
@ -2753,16 +2753,12 @@ class DownloadView(PurchaseView):
can_kindle = True
except IndexError:
can_kindle = False
# configure the readmillurl
# configure the xfer url
try:
readmill_epub_ebook = non_google_ebooks.filter(format='epub')[0]
if readmill_epub_ebook.url.startswith('https'):
readmill_epub_url = settings.BASE_URL_SECURE + reverse('download_ebook',args=[readmill_epub_ebook.id])
else:
readmill_epub_url = settings.BASE_URL + reverse('download_ebook',args=[readmill_epub_ebook.id])
#readmill_epub_url = readmill_epub_ebook.url
xfer_epub_ebook = non_google_ebooks.filter(format='epub')[0]
xfer_url = settings.BASE_URL_SECURE + reverse('download_ebook',args=[xfer_epub_ebook.id])
except:
readmill_epub_url = None
xfer_url = None
agent = request.META.get('HTTP_USER_AGENT','')
iOS = 'iPad' in agent or 'iPhone' in agent or 'iPod' in agent
iOS_app = iOS and not 'Safari' in agent
@ -2772,7 +2768,8 @@ class DownloadView(PurchaseView):
'unglued_ebooks': unglued_ebooks,
'other_ebooks': other_ebooks,
'formats': formats,
'readmill_epub_url': readmill_epub_url,
'xfer_url': xfer_url,
'dropbox_key': settings.DROPBOX_KEY,
'can_kindle': can_kindle,
'base_url': settings.BASE_URL_SECURE,
'iOS': iOS,

View File

@ -399,3 +399,6 @@ BOOXTREAM_API_KEY = '7ynRCsx4q21zEY67it7yk8u5rc6EXY'
BOOXTREAM_API_USER = 'ungluetest'
BOOXTREAM_TEST_EPUB_URL = 'https://github.com/Gluejar/open_access_ebooks_ebook/raw/master/download/open_access_ebooks.epub'
FILE_UPLOAD_MAX_MEMORY_SIZE = 20971520 #20MB
DROPBOX_KEY = '4efhwty5aph52bd' #for unglue.it, just.unglue.it
#DROPBOX_KEY = '6uefhocpvp0s1ep' #for localhost

View File

@ -21,7 +21,7 @@ $j(document).ready(function() {
if ($j(this).attr("href").indexOf('download') !== -1) {
jQuery.getScript('/static/js/download_page.js');
jQuery.getScript('https://platform.readmill.com/send.js');
jQuery.getScript('https://www.dropbox.com/static/api/2/dropins.js');
}
//need to push next cookie for sign-in links

View File

@ -1,5 +0,0 @@
(function() {
var st = document.createElement('script'); st.type = 'text/javascript'; st.async = true;
st.src = 'https://platform.readmill.com/send.js';
var p = document.getElementsByTagName('script')[0]; p.parentNode.insertBefore(st, p);
})();

View File

@ -23,7 +23,7 @@ $j(document).ready(function() {
if ($j(this).attr("href").indexOf("download") !== -1) {
jQuery.getScript('/static/js/download_page.js');
jQuery.getScript('https://platform.readmill.com/send.js');
jQuery.getScript('https://www.dropbox.com/static/api/2/dropins.js');
var work_page = $j(this).attr("href").split("download")[0];
$j.cookie('next', work_page, {path: '/'});
}