File size: 838 Bytes
6ffd0b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import json, sys

INFO = '''

If you saved a json workflow using 'Anything Everywhere?' nodes before the third regex was added, then you may find that when you load it, the Group Regex widget doesn't correctly default to '.*'.



If so, run python workflow_fixer.py filename.json newname.json to fix it.

'''

def convert(oldname, newname):
    with open(oldname) as f: workflow = json.load(f)
    for node in workflow['nodes']:
        if node['type'] == "Anything Everywhere?":
            print(f"Fixing {node['title'] if 'title' in node else 'Untitled AE? node'}...")
            node['widgets_values'][2] = '.*'
    with open(newname,'w') as f: print(json.dumps(workflow, indent=2), file=f)

if __name__=='__main__':
    if len(sys.argv)!=3:
        print(INFO)
    else:
        convert(sys.argv[1], sys.argv[2])