@@ -27,7 +27,9 @@ def getfile(url):
27
27
return requests .get (url , headers = {'Authorization' : f'token { token } ' })
28
28
29
29
30
- def getPluginJson (plugin , shortUrls ):
30
+ def getPluginJson (plugin , shortUrls , debug = False ):
31
+ if debug :
32
+ print (f"Processing plugin: { plugin ['name' ]} " )
31
33
if "site" in plugin :
32
34
pluginsJson = getfile (plugin ["site" ]).json ()
33
35
for plugin in pluginsJson :
@@ -133,11 +135,13 @@ def getPluginJson(plugin, shortUrls):
133
135
else :
134
136
pluginjson = f"{ projectUrl } /contents/plugin.json?ref={ plugin ['tag' ]} "
135
137
try :
138
+ if debug :
139
+ print (f"Getting plugin.json from { pluginjson } " )
136
140
content = getfile (pluginjson ).json ()['content' ]
137
141
try :
138
142
data = json .loads (base64 .b64decode (content ))
139
143
except :
140
- print (f"\n \n Invalid json when parsing { pluginjson } . \n " )
144
+ print (f"\n \n Invalid json when parsing { pluginjson } \n " )
141
145
raise
142
146
if ('longdescription' in data and len (data ['longdescription' ]) < 100 ) or ('longdescription' not in data ):
143
147
try :
@@ -239,6 +243,8 @@ def getPluginJson(plugin, shortUrls):
239
243
# Native plugins require this version to not produce error logs.
240
244
if view_only and data ["minimumBinaryNinjaVersion" ] < 6135 :
241
245
data ["minimumBinaryNinjaVersion" ] = 6135
246
+ if debug :
247
+ print (f"Finished processing plugin: { plugin ['name' ]} " )
242
248
return data
243
249
244
250
@@ -249,6 +255,8 @@ def main():
249
255
parser .add_argument ("-r" , "--readmeskip" , action = "store_true" , default = False ,
250
256
help = "Skip generating a README.md" )
251
257
parser .add_argument ("-l" , "--listing" , action = "store" , default = "listing.json" )
258
+ parser .add_argument ("-d" , "--debug" , action = "store_true" , default = False ,
259
+ help = "Debugging output" )
252
260
parser .add_argument ("token" )
253
261
args = parser .parse_args (sys .argv [1 :])
254
262
global token
@@ -270,7 +278,7 @@ def main():
270
278
listing = json .load (open (args .listing , "r" , encoding = "utf-8" ))
271
279
for i , plugin in enumerate (listing ):
272
280
printProgressBar (i , len (listing ), prefix = "Collecting Plugin JSON files:" )
273
- jsonData = getPluginJson (plugin , shortUrls )
281
+ jsonData = getPluginJson (plugin , shortUrls , debug = args . debug )
274
282
if jsonData is not None :
275
283
allPlugins [plugin ["name" ]] = jsonData
276
284
printProgressBar (len (listing ), len (listing ), prefix = "Collecting Plugin JSON files:" )
0 commit comments