script to aggregate dimocracy aliases from my hard drive
This commit is contained in:
parent
d5c682cd40
commit
33376ab44b
1 changed files with 41 additions and 0 deletions
41
aggregate-dimocracy-aliases.py
Normal file
41
aggregate-dimocracy-aliases.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
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()
|
Loading…
Reference in a new issue