summarylogtreecommitdiffstats
path: root/w2lvst2
blob: bbc8afbc5270c95b77391d139fe809f6a194788a (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/share/LinVst/64bit-32bit/linvst.so"  # the linvst.so bridge file for the linvst bridge
homedir=os.path.expanduser("~")  # expand the current users home directory /home/<user>
vstdir=(homedir + "/" + ".vst" + "/")  # DAW scanned VST directory
currentdir=os.getcwd() + "/"  # get the current work directory

# Executable Code
print ("\033[1;38m" + "Start LinVst Bridge Creation" + "\033[0m")  # print start message
os.makedirs(vstdir, exist_ok=True)  # create a /home/<user>/<vstdir> directory
for i in glob.glob("*.dll"):  # check for all files with a .dll 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 .dll file. example: plugin.dll, 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