File size: 1,147 Bytes
da855ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os, platform, subprocess

# setup dependencies on import
# check for any missing that the user needs to install and inform them
if platform.system() == "Windows":
    os.environ['PATH'] += ";" + os.path.join(os.path.dirname(__file__), 'bin', 'sox', 'windows')
    os.environ['PATH'] += ";" + os.path.join(os.path.dirname(__file__), 'bin', 'ffmpeg', 'windows')
    os.environ['PATH'] += ";" + os.path.join(os.path.dirname(__file__), 'bin', 'psola', 'windows')


elif platform.system() == "Linux":
    os.environ['PATH'] += ";" + os.path.join(os.path.dirname(__file__), 'bin', 'psola', 'linux')
    try:
        output = subprocess.check_output(['sox', '--version'])
    except Exception as e:
       raise Exception("Error calling sox dependency: " + str(e) + "\n\nHave you installed sox with 'apt-get install sox'?\n")

    try:
        output = subprocess.check_output(['ffmpeg', '-version'])
    except Exception as e:
       raise Exception("Error calling ffmpeg dependency: " + str(e) + "\n\nHave you installed ffmpeg with 'apt-get install ffmpeg'?\n")

else:
    raise Exception("Unsupported platform: {}".format(os.platform.system()))