Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions pyaudioconvert/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,6 @@

RUN_ID = str(uuid.uuid4())[:4]

# check that sox is installed
def bool_which(program):

def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)

fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return True
else:
for path in os.environ["PATH"].split(os.pathsep):
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return True

return False


class SoxNotInstalled(Exception):
pass

Expand All @@ -40,8 +21,8 @@ class OverwriteFileError(Exception):


try:
assert(bool_which('sox'))
except AssertionError:
assert("sox:" in subprocess.run("sox --version", capture_output=True).stdout.decode())
except (AssertionError, FileNotFoundError):
raise SoxNotInstalled()


Expand All @@ -57,7 +38,6 @@ def _valid_readable_file(file_path):
# def _valid_audiofile(audio_file_path):
# return _valid_readable_file(audio_file_path)


def _is_24bit_audio(audio_file_path):

# todo what about non-wavs?
Expand Down