diff --git a/.travis.yml b/.travis.yml index 69338e6..83cfeda 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ install: - pip install requesocks - pip install pyPDF2 - pip install tear-pages - - pip install isbntools + - pip install isbnlib - pip install bibtexparser - pip install coveralls - sudo apt-get install -qq poppler-utils diff --git a/README.md b/README.md index fbf8028..7ae7a2a 100644 --- a/README.md +++ b/README.md @@ -56,9 +56,9 @@ Should be almost working and usable now, although still to be considered as **ex ``` git clone https://github.com/Phyks/BMC ``` -* Install `arxiv2bib`, `tear-pages`, `requesocks`, `bibtexparser` (https://github.com/sciunto/python-bibtexparser), `PyPDF2` and `isbntools` _via_ Pypi +* Install `arxiv2bib`, `tear-pages`, `requesocks`, `bibtexparser` (https://github.com/sciunto/python-bibtexparser), `PyPDF2` and `isbnlib` _via_ Pypi ``` -sudo pip install arxiv2bib requesocks bibtexparser pyPDF2 isbntools +sudo pip install arxiv2bib requesocks bibtexparser pyPDF2 isbnlib ``` (replace pip by pip2 if your distribution ships python3 by default) * Install `pdftotext` (provided by Xpdf) and `djvulibre` _via_ your package manager or the way you want @@ -145,6 +145,7 @@ Here are some sources of inspirations for this project : A list of ideas and TODO. Don't hesitate to give feedback on the ones you really want or to propose your owns. 60. Unittest +70. Python3 compatibility ? 80. Search engine 85. Anti-duplicate ? 90. Look for published version in arXiv diff --git a/fetcher.py b/fetcher.py index dd7700f..2961492 100644 --- a/fetcher.py +++ b/fetcher.py @@ -10,7 +10,7 @@ # ----------------------------------------------------------------------------- -import isbntools +import isbnlib import re import requesocks as requests # Requesocks is requests with SOCKS support import subprocess @@ -19,7 +19,6 @@ import arxiv2bib as arxiv_metadata import tools from bibtexparser.bparser import BibTexParser from config import Config -from isbntools.dev._fmt import fmtbib config = Config() @@ -116,8 +115,9 @@ def isbn2Bib(isbn): """Tries to get bibtex entry from an ISBN number""" # Default merges results from worldcat.org and google books try: - return fmtbib('bibtex', isbntools.meta(isbn, 'default')) - except TypeError: + return isbnlib.registry.bibformatters['bibtex'](isbnlib.meta(isbn, + 'default')) + except (isbnlib.ISBNLibException, isbnlib.ISBNToolsException, TypeError): return '' diff --git a/tests/src/isbn.bib b/tests/src/isbn.bib index 6e8c62b..4d7ff85 100644 --- a/tests/src/isbn.bib +++ b/tests/src/isbn.bib @@ -1,7 +1,7 @@ -@book{0198507194, +@book{9780198507192, title = {Bose-Einstein Condensation}, - author = {Lev. P. Pitaevskii and S. Stringari}, - isbn = {0198507194}, + author = {Lev Pitaevskii and Sandro Stringari}, + isbn = {9780198507192}, year = {2004}, publisher = {Clarendon Press} } \ No newline at end of file