Skip to content

Commit

Permalink
Added cli as speecht-cli and install as script
Browse files Browse the repository at this point in the history
  • Loading branch information
louiskirsch committed Apr 22, 2017
1 parent c79d040 commit 171de5d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
name='speechT',
version='1.0',
packages=['speecht'],
scripts=['speecht-cli'],
url='https://github.com/timediv/speechT',
license='Apache License 2.0',
author='Louis Kirsch',
Expand Down
12 changes: 9 additions & 3 deletions cli.py → speecht-cli
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/python3

# Copyright 2017 Louis Kirsch. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -97,7 +99,7 @@ def _add_evaluation_parser(self):
evaluation_parser.set_defaults(dataset='test')

def _add_recording_parser(self):
recording_parser = self.subparsers.add_parser('record', help='Record using your microphone and inspect'
recording_parser = self.subparsers.add_parser('record', help='Record using your microphone and inspect '
'the transcription.',
parents=[self.base_parser])
recording_parser.add_argument('--input-size', dest='input_size', type=int, default=128,
Expand Down Expand Up @@ -139,6 +141,7 @@ def parsed(self):
parsed.run_type = 'record'
else:
parsed.run_type = 'other'
return parsed

parsed.run_train_dir = parsed.train_dir + '/' + parsed.run_name

Expand All @@ -155,8 +158,11 @@ def command_executor(self):
}[self.parsed.command](self.parsed)

def run(self):
self._ensure_directories()
self.command_executor.run()
if not self.parsed.command:
self.parser.print_help()
else:
self._ensure_directories()
self.command_executor.run()

def _ensure_directories(self):
directories = [self.parsed.train_dir,
Expand Down

0 comments on commit 171de5d

Please sign in to comment.