-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGPpyTools.py
More file actions
122 lines (96 loc) · 4.7 KB
/
Copy pathGPpyTools.py
File metadata and controls
122 lines (96 loc) · 4.7 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/env python
'''
Extract PLUGIN information from 'Gig Performer.settings' or .gig-files
=======================================================================
usage:
GPpyTools.py -s : extracts PLUGINS from 'Gig Performer.settings' and write to 'GigPerformerPlugins.xlsx' in same folder
GPpyToos.py <gigfie.gig> : extracts PLUGINS from 'gigfile.gig' and write to 'gigfile.gig.xlsx' in same folder
BBB, 27-NOV-2021 - initial script
BBB, 14-NOV-2022 - added Rackspace Names and delayedStart Info, added function AddPluginInfo(), Cleanup...
BBB, 19-NOV-2022 - final cleanup to provide binaries for the first time...
'''
import pandas as pd
import xml.etree.ElementTree as et
import openpyxl
import sys
import os.path
rows = [] # global, quick'n'dirty, see below...
# iterate through desired contecxt section and fill table
def AddPluginInfo(s_rackspacename, context, mode) :
global rows
for node in context.iter('PLUGIN'):
s_name = node.attrib.get("name")
s_manuf = node.attrib.get("manufacturer")
s_version = node.attrib.get ("version")
s_format = node.attrib.get ("format")
if mode == 'SETTINGS':
s_file = node.attrib.get ("file")
s_isEnabled = node.attrib.get ("isEnabled")
s_delayed = node.attrib.get("useDelayedLoading")
rows.append({"name": s_name, "manufacturer": s_manuf, "version": s_version,
"isEnabled": s_isEnabled, "delayedStart": s_delayed, "format": s_format, "file": s_file})
elif mode == 'GIG':
rows.append({"rackspace": s_rackspacename, "name": s_name, "manufacturer": s_manuf, "version": s_version, "format": s_format})
def main():
global rows
inputfile=""; outputCSV=''; outputXLS=''; mode = ''
args = sys.argv[1:]
if len(args) == 1 and args[0] == '-s':
inputfile = "Gig Performer.settings"
# if you want to read from your current config, just adjust uncomment and adjust to your personal situation
#inputfile = "/Users/USERNAME/Library/Application Support/GigPerformer/Gig Performer.settings" # on a Mac...
if os.path.isfile(inputfile):
outputCSV = "GigPerformerPlugins.csv"
outputXLS = "GigPerformerPlugins.xlsx"
mode = 'SETTINGS'
else:
print (inputfile + " does not exist?!")
return
elif len(args) == 1:
if os.path.isfile(args[0]):
inputfile = args[0]
outputCSV = args[0] + ".csv"
outputXLS = args[0] + ".xlsx"
mode = 'GIG'
else:
print (args[0] + " does not exist?!")
return
else:
print("GPpyTools.py -s or GPpyTools <inputfile.gig>")
return
# prepare XML-inputfile for readout
xtree = et.parse(inputfile)
xroot = xtree.getroot()
'''
Pick infos from the PLUGIN attribs (example):
name="4U+ DynamicTiltEQ" format="AudioUnit" category="Effect"
manufacturer="HOFA" version="1.0.7" file="AudioUnit:Effects/aufx,hff6,HOFA"
uid="08154711" isInstrument="0" fileTime="0" infoUpdateTime="179dd49ca03"
numInputs="4" numOutputs="2" isShell="0" isEnabled="1" useDelayedLoading="0"/>
'''
if mode == 'GIG':
print("Get Rackspaces from GIG file '" + inputfile + "'")
df_cols = ["rackspace", "name", "manufacturer", "version", "format"]
for n_rackspace in xroot.iter('GLOBALRACKSPACE'):
s_rackspace = n_rackspace.attrib.get("name")
#print (s_rackspace)
AddPluginInfo(s_rackspace, n_rackspace, mode)
for n_rackspace in xroot.iter('RACKSPACE'):
s_rackspace = n_rackspace.attrib.get("name")
#print (s_rackspace)
AddPluginInfo(s_rackspace, n_rackspace, mode)
if mode == 'SETTINGS':
print("Get global Plugin Manager information")
df_cols = ["name", "manufacturer", "version", "isEnabled", "delayedStart", "format", "file"]
AddPluginInfo('none', xroot, mode)
out_df = pd.DataFrame(rows, columns=df_cols)
# Writing dataframe to csv
# out_df.to_csv(outputCSV)
# print(outputCSV + " written")
# Writing dataframe to xsx
out_df.to_excel(outputXLS, sheet_name='Plugins')
print(outputXLS + " written")
# Python boilerplate.
if __name__ == '__main__':
main()
# eof...