Skip to content

Commit

Permalink
Now possible to add multiple orders and associated server
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Jendryke committed Dec 7, 2017
1 parent 1364c7c commit 93358d5
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions nyx.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def create_arg_parser():
)
parser.add_argument(
'-l', '--server',
nargs='+',
default="",
choices=[
'ncdc',
Expand Down Expand Up @@ -168,18 +169,26 @@ def main(argv):
print('Something went wrong')
elif mode == 'addOrder':
print('Add a new order')
for i in parsed_args.orderNumber:
orderNumber = checkInput.orderNumber(i)
server = checkInput.server(parsed_args.server)
directory = checkInput.path(parsed_args.path)
if downloadmanager.order.add(orderNumber, server, directory) is None:
print('Order {o} from Server {s} will be added at {p}'.format(
o=orderNumber,
s=server,
p=directory
))
orderserver = zip(parsed_args.orderNumber, parsed_args.server)
directory = checkInput.path(parsed_args.path)
for i in orderserver:
orderNumber = checkInput.orderNumber(i[0])
server = checkInput.server(i[1])
question = 'Order {o} from Server {s} will be added at {p}'.format(
o=orderNumber,
s=server,
p=directory
)
answer = utilities.queries.query_yes_no(question)
if answer == 'yes':
try:
downloadmanager.order.add(orderNumber, server, directory)
except:
print('There was an error, the order has not been added')
else:
print('There was an error, the order has not been added')
print('Order will not be added.')
exit()

elif mode == 'getManifest':
print('Get the manifest for NEW orders')
SQL = "SELECT * FROM getmanifest"
Expand Down

0 comments on commit 93358d5

Please sign in to comment.