forked from splurge/splurge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtool.py
executable file
·41 lines (34 loc) · 1.6 KB
/
tool.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
#!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser(description='Process Splurge.')
parser.add_argument('--update_database', action='store_true', help='read all ./data into database tables')
parser.add_argument('--old_update_database', action='store_true', help='read all ./data into database tables')
parser.add_argument('--little_server', action='store_true', help='start a simple server')
parser.add_argument('--test', action='store_true')
args = parser.parse_args()
import os
root_app_path = os.path.join(os.path.dirname(__file__), 'app/')
root_app_bin_path = os.path.join(root_app_path, 'bin/')
import sys
sys.path.append(root_app_bin_path)
import splurge
splurge = splurge.Splurge(
os.path.join(root_app_path, 'data/'),
os.path.join(root_app_path, 'logs/'),
'splurge', 'splurge_user', os.environ['SPLURGE_DB_PASSWORD'], 'localhost', '5432',
)
if args.update_database: splurge.load_institution_updates()
if args.old_update_database: splurge.old_update_database()
if args.little_server:
os.environ['SPLURGE_ROOT_APP_PATH'] = root_app_path
file = os.environ['SPLURGE_ROOT_APP_PATH'] + '/website/splurge/splurge_webapp.py'
os.system("python " + file)
if args.test:
# Show recommendations for a random isbn(None) from Institution york between the years ...
# splurge.test2(None, splurge.createTransactionFilter(splurge.getInstitutionId('york'),'1985','2014') )
# Other possibilities:
# splurge.test2('9781552211281', splurge.createTransactionFilter(splurge.getInstitutionId('waterloo')) )
# splurge.test2('9781552211281')
# Random ISBN test
for i in range(4):
splurge.test()