-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen.py
executable file
·99 lines (76 loc) · 1.92 KB
/
gen.py
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
#!/bin/env python
import os, sys, glob, getopt
from colorama import init, Fore, Back
from pprint import pprint
import ffmpeg
import subprocess
import shutil
from proclib import prun, splitnonalpha, getID, procTime, getFilesize
import time
from colorama import Fore, init
import proclib as p
init()
timestamp = round(time.time())
def showhelp():
print("help")
rs = '''
-h, --help help
-f, --from from settinsg file
-t, --to to settings file
-s, --subject <subject>:<count><mult>:<step> ex: cells:6:6:6
./gen.py -f last -t new -s cells:6:6:6 -M
'''
print(rs)
exit()
locationpath = os.getcwd()
dirname = os.getcwd()
basename = False
verbose = False
srcfile = False
fromfile = "sdw/last"
tofile = "sdw/new"
subject = False
count = 6
mult = 6
step = 6
runmod = False
if len(sys.argv) == 1:
showhelp()
argv = sys.argv[1:]
try:
opts, args = getopt.getopt(argv, "hf:t:s:M", [
"help",
"from=",
"to=",
"subject=",
"runmod",
])
except Exception as e:
p.errprint(str(e))
for opt, arg in opts:
if opt in ("-h", "--help"):
showhelp()
if opt in ("-f", "--fromfile"):
fromfile = f"sdw/{arg}"
if opt in ("-t", "--tofile"):
tofile = f"sdw/{arg}"
if opt in ("-s", "--subject"):
pts = arg.split(":")
subject = pts[0]
count = pts[1]
mult = pts[2]
steps = pts[3]
if opt in ("-M", "--runmod"):
runmod = True
cmd = f"genpair.py --type {subject} --count {count} --mult {mult} --steps {steps} -f {fromfile} -s prompts > {tofile}"
print(cmd)
os.system(cmd)
time.sleep(2)
if runmod == True:
cmd = f"genmod.py -f ${tofile} > {tofile}2"
print(cmd)
os.system(cmd)
print("Loaded from "+Fore.YELLOW+fromfile+Fore.RESET)
print("Saved to "+Fore.GREEN+tofile+Fore.RESET)
if runmod == True:
print("Mode file as "+Fore.RED+f"{tofile}2"+Fore.RESET)