Import should be working \ol/

This commit is contained in:
Phyks 2014-04-25 14:22:34 +02:00
parent 138dd92439
commit 72e2def380
2 changed files with 34 additions and 7 deletions

View File

@ -20,6 +20,16 @@ This is the goal of BiblioManager. It will :
BiblioManager will always use standard formats such as BibTeX, so that you can easily edit your library, export it and manage it by hand, even if you quit this software for any reason.
## Current status
* Able to import a PDF file, automagically find the DOI, get the bibtex entry back and add it to the library. If DOI search fails, it will prompt you for the DOI.
* Same thing for DJVU files.
* Same thing for books (PDF or DJVU) using ISBN.
* TODO (in one of the next commits) : Add bibtex to the global bibtex index.
**Important note :** I use it for personnal use, but I don't read articles from many journals. If you find any file which is not working, please fill an issue or send me an e-mail with the relevant information. There are alternative ways to get the metadata for example, and I didn't know really which one was the best one as writing this code.
## Installation
TODO -- To be updated
@ -27,6 +37,9 @@ TODO -- To be updated
Install pdfminer, pdfparanoia (via pip) and requesocks.
Init the submodules and install Zotero translation server.
Copy params.py.example as params.py and customize it.
Install pdftotext.
Install djvulibre to use djvu files.
Install isbntools with pip.
## Paperbot
@ -54,3 +67,17 @@ TODO
## Inspiration
* [Bibsoup](http://openbiblio.net/2012/02/09/bibsoup-beta-released/)
* http://en.dogeno.us/2010/02/release-a-python-script-for-organizing-scientific-papers-pyrenamepdf-py/
* MPC
## Ideas, TODO
A list of ideas and TODO. Don't hesitate to give feedback on the ones you really want or to propose your owns.
* Categories
* Client / server
* Various re.compile ?
* check output of subprocesses before it ends
* Options to ignore auto check, manual check etc.
* anti-duplicates
* Split main.py

14
main.py
View File

@ -39,7 +39,7 @@ def parsed2Bibtex(parsed):
for field in [i for i in sorted(parsed) if i not in ['type', 'id']]:
bibtex += "\t"+field+"={"+parsed[field]+"},\n"
bibtex += "}"
bibtex += "}\n"
return bibtex
@ -48,11 +48,8 @@ def bibtexAppend(data):
Append data to the main bibtex file
data is a dict as the one from bibtexparser output
"""
bibtex = ''
for field, value in data:
bibtex += "\n" + field + ": " + value + ","
# TODO : Write
with open(params.folder+'index.bib', 'a') as fh:
fh.write(parsed2Bibtex(data)+"\n")
def replaceAll(text, dic):
@ -273,7 +270,7 @@ def addFile(src, filetype):
bibtex['file'] = new_name
while os.path.exists(new_name):
warning("Error, file "+new_name+" already exists.")
warning("file "+new_name+" already exists.")
default_rename = new_name.replace(getExtension(new_name),
" (2)"+getExtension(new_name))
rename = rawInput("New name ["+default_rename+"] ? ")
@ -312,6 +309,9 @@ if __name__ == '__main__':
addFile(sys.argv[2], filetype)
sys.exit()
elif sys.argv[1] == 'delete':
raise Exception('TODO')
elif sys.argv[1] == 'list':
raise Exception('TODO')