Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
add audio_file_path parser arg
Browse files Browse the repository at this point in the history
  • Loading branch information
MGTheTrain committed Apr 17, 2024
1 parent 4adeb4a commit 4804437
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bindings/python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from core_wrapper import CoreWrapper
from audio_wrapper import AudioWrapper

def main(path, wrapper_type):
def main(path, wrapper_type, audio_file_path):
abs_path = os.path.realpath(path)

if wrapper_type == 'core':
Expand All @@ -52,9 +52,8 @@ def main(path, wrapper_type):
circumference = core_wr.get_circle_circumference(radius)
print("Circle circumference:", circumference)
elif wrapper_type == 'audio':
audio_wr = AudioWrapper()
audio_wr = AudioWrapper(abs_path)

audio_file_path = "assets/mp3/file_example_MP3_700KB.mp3"
if not audio_wr.load_audio_file(audio_file_path):
print("Failed to load audio file:", audio_file_path)
return
Expand All @@ -71,11 +70,14 @@ def main(path, wrapper_type):
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--path', type=str, help='Path to the wrapper library')
parser.add_argument('--wrapper', type=str, choices=['core', 'audio'], help='Select wrapper type: core or audio')
parser.add_argument('--audio_file_path', type=str, help='Path to the audio file')
args = parser.parse_args()

if not args.path:
parser.error('Please provide the path to the wrapper library using --path')
if not args.wrapper:
parser.error('Please select the wrapper type using --wrapper')
if args.wrapper == 'audio' and not args.audio_file_path:
parser.error('Please provide the path to the audio file using --audio_file_path')

main(args.path, args.wrapper)
main(args.path, args.wrapper, args.audio_file_path)

0 comments on commit 4804437

Please sign in to comment.