Move server to a new branch

This commit is contained in:
Phyks 2014-04-28 23:37:11 +02:00
parent 46fc17b2da
commit 7d36f3206f
2 changed files with 14 additions and 63 deletions

View File

@ -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. A list of ideas and TODO. Don't hesitate to give feedback on the ones you really want or to propose your owns.
* Open 10. Refactor
* Use bibtex-parser lib to write bibtex, instead of parsed2BibTex 11. Use bibtex-parser lib to write bibtex, instead of parsed2BibTex
* Parameter to disable remote search 12. Rebuild function
* Rebuild 13. Split main.py
* Webserver interface 14. Various re.compile ?
* Various re.compile ? 15. Check output of subprocesses before it ends
* check output of subprocesses before it ends 16. TODO in files
* Split main.py 20. No DOI for arXiv / HAL
* Categories 30. Parameter to disable remote search
* Edit an entry instead of deleting it and adding it again 40. Open file
* Doc / Man 45. Doc / Man
* No DOI for arXiv / HAL 50. Webserver interface
60. Categories
70. Edit an entry instead of deleting it and adding it again
## Issues ? ## 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. * Remove the watermarks on pdf files => done, some warning in okular on generated pdf, but seems ok. Seems to be a bug in PyPDF2.

View File

@ -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 = '<html><body>'
for index in data:
html += '<p>'+index+'</p>'
html += '</body></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 = '<html><body><p>Not found.</p></body></html>'
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()