From 7d36f3206fb1554dd288824da678581ed716f3e1 Mon Sep 17 00:00:00 2001 From: Phyks Date: Mon, 28 Apr 2014 23:37:11 +0200 Subject: [PATCH] Move server to a new branch --- README.md | 28 ++++++++++++++-------------- server.py | 49 ------------------------------------------------- 2 files changed, 14 insertions(+), 63 deletions(-) delete mode 100755 server.py diff --git a/README.md b/README.md index d0fdddb..05553b9 100644 --- a/README.md +++ b/README.md @@ -105,21 +105,21 @@ 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. -* Open -* Use bibtex-parser lib to write bibtex, instead of parsed2BibTex -* Parameter to disable remote search -* Rebuild -* Webserver interface -* Various re.compile ? -* check output of subprocesses before it ends -* Split main.py -* Categories -* Edit an entry instead of deleting it and adding it again -* Doc / Man -* No DOI for arXiv / HAL +10. Refactor + 11. Use bibtex-parser lib to write bibtex, instead of parsed2BibTex + 12. Rebuild function + 13. Split main.py + 14. Various re.compile ? + 15. Check output of subprocesses before it ends + 16. TODO in files +20. No DOI for arXiv / HAL +30. Parameter to disable remote search +40. Open file +45. Doc / Man +50. Webserver interface +60. Categories +70. Edit an entry instead of deleting it and adding it again ## Issues ? -See upstream - * Remove the watermarks on pdf files => done, some warning in okular on generated pdf, but seems ok. Seems to be a bug in PyPDF2. diff --git a/server.py b/server.py deleted file mode 100755 index f6a13d0..0000000 --- a/server.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python2 -# -*- coding: utf8 -*- -import os -import params -from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer -from bibtexparser.bparser import BibTexParser -from bibtexparser.customization import homogeneize_latex_encoding - -# TODO : -# * custom port -# * allow remote - -def bibtex2HTML(data): - html = '' - for index in data: - html += '

'+index+'

' - html += '' - return html - - -PORT_NUMBER = 8080 - -class myHandler(BaseHTTPRequestHandler): - def do_GET(self): - if os.path.isfile(params.folder+'index.bib'): - with open(params.folder+"index.bib", "r") as fh: - bibtex = BibTexParser(fh, customization=homogeneize_latex_encoding) - bibtex = bibtex.get_entry_dict() - html = bibtex2HTML(bibtex) - else: - html = '

Not found.

' - - self.send_response(200) - self.send_header('Content-type','text/html') - self.end_headers() - self.wfile.write(html) - return - - def log_message(self, format, *args): - return - -if __name__ == '__main__': - try: - server = HTTPServer(('127.0.0.1', PORT_NUMBER), myHandler) - print('Webserver started : http://localhost:' + str(PORT_NUMBER)) - server.serve_forever() - except KeyboardInterrupt: - print('KeyboardInterrupt received, shutting down the webserver…') - server.socket.close()