mirror of
https://github.com/283375/arcaea-offline.git
synced 2025-07-01 04:06:27 +00:00
Compare commits
5 Commits
a9f8ba6e22
...
v0.2.1
Author | SHA1 | Date | |
---|---|---|---|
0764308638
|
|||
e5c1e0ef4a
|
|||
8c48d76c65
|
|||
d79c73df8c
|
|||
7a64ec4a4a
|
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "arcaea-offline"
|
name = "arcaea-offline"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
authors = [{ name = "283375", email = "log_283375@163.com" }]
|
authors = [{ name = "283375", email = "log_283375@163.com" }]
|
||||||
description = "Manage your local Arcaea score database."
|
description = "Manage your local Arcaea score database."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -84,11 +84,15 @@ class AndrealImageGeneratorApiDataConverter:
|
|||||||
raise ValueError("No score available.")
|
raise ValueError("No score available.")
|
||||||
best30_avg = self.session.scalar(select(CalculatedPotential.b30))
|
best30_avg = self.session.scalar(select(CalculatedPotential.b30))
|
||||||
|
|
||||||
|
best30_overflow = (
|
||||||
|
[self.score(score) for score in scores[30:40]] if len(scores) > 30 else []
|
||||||
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"content": {
|
"content": {
|
||||||
"account_info": self.account_info(),
|
"account_info": self.account_info(),
|
||||||
"best30_avg": best30_avg,
|
"best30_avg": best30_avg,
|
||||||
"best30_list": [self.score(score) for score in scores[:30]],
|
"best30_list": [self.score(score) for score in scores[:30]],
|
||||||
"best30_overflow": [self.score(score) for score in scores[-10:]],
|
"best30_overflow": best30_overflow,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
src/arcaea_offline/external/arcaea/common.py
vendored
2
src/arcaea_offline/external/arcaea/common.py
vendored
@ -27,7 +27,7 @@ def fix_timestamp(timestamp: int) -> Union[int, None]:
|
|||||||
# but that's way too later than 9999-12-31 23:59:59, 253402271999,
|
# but that's way too later than 9999-12-31 23:59:59, 253402271999,
|
||||||
# I don't think Arcaea would still be an active updated game by then.
|
# I don't think Arcaea would still be an active updated game by then.
|
||||||
# so don't mind those small issues, just use this.
|
# so don't mind those small issues, just use this.
|
||||||
digits = int(math.log10(timestamp)) + 1
|
digits = int(math.log10(abs(timestamp))) + 1 if timestamp != 0 else 1
|
||||||
if digits < 5:
|
if digits < 5:
|
||||||
return None
|
return None
|
||||||
timestamp_str = str(timestamp)
|
timestamp_str = str(timestamp)
|
||||||
|
1
src/arcaea_offline/external/smartrte/__init__.py
vendored
Normal file
1
src/arcaea_offline/external/smartrte/__init__.py
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
from .b30_csv import SmartRteB30CsvConverter
|
64
src/arcaea_offline/external/smartrte/b30_csv.py
vendored
Normal file
64
src/arcaea_offline/external/smartrte/b30_csv.py
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
|
from ...models import Chart, ScoreBest
|
||||||
|
from ...utils.rating import rating_class_to_text
|
||||||
|
|
||||||
|
|
||||||
|
class SmartRteB30CsvConverter:
|
||||||
|
CSV_ROWS = [
|
||||||
|
"songname",
|
||||||
|
"songId",
|
||||||
|
"Difficulty",
|
||||||
|
"score",
|
||||||
|
"Perfect",
|
||||||
|
"criticalPerfect",
|
||||||
|
"Far",
|
||||||
|
"Lost",
|
||||||
|
"Constant",
|
||||||
|
"singlePTT",
|
||||||
|
]
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
session: Session,
|
||||||
|
):
|
||||||
|
self.session = session
|
||||||
|
|
||||||
|
def rows(self) -> list:
|
||||||
|
csv_rows = [self.CSV_ROWS.copy()]
|
||||||
|
|
||||||
|
with self.session as session:
|
||||||
|
results = (
|
||||||
|
session.query(
|
||||||
|
Chart.title,
|
||||||
|
ScoreBest.song_id,
|
||||||
|
ScoreBest.rating_class,
|
||||||
|
ScoreBest.score,
|
||||||
|
ScoreBest.pure,
|
||||||
|
ScoreBest.shiny_pure,
|
||||||
|
ScoreBest.far,
|
||||||
|
ScoreBest.lost,
|
||||||
|
Chart.constant,
|
||||||
|
ScoreBest.potential,
|
||||||
|
)
|
||||||
|
.join(
|
||||||
|
Chart,
|
||||||
|
(Chart.song_id == ScoreBest.song_id)
|
||||||
|
& (Chart.rating_class == ScoreBest.rating_class),
|
||||||
|
)
|
||||||
|
.all()
|
||||||
|
)
|
||||||
|
|
||||||
|
for result in results:
|
||||||
|
# replace the comma in song title because the target project
|
||||||
|
# cannot handle quoted string
|
||||||
|
result = list(result)
|
||||||
|
result[0] = result[0].replace(",", "")
|
||||||
|
result[2] = rating_class_to_text(result[2])
|
||||||
|
# divide constant to float
|
||||||
|
result[-2] = result[-2] / 10
|
||||||
|
# round potential
|
||||||
|
result[-1] = round(result[-1], 5)
|
||||||
|
csv_rows.append(result)
|
||||||
|
|
||||||
|
return csv_rows
|
@ -80,7 +80,12 @@ class ScoreCalculated(ScoresViewBase):
|
|||||||
(
|
(
|
||||||
case(
|
case(
|
||||||
(
|
(
|
||||||
(ChartInfo.notes.isnot(None) & ChartInfo.notes != 0),
|
(
|
||||||
|
ChartInfo.notes.is_not(None)
|
||||||
|
& Score.pure.is_not(None)
|
||||||
|
& Score.far.is_not(None)
|
||||||
|
& (ChartInfo.notes != 0)
|
||||||
|
),
|
||||||
Score.score
|
Score.score
|
||||||
- func.floor(
|
- func.floor(
|
||||||
(Score.pure * 10000000.0 / ChartInfo.notes)
|
(Score.pure * 10000000.0 / ChartInfo.notes)
|
||||||
|
Reference in New Issue
Block a user