archive/test2.py

55 lines
1.4 KiB
Python
Raw Normal View History

2021-11-22 16:13:24 -06:00
import os
import sys
args = sys.argv
minimum = int(sys.argv[1])
maximum = int(sys.argv[2])
outputgroup = sys.argv[4]
filelist = []
for i in os.listdir():
if ".png" in i: filelist.append(i)
filelist.sort()
groups = 0
files = 0
idx = 1
autogen = int(sys.argv[3])
data = [filelist[0], filelist[-1]]
splitted = [data[0].split('-'), data[1].split('-')]
splitted = [int(splitted[0][1]), int(splitted[1][1])]
print(f"cat {outputgroup}:")
print(" null: yes")
print("")
for i in range(max(minimum, splitted[0]), min(maximum, splitted[1]) + 1):
test = [j for j in filelist if "0000-" + str(i).zfill(4) in j]
if len(test) == 1:
print(f"rec g{str(autogen).zfill(2)}-f{str(files).zfill(4)}:")
print(f" file: {test[0]}")
print(f" inherit: {outputgroup}")
print(f" inherit_order: {idx}")
print("")
files += 1
idx += 1
else:
internal_idx = 1
print(f"cat g{str(autogen).zfill(2)}-g{str(groups).zfill(4)}:")
print(f" inherit: {outputgroup}")
print(f" inherit_order: {idx}")
print("")
for j in test:
print(f"rec g{str(autogen).zfill(2)}-f{str(files).zfill(4)}:")
print(f" file: {j}")
print(f" inherit: g{str(autogen).zfill(2)}-g{str(groups).zfill(4)}")
print(f" inherit_order: {internal_idx}")
print("")
internal_idx += 1
files += 1
idx += 1
groups += 1