Compare commits

..

No commits in common. "275f27155dbadde71ae7c61f1e0b5389abd74186" and "d5c682cd404360ecedf4da81906c8387f0acd4bd" have entirely different histories.

2 changed files with 0 additions and 58 deletions

View file

@ -1,41 +0,0 @@
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()

View file

@ -3,7 +3,6 @@ import csv
import _csv import _csv
from dataclasses import dataclass from dataclasses import dataclass
from datetime import datetime from datetime import datetime
from decimal import Decimal
import enum import enum
import os import os
from random import Random from random import Random
@ -23,7 +22,6 @@ import simfile
from simfile.dir import SimfilePack, SimfileDirectory from simfile.dir import SimfilePack, SimfileDirectory
from simfile.sm import SMChart, SMSimfile from simfile.sm import SMChart, SMSimfile
from simfile.ssc import SSCChart, SSCSimfile from simfile.ssc import SSCChart, SSCSimfile
from simfile.timing import BeatValues, BeatValue
from simfile.types import Simfile from simfile.types import Simfile
@ -458,17 +456,6 @@ def maybe_anonymize_entries(
os.remove(absolute_path) os.remove(absolute_path)
print(f"Deleted {os.path.relpath(absolute_path, temp_fs.root_path)}") print(f"Deleted {os.path.relpath(absolute_path, temp_fs.root_path)}")
def anonymize_bpms(bpm_str: str | None) -> str:
bpm_values = BeatValues.from_str(bpm_str)
bpm_values.append(
BeatValue(
beat=bpm_values[-1].beat + 10000,
value=bpm_values[-1].value + Decimal("0.001"),
)
)
print(f"Anonymized BPMs from {repr(bpm_str)} to {repr(str(bpm_values))}")
return str(bpm_values)
for row in csv_contents: for row in csv_contents:
if row[KnownColumns.IgnoreFile]: if row[KnownColumns.IgnoreFile]:
continue continue
@ -497,7 +484,6 @@ def maybe_anonymize_entries(
sm.cdtitle = "" sm.cdtitle = ""
sm.genre = "" sm.genre = ""
sm.music = f"{canonical_filename}.ogg" sm.music = f"{canonical_filename}.ogg"
sm.bpms = anonymize_bpms(sm.bpms)
for _chart in sm.charts: for _chart in sm.charts:
sm_chart: SMChart = _chart # typing workaround sm_chart: SMChart = _chart # typing workaround
sm_chart.description = row[KnownColumns.GeneratedAlias] sm_chart.description = row[KnownColumns.GeneratedAlias]
@ -519,15 +505,12 @@ def maybe_anonymize_entries(
ssc.cdimage = "" ssc.cdimage = ""
ssc.discimage = "" ssc.discimage = ""
ssc.labels = "" ssc.labels = ""
ssc.bpms = anonymize_bpms(ssc.bpms)
for _chart in ssc.charts: for _chart in ssc.charts:
ssc_chart: SSCChart = _chart # typing workaround ssc_chart: SSCChart = _chart # typing workaround
ssc_chart.description = "" ssc_chart.description = ""
ssc_chart.chartname = "" ssc_chart.chartname = ""
ssc_chart.chartstyle = "" ssc_chart.chartstyle = ""
ssc_chart.credit = row[KnownColumns.GeneratedAlias] ssc_chart.credit = row[KnownColumns.GeneratedAlias]
if ssc_chart.bpms:
ssc_chart.bpms = anonymize_bpms(ssc_chart.bpms)
maybe_rename_file(simfile_dir.ssc_path, f"{canonical_filename}.ssc") maybe_rename_file(simfile_dir.ssc_path, f"{canonical_filename}.ssc")
print( print(
f"Scrubbed {os.path.relpath(absolute_simfile_dir_path, temp_fs.root_path)}/{canonical_filename}.ssc" f"Scrubbed {os.path.relpath(absolute_simfile_dir_path, temp_fs.root_path)}/{canonical_filename}.ssc"