-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbookfinder.py
67 lines (65 loc) · 1.95 KB
/
bookfinder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from isbntools.app import *
import BarcoderAPI
bformat = ['default','labels','bibtex','csl', 'csv','json','opf','endnote','ris','refworks','msword']
def get_isbn(name):
isbn = isbn_from_words(name)
return isbn
def get_info(i,isbnNumber):
bookData = registry.bibformatters[bformat[i]](meta(isbnNumber))
return bookData
print('''
....Book Finder....
1. Find Book by Name
2. Find Book by ISBN
3. Find ISBN by Name
4. Find Book by Scaning barcode
Press q to exit
''')
while 1:
opt1 = input("$ ")
if opt1 == 'q':
break
opt1 = int(opt1)
if opt1==1:
bookName = input("Enter the Name of the Book: ")
if bookName == 'q':
break
ISBN = get_isbn(bookName)
print("Select the Output format(recomended 2):")
for i ,val in enumerate(bformat):
print(f'{i+1}. {val}')
formatNUM = 1
formatNUM = int(input("$ ")) - 1
if formatNUM == 'q':
break
print(get_info(formatNUM,ISBN))
elif opt1==2:
isbnNumber = input("Enter the ISBN number: ")
if isbnNumber == 'q':
break
print("Select the Output format:")
for i ,val in enumerate(bformat):
print(f'{i+1}. {val}')
formatNUM = int(input("$ ")) - 1
if formatNUM == 'q':
break
print(get_info(formatNUM,isbnNumber))
elif opt1==3:
bookName = input("Enter the Name of the Book: ")
if bookName == 'q':
break
ISBN = get_isbn(bookName)
print("ISBN Number is "+ISBN)
elif opt1==4:
print("Scan the Barcode of Book!")
ISBN = BarcoderAPI.main()
print("Select the Output format(recomended 2):")
for i ,val in enumerate(bformat):
print(f'{i+1}. {val}')
formatNUM = 1
formatNUM = int(input("$ ")) - 1
if formatNUM == 'q':
break
print(get_info(formatNUM,ISBN))
else:
print("Invalid Input")