Support MUSIC and AESTHETICS sections
This commit is contained in:
parent
e4af5dcf3b
commit
ae9451f336
2 changed files with 79 additions and 4 deletions
|
@ -34,14 +34,12 @@ BCCE is in active development and this may break at any time; see the first para
|
||||||
|
|
||||||
These sections in the BCEX/BCCE spoiler logs currently have no logic and I'm aware of it. That doesn't mean sections *not* listed here have support; they may not and I'm not aware of them.
|
These sections in the BCEX/BCCE spoiler logs currently have no logic and I'm aware of it. That doesn't mean sections *not* listed here have support; they may not and I'm not aware of them.
|
||||||
|
|
||||||
- AESTHETICS
|
|
||||||
- MAGITEK
|
- MAGITEK
|
||||||
- DANCES
|
- DANCES
|
||||||
- ESPERS
|
- ESPERS
|
||||||
- ITEM MAGIC
|
- ITEM MAGIC
|
||||||
- ITEM EFFECTS
|
- ITEM EFFECTS
|
||||||
- COLOSSEUM
|
- COLOSSEUM
|
||||||
- MUSIC
|
|
||||||
- SHOPS
|
- SHOPS
|
||||||
- TREASURE CHESTS
|
- TREASURE CHESTS
|
||||||
- JUNCTIONS
|
- JUNCTIONS
|
||||||
|
|
81
main.py
81
main.py
|
@ -15,14 +15,12 @@ class Parser:
|
||||||
BCEX/BCCE spoiler logfile parser.
|
BCEX/BCCE spoiler logfile parser.
|
||||||
|
|
||||||
Sections missing support:
|
Sections missing support:
|
||||||
- AESTHETICS
|
|
||||||
- MAGITEK
|
- MAGITEK
|
||||||
- DANCES
|
- DANCES
|
||||||
- ESPERS
|
- ESPERS
|
||||||
- ITEM MAGIC
|
- ITEM MAGIC
|
||||||
- ITEM EFFECTS
|
- ITEM EFFECTS
|
||||||
- COLOSSEUM
|
- COLOSSEUM
|
||||||
- MUSIC
|
|
||||||
- SHOPS
|
- SHOPS
|
||||||
- TREASURE CHESTS
|
- TREASURE CHESTS
|
||||||
- JUNCTIONS
|
- JUNCTIONS
|
||||||
|
@ -288,6 +286,85 @@ class Parser:
|
||||||
# I have no idea what this is lol, dump it to a list for now
|
# I have no idea what this is lol, dump it to a list for now
|
||||||
return [line for line in data.split("\n") if not line.startswith("---")]
|
return [line for line in data.split("\n") if not line.startswith("---")]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def parse_MUSIC(data: str) -> dict[str, dict]:
|
||||||
|
"""
|
||||||
|
Parse the MUSIC section.
|
||||||
|
|
||||||
|
This differs significantly between BCEX and BCCE: Numbers and data are split
|
||||||
|
with a period in BCCE and a colon in BCEX. BCEX puts arranger on the same line
|
||||||
|
as composer, split with --, BCEX lacks the Jukebox Title section entirely.
|
||||||
|
"""
|
||||||
|
music_sections = data.split("\n\n")
|
||||||
|
|
||||||
|
replacements = {}
|
||||||
|
|
||||||
|
for section in music_sections[1:]:
|
||||||
|
if not section.strip():
|
||||||
|
continue
|
||||||
|
|
||||||
|
# BCEX and BCCE divide numbers from data differently
|
||||||
|
if ":" in section[:6]:
|
||||||
|
_, info = section.split(":", 1)
|
||||||
|
else:
|
||||||
|
_, info = section.split(".", 1)
|
||||||
|
|
||||||
|
# The name of the song being replaced preceeds a ->
|
||||||
|
old_name, info = info.split("->", 1)
|
||||||
|
old_name = old_name.strip()
|
||||||
|
|
||||||
|
replacements[old_name] = {}
|
||||||
|
|
||||||
|
# Info is, mostly, one item per line, so let's go by line
|
||||||
|
tok_info = info.split("\n")
|
||||||
|
|
||||||
|
for k in ("name", "title", "composer", "arranger", "jukebox_title"):
|
||||||
|
# Not every song has all the data
|
||||||
|
if not len(tok_info):
|
||||||
|
break
|
||||||
|
|
||||||
|
line = tok_info.pop(0).strip()
|
||||||
|
|
||||||
|
# BCCE puts arranger on its own line. BCEX puts it on the same line as
|
||||||
|
# composed, split by "--". So we have to handle both
|
||||||
|
if "-- Arranged by " in line:
|
||||||
|
line, arranger = line.split("-- Arranged by ", 1)
|
||||||
|
replacements[old_name]["arranger"] = arranger
|
||||||
|
|
||||||
|
# Jukebox Title is in prens with extra stuff to chomp
|
||||||
|
if "Jukebox title" in line:
|
||||||
|
line = line[16:-1]
|
||||||
|
|
||||||
|
# These strings are fluff but should only appear in compose/arranger lines
|
||||||
|
# so it's safe to just blindly chomp them
|
||||||
|
line = line.split("Composed by ", 1)[-1].strip()
|
||||||
|
line = line.replace("Ripped and/or arranged by ", "")
|
||||||
|
|
||||||
|
replacements[old_name][k] = line
|
||||||
|
|
||||||
|
return replacements
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def parse_AESTHETICS(data: str) -> dict[str, str]:
|
||||||
|
"""
|
||||||
|
Parse the BCCE-only AESTHETICS section.
|
||||||
|
|
||||||
|
This is just a k=v list we split up and strip.
|
||||||
|
"""
|
||||||
|
replacements = {}
|
||||||
|
|
||||||
|
for line in data.split("\n"):
|
||||||
|
if ":" not in line:
|
||||||
|
continue
|
||||||
|
|
||||||
|
old, new = line.split(":")
|
||||||
|
old = old.strip()
|
||||||
|
new = new.strip()
|
||||||
|
|
||||||
|
replacements[old] = new
|
||||||
|
|
||||||
|
return replacements
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def cleanup_STATS(data: dict) -> bool:
|
def cleanup_STATS(data: dict) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue