Added 'register books' and made a list of book categories

This commit is contained in:
Andreas Lindahl Flåten 2011-10-09 16:13:20 +00:00
parent 5abde71f2e
commit 09e2bc414d
3 changed files with 43 additions and 4 deletions

26
cli/categories.txt Normal file
View File

@ -0,0 +1,26 @@
Mathematics
Physics
Science
Linux
Unix
BSD
Operating Systems
Networking
X Window System
Algorithms
RTFM
TeX
Computer Graphics
Computer Science
Computer History
Computer Nonsense
Programming
Programming Languages
C/C++
Java
Lisp
Python
Perl
PVV
Religion
TODO: Comics/fiction

View File

@ -19,7 +19,7 @@ def google_suggest_book_data(dbconnection, tmp_file=False):
action_list = []
authors_added = {}
file_prefix = "suggestion"
filler = ' -------------------------------------------------- '
filler = ' -------------------------------- '
print("# Enter ISBN number(s), end with eof <CTRL+D>")
for ISBN in sys.stdin:
ISBN = ISBN.strip()
@ -60,7 +60,7 @@ def google_suggest_book_data(dbconnection, tmp_file=False):
print("No items found")
if tmp_file:
write_tmpfile(file_prefix, write_actionlist(action_list))
return write_tmpfile(file_prefix, write_actionlist(action_list))
else:
print(write_actionlist(action_list))

View File

@ -365,11 +365,19 @@ def map_cmd(connection, shelfname=None, category=None):
pass
def suggest_book_data(connection, tmp_file=False):
google_suggest_book_data(connection, tmp_file)
return google_suggest_book_data(connection, tmp_file)
<<<<<<< .mine
def register_books(connection):
filename = suggest_book_data(connection, tmp_file=True)
run_editor(filename)
commit(connection, filename)
=======
def give_bananas():
print "Om nom nom... Thanks!"
>>>>>>> .r164
commands = { 'show':
{ 'args': [('ids', (1,None))],
'options': ['commit_format', 'tmp_file'],
@ -410,11 +418,16 @@ commands = { 'show':
'options': ['tmp_file'],
'fun': suggest_book_data,
'use_db': True },
'register-books':
{ 'args': [],
'options': [],
'fun': register_books,
'use_db': True },
'give-bananas':
{ 'args': [],
'options': [],
'fun': give_bananas,
'use_db': False },
'use_db': False }
}
flags = { 'commit_format':