42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
|
from glob import iglob
|
||
|
|
||
|
import simfile
|
||
|
from simfile.dir import SimfilePack
|
||
|
from simfile.sm import SMChart, SMSimfile
|
||
|
from simfile.ssc import SSCChart
|
||
|
|
||
|
|
||
|
pack_pattern = R"D:\SM\Disabled Songs\dimocracy 202*"
|
||
|
|
||
|
|
||
|
def main():
|
||
|
for pack_dir in iglob(pack_pattern):
|
||
|
print(f"========== {pack_dir} ==========")
|
||
|
for sim, path in simfile.openpack(pack_dir=pack_dir, strict=False):
|
||
|
if len(sim.charts) == 0:
|
||
|
print(f"WARNING: {path} has no charts")
|
||
|
continue
|
||
|
matches = list(
|
||
|
filter(
|
||
|
lambda ch: ch.difficulty == "Challenge"
|
||
|
and ch.stepstype == "dance-single",
|
||
|
sim.charts,
|
||
|
)
|
||
|
)
|
||
|
if len(matches) > 0:
|
||
|
chart = matches[0]
|
||
|
else:
|
||
|
chart = sim.charts[0]
|
||
|
|
||
|
if isinstance(chart, SMChart):
|
||
|
print(chart.description)
|
||
|
else:
|
||
|
nonnull_fields = set(
|
||
|
filter(None, [chart.credit, chart.description, chart.chartname])
|
||
|
)
|
||
|
print(" OR ".join(nonnull_fields))
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|