Fix on Windows + Fix issue #25
This commit is contained in:
parent
84a7a1cd63
commit
82ed48a9e0
9
bmc.py
9
bmc.py
@ -630,13 +630,14 @@ if __name__ == '__main__':
|
|||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
elif args.func == 'list':
|
elif args.func == 'list':
|
||||||
listPapers = tools.listDir(config.get("folder"))
|
listPapers = backend.getEntries(full=True)
|
||||||
|
if not listPapers:
|
||||||
|
sys.exit()
|
||||||
|
listPapers = [v["file"] for k, v in listPapers.items()]
|
||||||
listPapers.sort()
|
listPapers.sort()
|
||||||
|
|
||||||
for paper in listPapers:
|
for paper in listPapers:
|
||||||
if tools.getExtension(paper) not in [".pdf", ".djvu"]:
|
|
||||||
continue
|
|
||||||
print(paper)
|
print(paper)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
elif args.func == 'search':
|
elif args.func == 'search':
|
||||||
raise Exception('TODO')
|
raise Exception('TODO')
|
||||||
|
@ -277,7 +277,7 @@ def getBibtex(entry, file_id='both', clean=False):
|
|||||||
return bibtex_entry
|
return bibtex_entry
|
||||||
|
|
||||||
|
|
||||||
def getEntries():
|
def getEntries(full=False):
|
||||||
"""Returns the list of all entries in the bibtex index"""
|
"""Returns the list of all entries in the bibtex index"""
|
||||||
try:
|
try:
|
||||||
with open(config.get("folder")+'index.bib', 'r', encoding='utf-8') \
|
with open(config.get("folder")+'index.bib', 'r', encoding='utf-8') \
|
||||||
@ -288,6 +288,9 @@ def getEntries():
|
|||||||
tools.warning("Unable to open index file.")
|
tools.warning("Unable to open index file.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if full:
|
||||||
|
return bibtex
|
||||||
|
else:
|
||||||
return list(bibtex.keys())
|
return list(bibtex.keys())
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ from __future__ import print_function, unicode_literals
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
if os.name == "posix":
|
||||||
from termios import tcflush, TCIOFLUSH
|
from termios import tcflush, TCIOFLUSH
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -67,6 +68,7 @@ def replaceAll(text, dic):
|
|||||||
|
|
||||||
def rawInput(string):
|
def rawInput(string):
|
||||||
"""Flush stdin and then prompt the user for something"""
|
"""Flush stdin and then prompt the user for something"""
|
||||||
|
if os.name == "posix":
|
||||||
tcflush(sys.stdin, TCIOFLUSH)
|
tcflush(sys.stdin, TCIOFLUSH)
|
||||||
return input(string)
|
return input(string)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user