Skip to content

Commit

Permalink
Add OST data
Browse files Browse the repository at this point in the history
  • Loading branch information
leapwill committed Oct 22, 2021
1 parent cc4f856 commit 713feef
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 8 deletions.
41 changes: 37 additions & 4 deletions BeatSaberStats.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ $ScoreRankMap = [string[]]@(
'SSS'
)
#endregion
# TODO load vanilla levels data (what format?)
# TODO load OST levels data (what format?)
# TODO handle zipped CustomWIPLevels

#region small utility functions
Expand Down Expand Up @@ -354,12 +354,45 @@ else {
}
}


# get score info for levels not already processed (vanilla or deleted custom levels)
#region post-threaded work
$Stopwatch = New-Object System.Diagnostics.Stopwatch
# add provided info for OST levels
$Stopwatch.Restart()
$processedLevelIds = New-Object -Type 'System.Collections.Generic.HashSet[string]' -ArgumentList (,[string[]]($LevelStats | ForEach-Object {$_['ID']}))
$unprocessedScoresByLevel = $PlayerData.levelsStatsData | Where-Object {$_.beatmapCharacteristicName -eq 'Standard' -and -not $processedLevelIds.Contains($_.levelId)} | Group-Object -Property levelId -AsHashTable
if (Test-Path 'ost.csv') {
foreach ($csvInfo in Import-Csv -Path ost.csv) {
# convert from PSCustomObject to LevelInfo so key lookup works
$levelInfo = Construct-LevelInfo
foreach ($member in ($csvInfo | Get-Member | Where-Object { $_.MemberType -eq 'NoteProperty' })) {
$levelInfo[$member.Name] = $csvInfo."$($member.Name)"
}
# TODO qqq PICKUP get scores, maybe get unprocessedLevelIds before this and remove as they are processed
$scores = $unprocessedScoresByLevel[$levelInfo['ID']]
foreach ($score in $scores) {
$prefix = $DifficultyRankMap[[Math]::Floor($score.difficulty)]
$levelInfo["$prefix Score"] = $score.highScore
if ($score.fullCombo) {
$levelInfo["$prefix Combo"] = 'FC'
}
else {
$levelInfo["$prefix Combo"] = $score.maxCombo
}
$levelInfo["$prefix Rank"] = $ScoreRankMap[$score.maxRank]
$levelInfo["$prefix Plays"] = $score.playCount
$levelInfo["$prefix Valid"] = $score.validScore
}
$unprocessedScoresByLevel.Remove($levelInfo['ID'])
$LevelStats.Add($levelInfo)
}
}
else {
Write-Warning 'No ost.csv found, OST level info will be scores only'
}
Write-Debug "OST levels done in `t$($Stopwatch.ElapsedMilliseconds)"

