From 72e2def38031c3aec50008bac8d1075b3b6ac3d7 Mon Sep 17 00:00:00 2001 From: Phyks Date: Fri, 25 Apr 2014 14:22:34 +0200 Subject: [PATCH] Import should be working \ol/ --- README.md | 27 +++++++++++++++++++++++++++ main.py | 14 +++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8be5d27..498a709 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/main.py b/main.py index dabe09d..7d2891c 100755 --- a/main.py +++ b/main.py @@ -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')