Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

end support for mobi #998

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions booxtream/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def platform(self, epubfile=None, epub=True, kf8mobi=False, **kwargs):
# fake it, so you can test other functions without hitting booxtream
boox = Boox.objects.create(
download_link_epub='https://github.com/eshellman/42_ebook/blob/master/download/42.epub?raw=true&extra=download.booxtream.com/',
download_link_mobi='https://github.com/eshellman/42_ebook/blob/master/download/42.mobi?raw=true',
referenceid= kwargs.get('referenceid', '42'),
downloads_remaining=kwargs.get('downloadlimit', 10),
expirydays=kwargs.get('expirydays', 30),
Expand All @@ -81,12 +80,8 @@ def platform(self, epubfile=None, epub=True, kf8mobi=False, **kwargs):
download_link_epub = doc.find('.//DownloadLink[@type="epub"]')
if download_link_epub is not None:
download_link_epub = download_link_epub.text
download_link_mobi = doc.find('.//DownloadLink[@type="mobi"]')
if download_link_mobi is not None:
download_link_mobi = download_link_mobi.text
boox = Boox.objects.create(
download_link_epub=download_link_epub,
download_link_mobi=download_link_mobi,
referenceid=kwargs.get('referenceid'),
downloads_remaining=kwargs.get('downloadlimit'),
expirydays=kwargs.get('expirydays'),
Expand Down
19 changes: 19 additions & 0 deletions booxtream/migrations/0002_remove_boox_download_link_mobi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2022-07-28 06:16
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('booxtream', '0001_initial'),
]

operations = [
migrations.RemoveField(
model_name='boox',
name='download_link_mobi',
),
]
3 changes: 0 additions & 3 deletions booxtream/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class Boox(models.Model):
keeps a record of a file that's been watermarked
"""
download_link_epub = models.URLField(null=True)
download_link_mobi = models.URLField(null=True)
referenceid = models.CharField(max_length=32)
downloads_remaining = models.PositiveSmallIntegerField(default=0)
expirydays = models.PositiveSmallIntegerField()
Expand All @@ -20,7 +19,5 @@ def expired(self):
def download_link(self, format):
if format == 'epub':
return self.download_link_epub
elif format == 'mobi':
return self.download_link_mobi
return None

2 changes: 1 addition & 1 deletion core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class EbookFileAdmin(ModelAdmin):
list_display = ('created', 'format', 'ebook_link', 'asking')
date_hierarchy = 'created'
ordering = ('edition__work',)
fields = ('file', 'format', 'edition', 'edition_link', 'ebook', 'ebook_link', 'source', 'mobied')
fields = ('file', 'format', 'edition', 'edition_link', 'ebook', 'ebook_link', 'source')
readonly_fields = ('file', 'edition_link', 'ebook_link', 'source')
def edition_link(self, obj):
if obj.edition:
Expand Down
2 changes: 1 addition & 1 deletion core/facets.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class FormatFacetGroup(FacetGroup):
def __init__(self):
super(FacetGroup,self).__init__()
self.title = 'Format'
self.facets = ['pdf', 'epub', 'mobi']
self.facets = ['pdf', 'epub']
self.label = '{} is ...'.format(self.title)

def get_facet_class(self, facet_name):
Expand Down
2 changes: 1 addition & 1 deletion core/loaders/doab.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def load_doab_edition(title, doab_id, url, format, rights,
work.selected_edition = edition
work.save()

if format in ('pdf', 'epub', 'mobi', 'html', 'online') and rights:
if format in ('pdf', 'epub', 'html', 'online') and rights:
ebook = models.Ebook()
ebook.format = format
ebook.provider = provider
Expand Down
6 changes: 3 additions & 3 deletions core/loaders/harvest.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ def harvest_frontiersin(ebook):
logger.warning('couldn\'t get any dl_url for %s', ebook.url)
return harvested, num

SPRINGERDL = re.compile(r'(EPUB|PDF|MOBI)')
SPRINGERDL = re.compile(r'(EPUB|PDF)')

def harvest_springerlink(ebook):
def selector(doc):
Expand Down Expand Up @@ -910,7 +910,7 @@ def harvest_doi_coaccess(ebook):

# a new ebook
format = loader.type_for_url(url)
if format in ('pdf', 'epub', 'mobi', 'html', 'online'):
if format in ('pdf', 'epub', 'html', 'online'):
new_ebook = models.Ebook()
new_ebook.format = format
new_ebook.url = url
Expand Down Expand Up @@ -1000,7 +1000,7 @@ def selector(doc):

def harvest_ubiquity(ebook):
def selector(doc):
return doc.find_all('a', attrs={'data-category': re.compile('(epub|mobi|pdf) download')})
return doc.find_all('a', attrs={'data-category': re.compile('(epub|pdf) download')})
return harvest_multiple_generic(ebook, selector)

def harvest_orkana(ebook):
Expand Down
2 changes: 1 addition & 1 deletion core/loaders/pressbooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PressbooksScraper(BaseScraper):
can_scrape_strings = ['pressbooks']

def get_downloads(self):
for dl_type in ['epub', 'mobi', 'pdf']:
for dl_type in ['epub', 'pdf']:
download_el = self.doc.select_one('.{}'.format(dl_type))
value = None
if download_el and download_el.find_parent():
Expand Down
5 changes: 2 additions & 3 deletions core/loaders/scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ def get_isbns(self):
'''return a dict of edition keys and ISBNs'''
isbns = {}
isbn_cleaner = identifier_cleaner('isbn', quiet=True)
label_map = {'epub': 'EPUB', 'mobi': 'Mobi',
'paper': 'Paperback', 'pdf':'PDF', 'hard':'Hardback'}
label_map = {'epub': 'EPUB', 'paper': 'Paperback', 'pdf':'PDF', 'hard':'Hardback'}
for key in label_map.keys():
isbn_key = 'isbn_{}'.format(key)
value = self.check_metas(['citation_isbn'], type=label_map[key])
Expand Down Expand Up @@ -332,7 +331,7 @@ def get_cover(self):
self.set('covers', [{'image_url': image_url}])

def get_downloads(self):
for dl_type in ['epub', 'mobi', 'pdf']:
for dl_type in ['epub', 'pdf']:
dl_meta = 'citation_{}_url'.format(dl_type)
value = self.check_metas([dl_meta])
if value:
Expand Down
2 changes: 1 addition & 1 deletion core/management/commands/harvest_remote_ebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from regluit.core.loaders.harvest import archive_dl, RateLimiter, DONT_HARVEST
from regluit.core.models import Ebook
from regluit.core.parameters import GOOD_PROVIDERS
DOWNLOADABLE = ['pdf', 'epub', 'mobi']
DOWNLOADABLE = ['pdf', 'epub']

DONT_CHECK = list(GOOD_PROVIDERS) + DONT_HARVEST

Expand Down
44 changes: 0 additions & 44 deletions core/management/commands/make_missing_mobis.py

This file was deleted.

19 changes: 19 additions & 0 deletions core/migrations/0025_remove_ebookfile_mobied.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2022-07-28 06:16
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('core', '0024_auto_20210503_1717'),
]

operations = [
migrations.RemoveField(
model_name='ebookfile',
name='mobied',
),
]
30 changes: 0 additions & 30 deletions core/mobi.py

This file was deleted.

90 changes: 0 additions & 90 deletions core/mobigen.py

This file was deleted.

Loading