From bade8e7f4dc1b1a020ffcef7697e3331cb890068 Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 15 Jun 2018 10:34:23 -0400 Subject: [PATCH 1/2] handle records without downloads --- core/loaders/doab.py | 14 ++++++++++++++ core/loaders/doab_utils.py | 2 ++ 2 files changed, 16 insertions(+) diff --git a/core/loaders/doab.py b/core/loaders/doab.py index 14f90c43..a053f0df 100644 --- a/core/loaders/doab.py +++ b/core/loaders/doab.py @@ -393,6 +393,20 @@ def add_by_doab(doab_id, record=None): url_to_provider(dl_url) if dl_url else None, **metadata ) + else: + if 'format' in metadata: + del metadata['format'] + edition = load_doab_edition( + title, + doab_id, + '', + '', + license, + language, + isbns, + None, + **metadata + ) return edition except IdDoesNotExistError: return None diff --git a/core/loaders/doab_utils.py b/core/loaders/doab_utils.py index e03c2348..ceef8bb7 100644 --- a/core/loaders/doab_utils.py +++ b/core/loaders/doab_utils.py @@ -103,6 +103,8 @@ FRONTIERSIN = re.compile(r'frontiersin.org/books/[^/]+/(\d+)') def online_to_download(url): urls = [] + if not url: + return urls if url.find(u'mdpi.com/books/pdfview/book/') >= 0: doc = get_soup(url) if doc: From 7593944dc0641c61a10eff0080a4093d22784d8c Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 15 Jun 2018 15:30:04 -0400 Subject: [PATCH 2/2] reset default to 15 days --- core/loaders/doab.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/loaders/doab.py b/core/loaders/doab.py index a053f0df..22e337d1 100644 --- a/core/loaders/doab.py +++ b/core/loaders/doab.py @@ -425,8 +425,8 @@ def load_doab_oai(from_year=None, limit=100000): if from_year: from_ = datetime.datetime(year=from_year, month=1, day=1) else: - # last 45 days - from_ = datetime.datetime.now() - datetime.timedelta(days=45) + # last 15 days + from_ = datetime.datetime.now() - datetime.timedelta(days=15) doab_ids = [] for record in doab_client.listRecords(metadataPrefix='oai_dc', from_=from_): if not record[1]: