wip: arcaea-offline==0.2.0

This commit is contained in:
2023-09-01 04:01:14 +08:00
parent a9d2b5f75d
commit ecd4ed619e
8 changed files with 40 additions and 30 deletions

View File

@ -1,7 +1,7 @@
import logging
from arcaea_offline.database import Database
from arcaea_offline.models import Chart, Score
from arcaea_offline.models import Score
from arcaea_offline_ocr.b30.chieri.v4.ocr import ChieriBotV4Ocr
from arcaea_offline_ocr.b30.shared import B30OcrResultItem
from PySide6.QtGui import QImage
@ -27,25 +27,26 @@ class ChieriV4OcrRunnable(OcrRunnable):
self.signals.finished.emit()
def b30ResultToScoreInsert(_, qImage: QImage, result: B30OcrResultItem):
def b30ResultToScore(_: None, qImage: QImage, result: B30OcrResultItem):
if not result.song_id and not result.title:
raise ValueError("no title or song_id")
db = Database()
if not result.song_id:
song_id = db.fuzzy_search_song_id(result.title)[0][0]
raise NotImplementedError("Not supported yet.")
else:
song_id = result.song_id
chart = Chart.from_db_row(db.get_chart(song_id, result.rating_class))
score = ScoreInsert(
chart = db.get_chart(song_id, result.rating_class)
score = Score(
song_id=song_id,
rating_class=result.rating_class,
score=result.score,
time=1485014400,
date=None,
pure=result.pure,
far=result.far,
lost=result.lost,
comment="B30 OCR",
)
return (chart, score)