summarylogtreecommitdiffstats
path: root/w2lvst3
blob: 1f25738f3086258f50cf5ad783d3b9e789ddbadc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python3

# Maintainer: Alexander Mcmillan <linuxguy93@gmail.com>

# Imported Modules
import os  # native OS support
import shutil  # high-level file operations support
import glob  # support globbing *
import time  # sleep/wake command support
import sys  # import sytem functions

# Golbal Variables
linvstfileso="/usr/bin/linvst3.so"  # the linvst3.so bridge file for the linvst3 bridge
homedir=os.path.expanduser("~")  # expand the current users home directory /home/<user>
vstdir=(homedir + "/" + ".vst3" + "/")  # DAW scanned VST directory
currentdir=os.getcwd() + "/"  # get the current work directory

# Executable Code
print ("\033[1;38m" + "Start LinVst3 Bridge Creation" + "\033[0m")  # print start message
os.makedirs(vstdir, exist_ok=True)  # create a /home/<user>/<vstdir> directory
for i in glob.glob("*.vst3"):  # check for all files with a .vst3 extension
    vstname, extdll=os.path.splitext(i)  # split the filename from its extension, store each value in a seperate variable
    extso=(".so")  # the destination exstension .so for Linux DAW compatibility
    shutil.copy2(linvstfileso, vstname + extso)  # copy the linvst.so bridge file to match the vstname .vst3 file. example: plugin.vst3, plugin.so
    print("\033[1;33m" + vstname + ": " + "\033[1;36m" + "Link Generated..." + "\033[0m")  # print the .so link to be generated
    if os.path.islink(vstdir + vstname + extso):  # Check if link exists
        os.remove(vstdir + vstname + extso)  # remove old link for vst bridge
        os.symlink(currentdir + vstname + extso, vstdir + vstname + extso)  # generate link for vst bridge
    else:
        os.symlink(currentdir + vstname + extso, vstdir + vstname + extso)  # generate link for vst bridge
    time.sleep(0.5)  # sleep for half a second