# get score info for levels not already processed (DLC or deleted custom levels)
$Stopwatch.Restart()
foreach ($entry in $unprocessedScoresByLevel.GetEnumerator()) {
# TODO dedupe this with the code inside the thread
$levelInfo = Construct-LevelInfo
Expand All @@ -380,7 +413,7 @@ foreach ($entry in $unprocessedScoresByLevel.GetEnumerator()) {
$LevelStats.Add($levelInfo)
}
Write-Debug "remaining scores done in `t$($Stopwatch.ElapsedMilliseconds)"

#endregion

#region output
if ($OutFile -eq '') {
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,30 @@ The script currently requires one of:
* You can check `$PSVersionTable.CLRVersion`

You may have to run the below command to allow scripts to run:
```pwsh
```powershell
PS> Set-ExecutionPolicy RemoteSigned
```


## About the Data

* OST data was gathered manually and is loaded from `ost.csv` on each run.
* `~NP10S` is left `null`. I think `~NPS + 1` is a decent estimate based on the custom levels I have.
* Duration is measured as the time between the first and last notes, so it is always ≤ the song duration.
* Consequently, NPS is always ≥ the NPS reported in the game.
* However, this avoids the NPS being diluted by long intros or outros, making it a more accurate indicator of difficulty.
* Custom levels are referenced in the player save file by `custom_level_<hash>`, where the hash is the SHA1 of info.dat and all beatmap files concatenated together in the order they appear in the level info file.
* e.g.
```
```bash
$ grep .dat info.dat
"_beatmapFilename": "Normal.dat",
"_beatmapFilename": "Hard.dat",
$ cat info.dat Normal.dat Hard.dat | sha1sum
0b0ad0f34b2d0687a9794bcf5019100fda06971e -
```
* In a beatmap, the `_time` properties are measured in beats, so use BPM from info.dat to get real time.
* This is the same method that [SongCore](https://github.com/Kylemc1413/SongCore) uses.
* In a beatmap, the `_time` properties are measured in beats, so use `BPM` from `info.dat` to get real time.

## Contributing

There are some TODOs in the code if you want to add features. If you want to add something beyond the TODOs, open an issue for discussion.
There are some TODOs in the code if you want to add features. If you want to add something beyond the TODOs, open an issue for discussion. You could also contribute to `ost.csv`, or parsing the OST levels programmatically.
37 changes: 37 additions & 0 deletions ost.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Song,Artist,Mapper,BPM,Environment,~Duration,Y Valid,Y Plays,Y Rank,Y Combo,Y Score,Y NP10S,Y ~NPS,Y Notes,N Valid,N Plays,N Rank,N Combo,N Score,N NP10S,N ~NPS,N Notes,H Valid,H Plays,H Rank,H Combo,H Score,H NP10S,H ~NPS,H Notes,E Valid,E Plays,E Rank,E Combo,E Score,E NP10S,E ~NPS,E Notes,E+ Valid,E+ Plays,E+ Rank,E+ Combo,E+ Score,E+ NP10S,E+ ~NPS,E+ Notes,ID
$100 Bills,Jaroslav Beck,OST Vol. 1,210,,02:21,,,,,,,1.1,156,,,,,,,1.38,196,,,,,,,1.86,264,,,,,,,3.08,437,,,,,,,5.18,734,100Bills
Balearic Pumping,Jaroslav Beck,OST Vol. 1,111,,02:14,,,,,,,1.26,170,,,,,,,1.78,239,,,,,,,2.53,341,,,,,,,3.41,459,,,,,,,4.52,608,BalearicPumping
Beat Saber,Jaroslav Beck,OST Vol. 1,166,,01:50,,,,,,,0.85,94,,,,,,,1.05,116,,,,,,,1.83,202,,,,,,,2.42,267,,,,,,,5.72,632,BeatSaber
Breezer,Jaroslav Beck,OST Vol. 1,112.5,,02:01,,,,,,,0.87,106,,,,,,,1.42,173,,,,,,,2.24,272,,,,,,,2.93,356,,,,,,,4.65,566,Breezer
Commercial Pumping,Jaroslav Beck,OST Vol. 1,105,,02:21,,,,,,,0.96,136,,,,,,,1.5,213,,,,,,,2.32,329,,,,,,,3.15,447,,,,,,,5.98,848,CommercialPumping
Country Rounds (Sqeepo Remix),"Jaroslav Beck, Kings & Folk",OST Vol. 1,210,,02:50,,,,,,,0.89,151,,,,,,,1.22,208,,,,,,,1.73,295,,,,,,,3.19,544,,,,,,,4.54,773,CountryRounds
Escape (ft. Summer Haze),"Jaroslav Beck, Summer Haze ",OST Vol. 1,175,,02:41,,,,,,,0.97,157,,,,,,,1.21,195,,,,,,,1.78,287,,,,,,,2.47,399,,,,,,,3.71,600,Escape
Legend (ft. Backchat),"Jaroslav Beck, Backchat, Generdyn",OST Vol. 1,90,,01:57,,,,,,,1.27,150,,,,,,,1.56,184,,,,,,,1.83,216,,,,,,,2.45,289,,,,,,,5.41,638,Legend
Lvl Insane,Jaroslav Beck,OST Vol. 1,160,,01:50,,,,,,,0.93,102,,,,,,,1.26,139,,,,,,,1.8,198,,,,,,,3,330,,,,,,,5.33,587,LvlInsane
Turn Me On (ft. Tiny C),"Jaroslav Beck, Tiny C",OST Vol. 1,80,,01:51,,,,,,,1.09,121,,,,,,,1.41,156,,,,,,,2.2,244,,,,,,,3.07,341,,,,,,,5.97,663,TurnMeOn
Be There For You (ft. Kinnie Lane),Sedliv,OST Vol. 2,126,,02:51,,,,,,,0.85,146,,,,,,,1.45,250,,,,,,,1.88,323,,,,,,,3.02,519,,,,,,,4.4,757,BeThereForYou
Elixia,Mord Fustang,OST Vol. 2,128,,02:33,,,,,,,0.93,143,,,,,,,1.95,300,,,,,,,2.44,375,,,,,,,3.21,494,,,,,,,4.84,744,Elixia
I Need You,Megaphonix,OST Vol. 2,128,,02:10,,,,,,,1.11,145,,,,,,,1.71,224,,,,,,,2.58,338,,,,,,,3.23,423,,,,,,,4.86,635,INeedYou
Rum n' Bass,Boom Kitty,OST Vol. 2,132,,03:09,,,,,,,0.82,155,,,,,,,1.5,285,,,,,,,2.11,401,,,,,,,3.17,603,,,,,,,4.96,943,RumNBass
Unlimited Power (ft. Frank Bentley),Jaroslav Beck,OST Vol. 2,198,,02:00,,,,,,,1.03,124,,,,,,,1.66,199,,,,,,,2.52,302,,,,,,,3.17,380,,,,,,,5.13,615,UnlimitedPower
Origins (ft. Mutrix),Jaroslav Beck & Jan Ilavsky,OST Vol. 3,175,,02:28,,,,,,,1.34,199,,,,,,,1.93,286,,,,,,,2.57,380,,,,,,,3.66,542,,,,,,,3.94,584,Origins
Reason For Living,Morgan Page,OST Vol. 3,128,,03:34,,,,,,,1.1,235,,,,,,,1.76,376,,,,,,,2.74,587,,,,,,,3.8,815,,,,,,,4.22,903,ReasonForLiving
Give a Little Love,Pegboard Nerds,OST Vol. 3,128,,02:43,,,,,,,1.29,211,,,,,,,1.85,301,,,,,,,2.13,347,,,,,,,4.26,695,,,,,,,4.85,791,GiveALittleLove
Full Charge,PIXL,OST Vol. 3,125,,02:14,,,,,,,1.5,201,,,,,,,2.08,280,,,,,,,3.07,413,,,,,,,4.27,574,,,,,,,5.31,714,FullCharge
Immortal,Slippy,OST Vol. 3,150,,02:54,,,,,,,1.51,264,,,,,,,2.38,415,,,,,,,3.11,542,,,,,,,3.86,674,,,,,,,4.55,793,Immortal
Burning Sands,Boom Kitty,OST Vol. 3,142,,03:37,,,,,,,1.51,327,,,,,,,2.17,472,,,,,,,3.25,706,,,,,,,4.26,926,,,,,,,5.18,1126,BurningSands
Into the Dream,Jaroslav Beck,OST Vol. 4,183,,03:14,,,,,,,1.41,274,,,,,,,1.87,362,,,,,,,2.78,540,,,,,,,4.12,800,,,,,,,5.34,1036,IntoTheDream
It Takes Me (ft. Waylon Reavis),Boom Kitty,OST Vol. 4,220,,02:56,,,,,,,1.51,266,,,,,,,2.2,388,,,,,,,3.85,680,,,,,,,5.14,909,,,,,,,5.79,1023,ItTakesMe
LUDICROUS+,Jaroslav Beck,OST Vol. 4,260,,01:52,,,,,,,1.62,183,,,,,,,2.24,253,,,,,,,3.4,384,,,,,,,4.47,504,,,,,,,5.33,602,LudicrousPlus
Spin Eternally,Camellia,OST Vol. 4,222,,03:48,,,,,,,1.46,332,,,,,,,2.55,581,,,,,,,4.24,967,,,,,,,5.81,1325,,,,,,,7.65,1746,SpinEternally
FitBeat,Jaroslav Beck,OST Extras,215,,01:52,,,,,,,1.35,151,,,,,,,2.31,259,,,,,,,2.79,313,,,,,,,3.91,438,,,,,,,4.8,538,FitBeat
Crab Rave,Noisestorm,OST Extras,125,,02:33,,,,,,,1.15,176,,,,,,,2.48,381,,,,,,,3.37,518,,,,,,,4.19,643,,,,,,,4.65,715,CrabRave
POP/STARS - K/DA,League of Legends,OST Extras,170,,03:09,,,,,,,1.19,226,,,,,,,1.8,341,,,,,,,2.57,486,,,,,,,3.58,679,,,,,,,4.93,934,PopStars
One Hope (ft. David Binney),KNOWER,OST Extras,145,,02:52,,,,,,,1.65,286,,,,,,,2.17,376,,,,,,,2.91,503,,,,,,,4.23,731,,,,,,,5.39,932,OneHope
Angel Voices,Virtual Self,OST Extras,166,,06:12,,,,,,,1.63,607,,,,,,,2.15,800,,,,,,,2.55,948,,,,,,,3.23,1202,,,,,,,4.52,1681,AngelVoices
EXiT This Earth's Atmosphere,Camellia,OST Camellia,170,,05:09,,,,,,,1.36,420,,,,,,,2.42,749,,,,,,,3.6,1117,,,,,,,4.81,1492,,,,,,,5.67,1756,ExitThisEarthsAtomosphere
GHOST,Camellia,OST Camellia,220,,05:13,,,,,,,2.04,640,,,,,,,2.66,834,,,,,,,4.13,1296,,,,,,,6.49,2035,,,,,,,8.69,2726,Ghost
Light It Up,Camellia,OST Camellia,174,,06:10,,,,,,,1.73,639,,,,,,,2.56,948,,,,,,,4.03,1492,,,,,,,5.98,2214,,,,,,,6.24,2310,LightItUp
Crystallized,Camellia,OST Camellia,174,,03:58,,,,,,,1.57,374,,,,,,,2.6,620,,,,,,,4.04,965,,,,,,,5.62,1340,,,,,,,5.97,1425,Crystallized
Cycle Hit,"Kasai Harcores (DJ Genki,C-Show,Camellia)",OST Camellia,175,,05:17,,,,,,,1.57,499,,,,,,,2.38,754,,,,,,,3.36,1066,,,,,,,5.15,1633,,,,,,,6.37,2023,CycleHit
WHAT THE CAT!?,Camellia,OST Camellia,200,,03:25,,,,,,,2.2,453,,,,,,,3.22,662,,,,,,,4.2,864,,,,,,,5.19,1067,,,,,,,6.26,1286,WhatTheCat

0 comments on commit 713feef

Please sign in to comment.