Updated for new version of isbnlib

This commit is contained in:
Phyks 2014-07-08 21:37:13 +02:00
parent d4f9af8a53
commit f0b89e9bae
4 changed files with 11 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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 ''

View File

@ -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}
}